3 #shell script to automate IPlug Project build, code-signing and packaging on OSX
8 #---------------------------------------------------------------------------------------------------------
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
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"
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..."
60 #---------------------------------------------------------------------------------------------------------
62 #call python script to update version numbers
65 #here you can use the touch command to force xcode to rebuild
68 #---------------------------------------------------------------------------------------------------------
70 #if you are zipping the binaries, remove existing dist folder
71 #if [ -d installer/dist ]
73 # rm -R installer/dist
78 #remove existing binaries
101 sudo
rm -f -R "${RTAS}"
104 if [ -d "${RTAS_FINAL}" ]
106 sudo
rm -f -R "${RTAS_FINAL}"
111 sudo
rm -f -R "${AAX}"
114 if [ -d "${AAX_FINAL}" ]
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
]
126 echo "build failed due to following errors:"
134 #---------------------------------------------------------------------------------------------------------
136 #icon stuff - http://maxao.free.fr/telechargements/setfileicon.gz
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 #---------------------------------------------------------------------------------------------------------
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 #---------------------------------------------------------------------------------------------------------
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"
178 #codesign -f -s "3rd Party Mac Developer Application: ""${CERT_ID}" $APP --entitlements resources/$PLUGIN_NAME.entitlements
180 #echo "building pkg for app store"
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"
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"
204 packagesbuild installer
/$PLUGIN_NAME.pkgproj
206 echo "code-sign installer for Gatekeeper on 10.8"
208 mv "${PKG}" "${PKG_US}"
209 productsign
--sign "Developer ID Installer: ""${CERT_ID}" "${PKG_US}" "${PKG}"
214 setfileicon resources
/$PLUGIN_NAME.icns
"${PKG}"
216 #---------------------------------------------------------------------------------------------------------
218 # dmg, can use dmgcanvas http://www.araelium.com/dmgcanvas/ to make a nice dmg
223 if [ -d installer
/$PLUGIN_NAME.dmgCanvas
]
225 dmgcanvas installer
/$PLUGIN_NAME.dmgCanvas installer
/$PLUGIN_NAME-mac.dmg
227 hdiutil create installer
/$PLUGIN_NAME.dmg
-srcfolder installer
/build-mac
/ -ov -anyowners -volname $PLUGIN_NAME
229 if [ -f installer
/$PLUGIN_NAME-mac.dmg
]
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 #---------------------------------------------------------------------------------------------------------
243 # echo "copying binaries..."
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..."
254 # ditto -c -k installer/dist installer/$PLUGIN_NAME-mac.zip
255 # rm -R installer/dist
257 #---------------------------------------------------------------------------------------------------------