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