|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# exit on failure |
| 4 | +set -e |
| 5 | + |
| 6 | +# need to run in sudo mode on Mac |
| 7 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 8 | + if [ "$EUID" -ne 0 ]; then |
| 9 | + echo "This script must be run in sudo mode! Exiting..." |
| 10 | + exit 1 |
| 11 | + fi |
| 12 | +fi |
| 13 | + |
| 14 | +if [[ "$*" = *debug* ]]; then |
| 15 | + echo "Making DEBUG build" |
| 16 | + build_config="Debug" |
| 17 | +else |
| 18 | + echo "Making RELEASE build" |
| 19 | + build_config="Release" |
| 20 | +fi |
| 21 | + |
| 22 | +# clean up old builds |
| 23 | +if [[ $* = *clean* ]]; then |
| 24 | + echo "Cleaning previous build..." |
| 25 | + rm -rf build-aax/ |
| 26 | +fi |
| 27 | + |
| 28 | +sed_cmakelist() |
| 29 | +{ |
| 30 | + sed_args="$1" |
| 31 | + |
| 32 | + if [[ "$OSTYPE" == "darwin"* ]]; then |
| 33 | + sed -i '' "$sed_args" CMakeLists.txt |
| 34 | + else |
| 35 | + sed -i -e "$sed_args" CMakeLists.txt |
| 36 | + fi |
| 37 | +} |
| 38 | + |
| 39 | +# set up OS-dependent variables |
| 40 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 41 | + echo "Building for MAC" |
| 42 | + AAX_PATH=~/Developer/AAX_SDK/ |
| 43 | + ilok_pass=$(more ~/Developer/ilok_pass) |
| 44 | + aax_target_dir="/Library/Application Support/Avid/Audio/Plug-Ins" |
| 45 | + TEAM_ID=$(more ~/Developer/mac_id) |
| 46 | + TARGET_DIR="Mac" |
| 47 | + |
| 48 | +else # Windows |
| 49 | + echo "Building for WINDOWS" |
| 50 | + AAX_PATH=C:/SDKs/AAX_SDK/ |
| 51 | + ilok_pass=$(cat /c/SDKs/ilok_pass) |
| 52 | + aax_target_dir="/c/Program Files/Common Files/Avid/Audio/Plug-Ins" |
| 53 | + TARGET_DIR="Win64" |
| 54 | +fi |
| 55 | + |
| 56 | +# set up build AAX |
| 57 | +#sed_cmakelist "s~# juce_set_aax_sdk_path.*~juce_set_aax_sdk_path(${AAX_PATH})~" |
| 58 | + |
| 59 | +# cmake new builds |
| 60 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 61 | + cmake -Bbuild-aax -GXcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="Developer ID Application" \ |
| 62 | + -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM="$TEAM_ID" \ |
| 63 | + -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE="Manual" \ |
| 64 | + -D"CMAKE_OSX_ARCHITECTURES=x86_64" \ |
| 65 | + -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS=NO \ |
| 66 | + -DCMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS="--timestamp" \ |
| 67 | + -DMACOS_RELEASE=ON |
| 68 | + |
| 69 | + cmake --build build-aax --config $build_config --target SmartAmp_AAX | xcpretty |
| 70 | + |
| 71 | +else # Windows |
| 72 | + cmake -Bbuild-aax -G"Visual Studio 16 2019" -A x64 |
| 73 | + cmake --build build-aax --config $build_config --parallel $(nproc) --target SmartAmp_AAX |
| 74 | +fi |
| 75 | + |
| 76 | +# sign with PACE |
| 77 | +aax_location=build-aax/SmartAmp_artefacts/$build_config/AAX/SmartAmp.aaxplugin |
| 78 | +wcguid="" # Update |
| 79 | +if [[ "$OSTYPE" == "darwin"* ]]; then |
| 80 | + /Applications/PACEAntiPiracy/Eden/Fusion/Current/bin/wraptool sign --verbose \ |
| 81 | + --account keyth72 \ |
| 82 | + --password "$ilok_pass" \ |
| 83 | + --wcguid $wcguid \ |
| 84 | + --dsig1-compat off \ |
| 85 | + --signid "Developer ID Application: Keith Bloemer" \ |
| 86 | + --in $aax_location \ |
| 87 | + --out $aax_location |
| 88 | + |
| 89 | + /Applications/PACEAntiPiracy/Eden/Fusion/Current/bin/wraptool verify --verbose --in $aax_location |
| 90 | + |
| 91 | +else # Windows |
| 92 | + wraptool sign --verbose \ |
| 93 | + --account keyth72 \ |
| 94 | + --password "$ilok_pass" \ |
| 95 | + --wcguid $wcguid \ |
| 96 | + --keyfile /c/SDKs/keith_aax_cert.p12 \ |
| 97 | + --keypassword "$ilok_pass" \ |
| 98 | + --in $aax_location \ |
| 99 | + --out $aax_location |
| 100 | + |
| 101 | + wraptool verify --verbose --in $aax_location/Contents/x64/SmartAmp.aaxplugin |
| 102 | +fi |
| 103 | + |
| 104 | +# reset AAX SDK field... |
| 105 | +#sed_cmakelist "s~juce_set_aax_sdk_path.*~# juce_set_aax_sdk_path(NONE)~" |
| 106 | + |
| 107 | +rm -rf "$aax_target_dir/SmartAmp.aaxplugin" |
| 108 | +cp -R "$aax_location" "$aax_target_dir/SmartAmp.aaxplugin" |
| 109 | + |
| 110 | +if [[ "$*" = *deploy* ]]; then |
| 111 | + set +e |
| 112 | + |
| 113 | + ssh "[email protected]" "rm -r ~/aax_builds/${TARGET_DIR}/SmartAmp.aaxplugin" |
| 114 | + scp -r "$aax_location" "[email protected]:~/aax_builds/${TARGET_DIR}/" |
| 115 | +fi |
0 commit comments