ConvoEngine: Make max channel counts configurable.
[wdl/wdl-ol.git] / IPlugExamples / IPlugControls / makedist-mac.command
blobeb3df0b3098c6198e847bdc35c2551bace759e76
1 #! /bin/sh
3 #shell script to automate IPlug Project build, code-signing and packaging on OSX
5 BASEDIR=$(dirname $0)
6 cd $BASEDIR
8 #---------------------------------------------------------------------------------------------------------
10 #variables
12 VERSION=`echo | grep PLUG_VER resource.h`
13 VERSION=${VERSION//\#define PLUG_VER }
14 VERSION=${VERSION//\'}
15 MAJOR_VERSION=$(($VERSION & 0xFFFF0000))
16 MAJOR_VERSION=$(($MAJOR_VERSION >> 16))
17 MINOR_VERSION=$(($VERSION & 0x0000FF00))
18 MINOR_VERSION=$(($MINOR_VERSION >> 8))
19 BUG_FIX=$(($VERSION & 0x000000FF))
21 FULL_VERSION=$MAJOR_VERSION"."$MINOR_VERSION"."$BUG_FIX
23 PLUGIN_NAME=`echo | grep BUNDLE_NAME resource.h`
24 PLUGIN_NAME=${PLUGIN_NAME//\#define BUNDLE_NAME }
25 PLUGIN_NAME=${PLUGIN_NAME//\"}
27 # work out the paths to the binaries
29 VST2=`echo | grep VST_FOLDER ../../common.xcconfig`
30 VST2=${VST2//\VST_FOLDER = }/$PLUGIN_NAME.vst
32 VST3=`echo | grep VST3_FOLDER ../../common.xcconfig`
33 VST3=${VST3//\VST3_FOLDER = }/$PLUGIN_NAME.vst3
35 AU=`echo | grep AU_FOLDER ../../common.xcconfig`
36 AU=${AU//\AU_FOLDER = }/$PLUGIN_NAME.component
38 APP=`echo | grep APP_FOLDER ../../common.xcconfig`
39 APP=${APP//\APP_FOLDER = }/$PLUGIN_NAME.app
41 # Dev build folder
42 RTAS=`echo | grep RTAS_FOLDER ../../common.xcconfig`
43 RTAS=${RTAS//\RTAS_FOLDER = }/$PLUGIN_NAME.dpm
44 RTAS_FINAL="/Library/Application Support/Digidesign/Plug-Ins/$PLUGIN_NAME.dpm"
46 # Dev build folder
47 AAX=`echo | grep AAX_FOLDER ../../common.xcconfig`
48 AAX=${AAX//\AAX_FOLDER = }/$PLUGIN_NAME.aaxplugin
49 AAX_FINAL="/Library/Application Support/Avid/Audio/Plug-Ins/$PLUGIN_NAME.aaxplugin"
51 PKG="installer/build-mac/$PLUGIN_NAME Installer.pkg"
52 PKG_US="installer/build-mac/$PLUGIN_NAME Installer.unsigned.pkg"
54 CERT_ID=`echo | grep CERTIFICATE_ID ../../common.xcconfig`
55 CERT_ID=${CERT_ID//\CERTIFICATE_ID = }
57 echo "making $PLUGIN_NAME version $FULL_VERSION mac distribution..."
58 echo ""
60 #---------------------------------------------------------------------------------------------------------
62 #call python script to update version numbers
63 ./update_version.py
65 #here you can use the touch command to force xcode to rebuild
66 #touch MyPlugin.h
68 #---------------------------------------------------------------------------------------------------------
70 #if you are zipping the binaries, remove existing dist folder
71 #if [ -d installer/dist ]
72 #then
73 # rm -R installer/dist
74 #fi
76 #mkdir installer/dist
78 #remove existing binaries
79 if [ -d $APP ]
80 then
81 sudo rm -f -R -f $APP
84 if [ -d $AU ]
85 then
86 sudo rm -f -R $AU
89 if [ -d $VST2 ]
90 then
91 sudo rm -f -R $VST2
94 if [ -d $VST3 ]
95 then
96 sudo rm -f -R $VST3
99 if [ -d "${RTAS}" ]
100 then
101 sudo rm -f -R "${RTAS}"
104 if [ -d "${RTAS_FINAL}" ]
105 then
106 sudo rm -f -R "${RTAS_FINAL}"
109 if [ -d "${AAX}" ]
110 then
111 sudo rm -f -R "${AAX}"
114 if [ -d "${AAX_FINAL}" ]
115 then
116 sudo rm -f -R "${AAX_FINAL}"
119 #---------------------------------------------------------------------------------------------------------
121 # build xcode project. Change target to build individual formats
122 xcodebuild -project $PLUGIN_NAME.xcodeproj -xcconfig $PLUGIN_NAME.xcconfig -target "All" -configuration Release 2> ./build-mac.log
124 if [ -s build-mac.log ]
125 then
126 echo "build failed due to following errors:"
127 echo ""
128 cat build-mac.log
129 exit 1
130 else
131 rm build-mac.log
134 #---------------------------------------------------------------------------------------------------------
136 #icon stuff - http://maxao.free.fr/telechargements/setfileicon.gz
137 echo "setting icons"
138 echo ""
139 setfileicon resources/$PLUGIN_NAME.icns $AU
140 setfileicon resources/$PLUGIN_NAME.icns $VST2
141 setfileicon resources/$PLUGIN_NAME.icns $VST3
142 setfileicon resources/$PLUGIN_NAME.icns "${RTAS}"
143 setfileicon resources/$PLUGIN_NAME.icns "${AAX}"
145 #---------------------------------------------------------------------------------------------------------
147 #strip debug symbols from binaries
149 echo "striping binaries"
150 strip -x $AU/Contents/MacOS/$PLUGIN_NAME
151 strip -x $VST2/Contents/MacOS/$PLUGIN_NAME
152 strip -x $VST3/Contents/MacOS/$PLUGIN_NAME
153 strip -x $APP/Contents/MacOS/$PLUGIN_NAME
154 strip -x "${AAX}/Contents/MacOS/$PLUGIN_NAME"
155 strip -x "${RTAS}/Contents/MacOS/$PLUGIN_NAME"
157 #---------------------------------------------------------------------------------------------------------
159 #ProTools stuff
161 echo "copying RTAS PLUGIN_NAME from 3PDev to main RTAS folder"
162 sudo cp -p -R "${RTAS}" "${RTAS_FINAL}"
164 echo "copying AAX PLUGIN_NAME from 3PDev to main AAX folder"
165 sudo cp -p -R "${AAX}" "${AAX_FINAL}"
167 echo "code sign AAX binary"
168 #... consult PACE documentation
170 #---------------------------------------------------------------------------------------------------------
172 #Mac AppStore stuff
174 #xcodebuild -project $PLUGIN_NAME.xcodeproj -xcconfig $PLUGIN_NAME.xcconfig -target "APP" -configuration Release 2> ./build-mac.log
176 #echo "code signing app for appstore"
177 #echo ""
178 #codesign -f -s "3rd Party Mac Developer Application: ""${CERT_ID}" $APP --entitlements resources/$PLUGIN_NAME.entitlements
180 #echo "building pkg for app store"
181 #echo ""
182 #productbuild \
183 # --component $APP /Applications \
184 # --sign "3rd Party Mac Developer Installer: ""${CERT_ID}" \
185 # --product "/Applications/$PLUGIN_NAME.app/Contents/Info.plist" installer/$PLUGIN_NAME.pkg
187 #---------------------------------------------------------------------------------------------------------
189 #10.8 Gatekeeper/Developer ID stuff
191 echo "code app binary for Gatekeeper on 10.8"
192 echo ""
193 codesign -f -s "Developer ID Application: ""${CERT_ID}" $APP
195 #TODO: code-sign plug-in binaries too?
197 #---------------------------------------------------------------------------------------------------------
199 # installer, uses Packages http://s.sudre.free.fr/Software/Packages/about.html
200 sudo sudo rm -R -f installer/$PLUGIN_NAME-mac.dmg
202 echo "building installer"
203 echo ""
204 packagesbuild installer/$PLUGIN_NAME.pkgproj
206 echo "code-sign installer for Gatekeeper on 10.8"
207 echo ""
208 mv "${PKG}" "${PKG_US}"
209 productsign --sign "Developer ID Installer: ""${CERT_ID}" "${PKG_US}" "${PKG}"
211 rm -R -f "${PKG_US}"
213 #set installer icon
214 setfileicon resources/$PLUGIN_NAME.icns "${PKG}"
216 #---------------------------------------------------------------------------------------------------------
218 # dmg, can use dmgcanvas http://www.araelium.com/dmgcanvas/ to make a nice dmg
220 echo "building dmg"
221 echo ""
223 if [ -d installer/$PLUGIN_NAME.dmgCanvas ]
224 then
225 dmgcanvas installer/$PLUGIN_NAME.dmgCanvas installer/$PLUGIN_NAME-mac.dmg
226 else
227 hdiutil create installer/$PLUGIN_NAME.dmg -srcfolder installer/build-mac/ -ov -anyowners -volname $PLUGIN_NAME
229 if [ -f installer/$PLUGIN_NAME-mac.dmg ]
230 then
231 rm -f installer/$PLUGIN_NAME-mac.dmg
234 hdiutil convert installer/$PLUGIN_NAME.dmg -format UDZO -o installer/$PLUGIN_NAME-mac.dmg
235 sudo rm -R -f installer/$PLUGIN_NAME.dmg
238 sudo rm -R -f installer/build-mac/
240 #---------------------------------------------------------------------------------------------------------
241 # zip
243 # echo "copying binaries..."
244 # echo ""
245 # cp -R $AU installer/dist/$PLUGIN_NAME.component
246 # cp -R $VST2 installer/dist/$PLUGIN_NAME.vst
247 # cp -R $VST3 installer/dist/$PLUGIN_NAME.vst3
248 # cp -R $RTAS installer/dist/$PLUGIN_NAME.dpm
249 # cp -R $AAX installer/dist/$PLUGIN_NAME.aaxplugin
250 # cp -R $APP installer/dist/$PLUGIN_NAME.app
252 # echo "zipping binaries..."
253 # echo ""
254 # ditto -c -k installer/dist installer/$PLUGIN_NAME-mac.zip
255 # rm -R installer/dist
257 #---------------------------------------------------------------------------------------------------------
259 echo "done"