f@0: #! /bin/sh f@0: f@0: #shell script to automate IPlug Project build, code-signing and packaging on OSX f@0: f@0: BASEDIR=$(dirname $0) f@0: cd $BASEDIR f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #variables f@0: f@0: VERSION=`echo | grep PLUG_VER resource.h` f@0: VERSION=${VERSION//\#define PLUG_VER } f@0: VERSION=${VERSION//\'} f@0: MAJOR_VERSION=$(($VERSION & 0xFFFF0000)) f@0: MAJOR_VERSION=$(($MAJOR_VERSION >> 16)) f@0: MINOR_VERSION=$(($VERSION & 0x0000FF00)) f@0: MINOR_VERSION=$(($MINOR_VERSION >> 8)) f@0: BUG_FIX=$(($VERSION & 0x000000FF)) f@0: f@0: FULL_VERSION=$MAJOR_VERSION"."$MINOR_VERSION"."$BUG_FIX f@0: f@0: PLUGIN_NAME=`echo | grep BUNDLE_NAME resource.h` f@0: PLUGIN_NAME=${PLUGIN_NAME//\#define BUNDLE_NAME } f@0: PLUGIN_NAME=${PLUGIN_NAME//\"} f@0: f@0: # work out the paths to the binaries f@0: f@0: VST2=`echo | grep VST_FOLDER ../../common.xcconfig` f@0: VST2=${VST2//\VST_FOLDER = }/$PLUGIN_NAME.vst f@0: f@0: VST3=`echo | grep VST3_FOLDER ../../common.xcconfig` f@0: VST3=${VST3//\VST3_FOLDER = }/$PLUGIN_NAME.vst3 f@0: f@0: AU=`echo | grep AU_FOLDER ../../common.xcconfig` f@0: AU=${AU//\AU_FOLDER = }/$PLUGIN_NAME.component f@0: f@0: APP=`echo | grep APP_FOLDER ../../common.xcconfig` f@0: APP=${APP//\APP_FOLDER = }/$PLUGIN_NAME.app f@0: f@0: # Dev build folder f@0: RTAS=`echo | grep RTAS_FOLDER ../../common.xcconfig` f@0: RTAS=${RTAS//\RTAS_FOLDER = }/$PLUGIN_NAME.dpm f@0: RTAS_FINAL="/Library/Application Support/Digidesign/Plug-Ins/$PLUGIN_NAME.dpm" f@0: f@0: # Dev build folder f@0: AAX=`echo | grep AAX_FOLDER ../../common.xcconfig` f@0: AAX=${AAX//\AAX_FOLDER = }/$PLUGIN_NAME.aaxplugin f@0: AAX_FINAL="/Library/Application Support/Avid/Audio/Plug-Ins/$PLUGIN_NAME.aaxplugin" f@0: f@0: PKG="installer/build-mac/$PLUGIN_NAME Installer.pkg" f@0: PKG_US="installer/build-mac/$PLUGIN_NAME Installer.unsigned.pkg" f@0: f@0: CERT_ID=`echo | grep CERTIFICATE_ID ../../common.xcconfig` f@0: CERT_ID=${CERT_ID//\CERTIFICATE_ID = } f@0: f@0: echo "making $PLUGIN_NAME version $FULL_VERSION mac distribution..." f@0: echo "" f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #call python script to update version numbers f@0: ./update_version.py f@0: f@0: #here you can use the touch command to force xcode to rebuild f@0: #touch MyPlugin.h f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #if you are zipping the binaries, remove existing dist folder f@0: #if [ -d installer/dist ] f@0: #then f@0: # rm -R installer/dist f@0: #fi f@0: f@0: #mkdir installer/dist f@0: f@0: #remove existing binaries f@0: if [ -d $APP ] f@0: then f@0: sudo rm -f -R -f $APP f@0: fi f@0: f@0: if [ -d $AU ] f@0: then f@0: sudo rm -f -R $AU f@0: fi f@0: f@0: if [ -d $VST2 ] f@0: then f@0: sudo rm -f -R $VST2 f@0: fi f@0: f@0: if [ -d $VST3 ] f@0: then f@0: sudo rm -f -R $VST3 f@0: fi f@0: f@0: if [ -d "${RTAS}" ] f@0: then f@0: sudo rm -f -R "${RTAS}" f@0: fi f@0: f@0: if [ -d "${RTAS_FINAL}" ] f@0: then f@0: sudo rm -f -R "${RTAS_FINAL}" f@0: fi f@0: f@0: if [ -d "${AAX}" ] f@0: then f@0: sudo rm -f -R "${AAX}" f@0: fi f@0: f@0: if [ -d "${AAX_FINAL}" ] f@0: then f@0: sudo rm -f -R "${AAX_FINAL}" f@0: fi f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: # build xcode project. Change target to build individual formats f@0: xcodebuild -project $PLUGIN_NAME.xcodeproj -xcconfig $PLUGIN_NAME.xcconfig -target "All" -configuration Release 2> ./build-mac.log f@0: f@0: if [ -s build-mac.log ] f@0: then f@0: echo "build failed due to following errors:" f@0: echo "" f@0: cat build-mac.log f@0: exit 1 f@0: else f@0: rm build-mac.log f@0: fi f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #icon stuff - http://maxao.free.fr/telechargements/setfileicon.gz f@0: echo "setting icons" f@0: echo "" f@0: setfileicon resources/$PLUGIN_NAME.icns $AU f@0: setfileicon resources/$PLUGIN_NAME.icns $VST2 f@0: setfileicon resources/$PLUGIN_NAME.icns $VST3 f@0: setfileicon resources/$PLUGIN_NAME.icns "${RTAS}" f@0: setfileicon resources/$PLUGIN_NAME.icns "${AAX}" f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #strip debug symbols from binaries f@0: f@0: echo "striping binaries" f@0: strip -x $AU/Contents/MacOS/$PLUGIN_NAME f@0: strip -x $VST2/Contents/MacOS/$PLUGIN_NAME f@0: strip -x $VST3/Contents/MacOS/$PLUGIN_NAME f@0: strip -x $APP/Contents/MacOS/$PLUGIN_NAME f@0: strip -x "${AAX}/Contents/MacOS/$PLUGIN_NAME" f@0: strip -x "${RTAS}/Contents/MacOS/$PLUGIN_NAME" f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #ProTools stuff f@0: f@0: echo "copying RTAS PLUGIN_NAME from 3PDev to main RTAS folder" f@0: sudo cp -p -R "${RTAS}" "${RTAS_FINAL}" f@0: f@0: echo "copying AAX PLUGIN_NAME from 3PDev to main AAX folder" f@0: sudo cp -p -R "${AAX}" "${AAX_FINAL}" f@0: f@0: echo "code sign AAX binary" f@0: #... consult PACE documentation f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #Mac AppStore stuff f@0: f@0: #xcodebuild -project $PLUGIN_NAME.xcodeproj -xcconfig $PLUGIN_NAME.xcconfig -target "APP" -configuration Release 2> ./build-mac.log f@0: f@0: #echo "code signing app for appstore" f@0: #echo "" f@0: #codesign -f -s "3rd Party Mac Developer Application: ""${CERT_ID}" $APP --entitlements resources/$PLUGIN_NAME.entitlements f@0: f@0: #echo "building pkg for app store" f@0: #echo "" f@0: #productbuild \ f@0: # --component $APP /Applications \ f@0: # --sign "3rd Party Mac Developer Installer: ""${CERT_ID}" \ f@0: # --product "/Applications/$PLUGIN_NAME.app/Contents/Info.plist" installer/$PLUGIN_NAME.pkg f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: #10.8 Gatekeeper/Developer ID stuff f@0: f@0: echo "code app binary for Gatekeeper on 10.8" f@0: echo "" f@0: codesign -f -s "Developer ID Application: ""${CERT_ID}" $APP f@0: f@0: #TODO: code-sign plug-in binaries too? f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: # installer, uses Packages http://s.sudre.free.fr/Software/Packages/about.html f@0: sudo sudo rm -R -f installer/$PLUGIN_NAME-mac.dmg f@0: f@0: echo "building installer" f@0: echo "" f@0: packagesbuild installer/$PLUGIN_NAME.pkgproj f@0: f@0: echo "code-sign installer for Gatekeeper on 10.8" f@0: echo "" f@0: mv "${PKG}" "${PKG_US}" f@0: productsign --sign "Developer ID Installer: ""${CERT_ID}" "${PKG_US}" "${PKG}" f@0: f@0: rm -R -f "${PKG_US}" f@0: f@0: #set installer icon f@0: setfileicon resources/$PLUGIN_NAME.icns "${PKG}" f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: # dmg, can use dmgcanvas http://www.araelium.com/dmgcanvas/ to make a nice dmg f@0: f@0: echo "building dmg" f@0: echo "" f@0: f@0: if [ -d installer/$PLUGIN_NAME.dmgCanvas ] f@0: then f@0: dmgcanvas installer/$PLUGIN_NAME.dmgCanvas installer/$PLUGIN_NAME-mac.dmg f@0: else f@0: hdiutil create installer/$PLUGIN_NAME.dmg -srcfolder installer/build-mac/ -ov -anyowners -volname $PLUGIN_NAME f@0: f@0: if [ -f installer/$PLUGIN_NAME-mac.dmg ] f@0: then f@0: rm -f installer/$PLUGIN_NAME-mac.dmg f@0: fi f@0: f@0: hdiutil convert installer/$PLUGIN_NAME.dmg -format UDZO -o installer/$PLUGIN_NAME-mac.dmg f@0: sudo rm -R -f installer/$PLUGIN_NAME.dmg f@0: fi f@0: f@0: sudo rm -R -f installer/build-mac/ f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: # zip f@0: f@0: # echo "copying binaries..." f@0: # echo "" f@0: # cp -R $AU installer/dist/$PLUGIN_NAME.component f@0: # cp -R $VST2 installer/dist/$PLUGIN_NAME.vst f@0: # cp -R $VST3 installer/dist/$PLUGIN_NAME.vst3 f@0: # cp -R $RTAS installer/dist/$PLUGIN_NAME.dpm f@0: # cp -R $AAX installer/dist/$PLUGIN_NAME.aaxplugin f@0: # cp -R $APP installer/dist/$PLUGIN_NAME.app f@0: # f@0: # echo "zipping binaries..." f@0: # echo "" f@0: # ditto -c -k installer/dist installer/$PLUGIN_NAME-mac.zip f@0: # rm -R installer/dist f@0: f@0: #--------------------------------------------------------------------------------------------------------- f@0: f@0: echo "done"