annotate makedist-mac.command @ 1:2ca5d7440b5c tip

added README
author Fiore Martin <f.martin@qmul.ac.uk>
date Fri, 26 Feb 2016 16:11:20 +0000
parents 3004dd663202
children
rev   line source
f@0 1 #! /bin/sh
f@0 2
f@0 3 #shell script to automate IPlug Project build, code-signing and packaging on OSX
f@0 4
f@0 5 BASEDIR=$(dirname $0)
f@0 6 cd $BASEDIR
f@0 7
f@0 8 #---------------------------------------------------------------------------------------------------------
f@0 9
f@0 10 #variables
f@0 11
f@0 12 VERSION=`echo | grep PLUG_VER resource.h`
f@0 13 VERSION=${VERSION//\#define PLUG_VER }
f@0 14 VERSION=${VERSION//\'}
f@0 15 MAJOR_VERSION=$(($VERSION & 0xFFFF0000))
f@0 16 MAJOR_VERSION=$(($MAJOR_VERSION >> 16))
f@0 17 MINOR_VERSION=$(($VERSION & 0x0000FF00))
f@0 18 MINOR_VERSION=$(($MINOR_VERSION >> 8))
f@0 19 BUG_FIX=$(($VERSION & 0x000000FF))
f@0 20
f@0 21 FULL_VERSION=$MAJOR_VERSION"."$MINOR_VERSION"."$BUG_FIX
f@0 22
f@0 23 PLUGIN_NAME=`echo | grep BUNDLE_NAME resource.h`
f@0 24 PLUGIN_NAME=${PLUGIN_NAME//\#define BUNDLE_NAME }
f@0 25 PLUGIN_NAME=${PLUGIN_NAME//\"}
f@0 26
f@0 27 # work out the paths to the binaries
f@0 28
f@0 29 VST2=`echo | grep VST_FOLDER ../../common.xcconfig`
f@0 30 VST2=${VST2//\VST_FOLDER = }/$PLUGIN_NAME.vst
f@0 31
f@0 32 VST3=`echo | grep VST3_FOLDER ../../common.xcconfig`
f@0 33 VST3=${VST3//\VST3_FOLDER = }/$PLUGIN_NAME.vst3
f@0 34
f@0 35 AU=`echo | grep AU_FOLDER ../../common.xcconfig`
f@0 36 AU=${AU//\AU_FOLDER = }/$PLUGIN_NAME.component
f@0 37
f@0 38 APP=`echo | grep APP_FOLDER ../../common.xcconfig`
f@0 39 APP=${APP//\APP_FOLDER = }/$PLUGIN_NAME.app
f@0 40
f@0 41 # Dev build folder
f@0 42 RTAS=`echo | grep RTAS_FOLDER ../../common.xcconfig`
f@0 43 RTAS=${RTAS//\RTAS_FOLDER = }/$PLUGIN_NAME.dpm
f@0 44 RTAS_FINAL="/Library/Application Support/Digidesign/Plug-Ins/$PLUGIN_NAME.dpm"
f@0 45
f@0 46 # Dev build folder
f@0 47 AAX=`echo | grep AAX_FOLDER ../../common.xcconfig`
f@0 48 AAX=${AAX//\AAX_FOLDER = }/$PLUGIN_NAME.aaxplugin
f@0 49 AAX_FINAL="/Library/Application Support/Avid/Audio/Plug-Ins/$PLUGIN_NAME.aaxplugin"
f@0 50
f@0 51 PKG="installer/build-mac/$PLUGIN_NAME Installer.pkg"
f@0 52 PKG_US="installer/build-mac/$PLUGIN_NAME Installer.unsigned.pkg"
f@0 53
f@0 54 CERT_ID=`echo | grep CERTIFICATE_ID ../../common.xcconfig`
f@0 55 CERT_ID=${CERT_ID//\CERTIFICATE_ID = }
f@0 56
f@0 57 echo "making $PLUGIN_NAME version $FULL_VERSION mac distribution..."
f@0 58 echo ""
f@0 59
f@0 60 #---------------------------------------------------------------------------------------------------------
f@0 61
f@0 62 #call python script to update version numbers
f@0 63 ./update_version.py
f@0 64
f@0 65 #here you can use the touch command to force xcode to rebuild
f@0 66 #touch MyPlugin.h
f@0 67
f@0 68 #---------------------------------------------------------------------------------------------------------
f@0 69
f@0 70 #if you are zipping the binaries, remove existing dist folder
f@0 71 #if [ -d installer/dist ]
f@0 72 #then
f@0 73 # rm -R installer/dist
f@0 74 #fi
f@0 75
f@0 76 #mkdir installer/dist
f@0 77
f@0 78 #remove existing binaries
f@0 79 if [ -d $APP ]
f@0 80 then
f@0 81 sudo rm -f -R -f $APP
f@0 82 fi
f@0 83
f@0 84 if [ -d $AU ]
f@0 85 then
f@0 86 sudo rm -f -R $AU
f@0 87 fi
f@0 88
f@0 89 if [ -d $VST2 ]
f@0 90 then
f@0 91 sudo rm -f -R $VST2
f@0 92 fi
f@0 93
f@0 94 if [ -d $VST3 ]
f@0 95 then
f@0 96 sudo rm -f -R $VST3
f@0 97 fi
f@0 98
f@0 99 if [ -d "${RTAS}" ]
f@0 100 then
f@0 101 sudo rm -f -R "${RTAS}"
f@0 102 fi
f@0 103
f@0 104 if [ -d "${RTAS_FINAL}" ]
f@0 105 then
f@0 106 sudo rm -f -R "${RTAS_FINAL}"
f@0 107 fi
f@0 108
f@0 109 if [ -d "${AAX}" ]
f@0 110 then
f@0 111 sudo rm -f -R "${AAX}"
f@0 112 fi
f@0 113
f@0 114 if [ -d "${AAX_FINAL}" ]
f@0 115 then
f@0 116 sudo rm -f -R "${AAX_FINAL}"
f@0 117 fi
f@0 118
f@0 119 #---------------------------------------------------------------------------------------------------------
f@0 120
f@0 121 # build xcode project. Change target to build individual formats
f@0 122 xcodebuild -project $PLUGIN_NAME.xcodeproj -xcconfig $PLUGIN_NAME.xcconfig -target "All" -configuration Release 2> ./build-mac.log
f@0 123
f@0 124 if [ -s build-mac.log ]
f@0 125 then
f@0 126 echo "build failed due to following errors:"
f@0 127 echo ""
f@0 128 cat build-mac.log
f@0 129 exit 1
f@0 130 else
f@0 131 rm build-mac.log
f@0 132 fi
f@0 133
f@0 134 #---------------------------------------------------------------------------------------------------------
f@0 135
f@0 136 #icon stuff - http://maxao.free.fr/telechargements/setfileicon.gz
f@0 137 echo "setting icons"
f@0 138 echo ""
f@0 139 setfileicon resources/$PLUGIN_NAME.icns $AU
f@0 140 setfileicon resources/$PLUGIN_NAME.icns $VST2
f@0 141 setfileicon resources/$PLUGIN_NAME.icns $VST3
f@0 142 setfileicon resources/$PLUGIN_NAME.icns "${RTAS}"
f@0 143 setfileicon resources/$PLUGIN_NAME.icns "${AAX}"
f@0 144
f@0 145 #---------------------------------------------------------------------------------------------------------
f@0 146
f@0 147 #strip debug symbols from binaries
f@0 148
f@0 149 echo "striping binaries"
f@0 150 strip -x $AU/Contents/MacOS/$PLUGIN_NAME
f@0 151 strip -x $VST2/Contents/MacOS/$PLUGIN_NAME
f@0 152 strip -x $VST3/Contents/MacOS/$PLUGIN_NAME
f@0 153 strip -x $APP/Contents/MacOS/$PLUGIN_NAME
f@0 154 strip -x "${AAX}/Contents/MacOS/$PLUGIN_NAME"
f@0 155 strip -x "${RTAS}/Contents/MacOS/$PLUGIN_NAME"
f@0 156
f@0 157 #---------------------------------------------------------------------------------------------------------
f@0 158
f@0 159 #ProTools stuff
f@0 160
f@0 161 echo "copying RTAS PLUGIN_NAME from 3PDev to main RTAS folder"
f@0 162 sudo cp -p -R "${RTAS}" "${RTAS_FINAL}"
f@0 163
f@0 164 echo "copying AAX PLUGIN_NAME from 3PDev to main AAX folder"
f@0 165 sudo cp -p -R "${AAX}" "${AAX_FINAL}"
f@0 166
f@0 167 echo "code sign AAX binary"
f@0 168 #... consult PACE documentation
f@0 169
f@0 170 #---------------------------------------------------------------------------------------------------------
f@0 171
f@0 172 #Mac AppStore stuff
f@0 173
f@0 174 #xcodebuild -project $PLUGIN_NAME.xcodeproj -xcconfig $PLUGIN_NAME.xcconfig -target "APP" -configuration Release 2> ./build-mac.log
f@0 175
f@0 176 #echo "code signing app for appstore"
f@0 177 #echo ""
f@0 178 #codesign -f -s "3rd Party Mac Developer Application: ""${CERT_ID}" $APP --entitlements resources/$PLUGIN_NAME.entitlements
f@0 179
f@0 180 #echo "building pkg for app store"
f@0 181 #echo ""
f@0 182 #productbuild \
f@0 183 # --component $APP /Applications \
f@0 184 # --sign "3rd Party Mac Developer Installer: ""${CERT_ID}" \
f@0 185 # --product "/Applications/$PLUGIN_NAME.app/Contents/Info.plist" installer/$PLUGIN_NAME.pkg
f@0 186
f@0 187 #---------------------------------------------------------------------------------------------------------
f@0 188
f@0 189 #10.8 Gatekeeper/Developer ID stuff
f@0 190
f@0 191 echo "code app binary for Gatekeeper on 10.8"
f@0 192 echo ""
f@0 193 codesign -f -s "Developer ID Application: ""${CERT_ID}" $APP
f@0 194
f@0 195 #TODO: code-sign plug-in binaries too?
f@0 196
f@0 197 #---------------------------------------------------------------------------------------------------------
f@0 198
f@0 199 # installer, uses Packages http://s.sudre.free.fr/Software/Packages/about.html
f@0 200 sudo sudo rm -R -f installer/$PLUGIN_NAME-mac.dmg
f@0 201
f@0 202 echo "building installer"
f@0 203 echo ""
f@0 204 packagesbuild installer/$PLUGIN_NAME.pkgproj
f@0 205
f@0 206 echo "code-sign installer for Gatekeeper on 10.8"
f@0 207 echo ""
f@0 208 mv "${PKG}" "${PKG_US}"
f@0 209 productsign --sign "Developer ID Installer: ""${CERT_ID}" "${PKG_US}" "${PKG}"
f@0 210
f@0 211 rm -R -f "${PKG_US}"
f@0 212
f@0 213 #set installer icon
f@0 214 setfileicon resources/$PLUGIN_NAME.icns "${PKG}"
f@0 215
f@0 216 #---------------------------------------------------------------------------------------------------------
f@0 217
f@0 218 # dmg, can use dmgcanvas http://www.araelium.com/dmgcanvas/ to make a nice dmg
f@0 219
f@0 220 echo "building dmg"
f@0 221 echo ""
f@0 222
f@0 223 if [ -d installer/$PLUGIN_NAME.dmgCanvas ]
f@0 224 then
f@0 225 dmgcanvas installer/$PLUGIN_NAME.dmgCanvas installer/$PLUGIN_NAME-mac.dmg
f@0 226 else
f@0 227 hdiutil create installer/$PLUGIN_NAME.dmg -srcfolder installer/build-mac/ -ov -anyowners -volname $PLUGIN_NAME
f@0 228
f@0 229 if [ -f installer/$PLUGIN_NAME-mac.dmg ]
f@0 230 then
f@0 231 rm -f installer/$PLUGIN_NAME-mac.dmg
f@0 232 fi
f@0 233
f@0 234 hdiutil convert installer/$PLUGIN_NAME.dmg -format UDZO -o installer/$PLUGIN_NAME-mac.dmg
f@0 235 sudo rm -R -f installer/$PLUGIN_NAME.dmg
f@0 236 fi
f@0 237
f@0 238 sudo rm -R -f installer/build-mac/
f@0 239
f@0 240 #---------------------------------------------------------------------------------------------------------
f@0 241 # zip
f@0 242
f@0 243 # echo "copying binaries..."
f@0 244 # echo ""
f@0 245 # cp -R $AU installer/dist/$PLUGIN_NAME.component
f@0 246 # cp -R $VST2 installer/dist/$PLUGIN_NAME.vst
f@0 247 # cp -R $VST3 installer/dist/$PLUGIN_NAME.vst3
f@0 248 # cp -R $RTAS installer/dist/$PLUGIN_NAME.dpm
f@0 249 # cp -R $AAX installer/dist/$PLUGIN_NAME.aaxplugin
f@0 250 # cp -R $APP installer/dist/$PLUGIN_NAME.app
f@0 251 #
f@0 252 # echo "zipping binaries..."
f@0 253 # echo ""
f@0 254 # ditto -c -k installer/dist installer/$PLUGIN_NAME-mac.zip
f@0 255 # rm -R installer/dist
f@0 256
f@0 257 #---------------------------------------------------------------------------------------------------------
f@0 258
f@0 259 echo "done"