|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +echo '--- Define script directory ---' |
| 4 | +SCRIPT_DIRECTORY=$(cd $(dirname $0);pwd) |
| 5 | +cd ${SCRIPT_DIRECTORY} |
| 6 | + |
| 7 | +# Script job will terminate when error occured. |
| 8 | +set -e |
| 9 | + |
| 10 | +# Prepare function |
| 11 | +function FAILURE() { |
| 12 | + echo "*** Build Failed ***" |
| 13 | + exit |
| 14 | +} |
| 15 | + |
| 16 | +function SUCCESS() { |
| 17 | + echo "*** Build Success ***" |
| 18 | + exit |
| 19 | +} |
| 20 | + |
| 21 | +echo '--- Set variables ---' |
| 22 | +PROJECT_NAME=GLSLPlugIn |
| 23 | +ARCHITECTURE=x86_64 |
| 24 | +BUILD_CONFIG=Release |
| 25 | +EXPORTER_NAME=MacOSX |
| 26 | + |
| 27 | +echo '--- Set variables for enabling each plugin format type ---' |
| 28 | +ENABLE_VST=true |
| 29 | +VST_LEGACY_SDK_PATH="${SCRIPT_DIRECTORY}/../../3rd-party/VST3 SDK" |
| 30 | +ENABLE_VST3=false |
| 31 | +VST3_SDK_PATH= |
| 32 | +ENABLE_AAX=false |
| 33 | +AAX_SDK_PATH= |
| 34 | +ENABLE_AU=true |
| 35 | + |
| 36 | +echo '--- Set enable/disable concatet version number for binary file ---' |
| 37 | +CONCAT_VERSION_NUMBER=false |
| 38 | + |
| 39 | +PROJUCER_EXE="${SCRIPT_DIRECTORY}/../../Projucer/Projucer.app/Contents/MacOS/Projucer" |
| 40 | + |
| 41 | +echo '--- Set Projucer global search path ---' |
| 42 | +if test "${ENABLE_VST}" = "true"; then |
| 43 | + if test "${VST_LEGACY_SDK_PATH}" != ""; then |
| 44 | + "${PROJUCER_EXE}" --set-global-search-path osx vstLegacyPath "${VST_LEGACY_SDK_PATH}" |
| 45 | + echo "${VST_LEGACY_SDK_PATH}" |
| 46 | + else |
| 47 | + echo "*** Please set a value to the variable VST_LEGACY_SDK_PATH ***" |
| 48 | + FAILURE |
| 49 | + fi |
| 50 | +fi |
| 51 | + |
| 52 | +if test "${ENABLE_VST3}" = "true"; then |
| 53 | + # --- Because plugin client property "JUCE_VST3_CAN_REPLACE_VST2" is set to "Enabled, it makes have to link with VST legacy SDK." --- |
| 54 | + if test "${VST_LEGACY_SDK_PATH}" != ""; then |
| 55 | + "${PROJUCER_EXE}" --set-global-search-path osx vstLegacyPath "${VST_LEGACY_SDK_PATH}" |
| 56 | + else |
| 57 | + echo "*** Please set a value to the variable VST_LEGACY_SDK_PATH ***" |
| 58 | + FAILURE |
| 59 | + fi |
| 60 | + |
| 61 | + if test "${VST3_SDK_PATH}" != ""; then |
| 62 | + "${PROJUCER_EXE}" --set-global-search-path osx vst3Path "${VST3_SDK_PATH}" |
| 63 | + else |
| 64 | + "${PROJUCER_EXE}" --set-global-search-path osx vst3Path "${SCRIPT_DIRECTORY}/../../Dependencies/JUCE/modules/juce_audio_processors/format_types/VST3_SDK" |
| 65 | + fi |
| 66 | +fi |
| 67 | + |
| 68 | +if test "${ENABLE_AAX}" = "true"; then |
| 69 | + if test "${AAX_SDK_PATH}" != ""; then |
| 70 | + "${PROJUCER_EXE}" --set-global-search-path osx aaxPath "${AAX_SDK_PATH}" |
| 71 | + else |
| 72 | + echo "*** Please set a value to the variable AAX_SDK_PATH ***" |
| 73 | + FAILURE |
| 74 | + fi |
| 75 | +fi |
| 76 | + |
| 77 | +echo '--- Generate IDE project file by Projucer ---' |
| 78 | +"${PROJUCER_EXE}" --resave "${SCRIPT_DIRECTORY}/../${PROJECT_NAME}.jucer" |
| 79 | + |
| 80 | +echo '--- Get solution file name from Projucer ---' |
| 81 | +SOLUTION_NAME=`${PROJUCER_EXE} --status ${SCRIPT_DIRECTORY}/../${PROJECT_NAME}.jucer | grep "Name:" | awk '{ print $2 }'` |
| 82 | + |
| 83 | +echo '--- Get project version number from Projucer ---' |
| 84 | +VERSION_NUMBER=`${PROJUCER_EXE} --get-version ${SCRIPT_DIRECTORY}/../${PROJECT_NAME}.jucer` |
| 85 | + |
| 86 | +echo '--- Show variables ---' |
| 87 | +echo 'SCRIPT_DIRECTORY: '${SCRIPT_DIRECTORY} |
| 88 | +echo 'PROJECT_NAME: '${PROJECT_NAME} |
| 89 | +echo 'VERSION_NUMBER:'${VERSION_NUMBER} |
| 90 | +echo 'ARCHITECTURE: '${ARCHITECTURE} |
| 91 | +echo 'BUILD_CONFIG: '${BUILD_CONFIG} |
| 92 | +echo 'SOLUTION_NAME: '${SOLUTION_NAME} |
| 93 | +echo 'EXPORTER_NAME: '${EXPORTER_NAME} |
| 94 | + |
| 95 | +echo '--- Show list of '${SOLUTION_NAME}'.xcodeproj ---' |
| 96 | +xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" -list |
| 97 | + |
| 98 | +echo '--- Show Xcode build settings ---' |
| 99 | +xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" \ |
| 100 | +-alltargets \ |
| 101 | +-configuration ${BUILD_CONFIG} \ |
| 102 | +-arch ${ARCHITECTURE} \ |
| 103 | +-showBuildSettings |
| 104 | + |
| 105 | +echo '--- Run Xcode build Standalone Plugin ---' |
| 106 | +xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" \ |
| 107 | +-target "${SOLUTION_NAME} - Standalone Plugin" \ |
| 108 | +-configuration ${BUILD_CONFIG} \ |
| 109 | +-arch ${ARCHITECTURE} |
| 110 | + |
| 111 | +if test "${CONCAT_VERSION_NUMBER}" = "true"; then |
| 112 | + echo '--- Rename to adding version number for Standalone Plugin --' |
| 113 | + SRC_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}" |
| 114 | + DEST_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}-${VERSION_NUMBER}" |
| 115 | + if test -e "${DEST_FILE}"; then |
| 116 | + rm -rf "${DEST_FILE}" |
| 117 | + fi |
| 118 | + if test -e "${SRC_FILE}"; then |
| 119 | + mv -f "${SRC_FILE}" "${DEST_FILE}" |
| 120 | + fi |
| 121 | +fi |
| 122 | + |
| 123 | +if test "${ENABLE_VST}" = "true"; then |
| 124 | + echo '--- Run Xcode build VST ---' |
| 125 | + xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" \ |
| 126 | + -target "${SOLUTION_NAME} - VST" \ |
| 127 | + -configuration ${BUILD_CONFIG} \ |
| 128 | + -arch ${ARCHITECTURE} |
| 129 | + |
| 130 | + if test "${CONCAT_VERSION_NUMBER}" = "true"; then |
| 131 | + echo '--- Rename to adding version number for VST file --' |
| 132 | + SRC_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}.vst" |
| 133 | + DEST_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}-${VERSION_NUMBER}.vst" |
| 134 | + if test -e "${DEST_FILE}"; then |
| 135 | + rm -rf "${DEST_FILE}" |
| 136 | + fi |
| 137 | + if test -e "${SRC_FILE}"; then |
| 138 | + mv -f "${SRC_FILE}" "${DEST_FILE}" |
| 139 | + fi |
| 140 | + fi |
| 141 | +fi |
| 142 | + |
| 143 | +if test "${ENABLE_VST3}" = "true"; then |
| 144 | + echo '--- Run Xcode build VST3 ---' |
| 145 | + xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" \ |
| 146 | + -target "${SOLUTION_NAME} - VST3" \ |
| 147 | + -configuration ${BUILD_CONFIG} \ |
| 148 | + -arch ${ARCHITECTURE} |
| 149 | + |
| 150 | + if test "${CONCAT_VERSION_NUMBER}" = "true"; then |
| 151 | + echo '--- Rename to adding version number for VST3 file --' |
| 152 | + SRC_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}.vst3" |
| 153 | + DEST_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}-${VERSION_NUMBER}.vst3" |
| 154 | + if test -e "${DEST_FILE}"; then |
| 155 | + rm -rf "${DEST_FILE}" |
| 156 | + fi |
| 157 | + if test -e "${SRC_FILE}"; then |
| 158 | + mv -f "${SRC_FILE}" "${DEST_FILE}" |
| 159 | + fi |
| 160 | + fi |
| 161 | +fi |
| 162 | + |
| 163 | +if test "${ENABLE_AAX}" = "true"; then |
| 164 | + echo '--- Run Xcode build AAX ---' |
| 165 | + xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" \ |
| 166 | + -target "${SOLUTION_NAME} - AAX" \ |
| 167 | + -configuration ${BUILD_CONFIG} \ |
| 168 | + -arch ${ARCHITECTURE} |
| 169 | + |
| 170 | + if test "${CONCAT_VERSION_NUMBER}" = "true"; then |
| 171 | + echo '--- Rename to adding version number for AAX file --' |
| 172 | + SRC_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}.aaxplugin" |
| 173 | + DEST_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}-${VERSION_NUMBER}.aaxplugin" |
| 174 | + if test -e "${DEST_FILE}"; then |
| 175 | + rm -rf "${DEST_FILE}" |
| 176 | + fi |
| 177 | + if test -e "${SRC_FILE}"; then |
| 178 | + mv -f "${SRC_FILE}" "${DEST_FILE}" |
| 179 | + fi |
| 180 | + fi |
| 181 | +fi |
| 182 | + |
| 183 | +if test "${ENABLE_AU}" = "true"; then |
| 184 | + echo '--- Run Xcode build AU ---' |
| 185 | + xcodebuild -project "${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/${SOLUTION_NAME}.xcodeproj" \ |
| 186 | + -target "${SOLUTION_NAME} - AU" \ |
| 187 | + -configuration ${BUILD_CONFIG} \ |
| 188 | + -arch ${ARCHITECTURE} |
| 189 | + |
| 190 | + if test "${CONCAT_VERSION_NUMBER}" = "true"; then |
| 191 | + echo '--- Rename to adding version number for AU file --' |
| 192 | + SRC_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}.component" |
| 193 | + DEST_FILE="${SCRIPT_DIRECTORY}/../Builds/${EXPORTER_NAME}/build/${BUILD_CONFIG}/${SOLUTION_NAME}-${VERSION_NUMBER}.component" |
| 194 | + if test -e "${DEST_FILE}"; then |
| 195 | + rm -rf "${DEST_FILE}" |
| 196 | + fi |
| 197 | + if test -e "${SRC_FILE}"; then |
| 198 | + mv -f "${SRC_FILE}" "${DEST_FILE}" |
| 199 | + fi |
| 200 | + fi |
| 201 | +fi |
0 commit comments