3 # script for pulling together a MacOSX app bundle.
5 GTKQUARTZ_ROOT=$HOME/gtk/inst
17 while [ $# -gt 0 ] ; do
22 # top level build targets
25 --sae) WITH_NLS= ; SAE=1 ; INTERNAL_JACK=1; WITH_LADSPA=1; STRIP= ; EXTRA_PACKAGING_DIR=1 ; shift ;;
26 --mixbus) MIXBUS=1; WITH_NLS= ; SAE= ; INTERNAL_JACK=; WITH_LADSPA=; STRIP= ; EXTRA_PACKAGING_DIR=1; EXTERNAL_JACK=/usr/local/Jack.dmg; shift ;;
27 --public) WITH_NLS= ; SAE= ; INTERNAL_JACK=; WITH_LADSPA=1; STRIP= ; shift ;;
28 --allinone) SAE= ; WITH_NLS= ; INTERNAL_JACK=1; WITH_LADSPA=1; STRIP= ; shift ;;
29 --test) SAE= ; INTERNAL_JACK=; WITH_LADSPA=; STRIP= ; shift ;;
32 # specific build flags
35 --nojack) INTERNAL_JACK= ; shift ;;
36 --noladspa) WITH_LADSPA= ; shift ;;
37 --nostrip) STRIP= ; shift ;;
38 --sysdeps) PRINT_SYSDEPS=1; shift ;;
39 --nls) WITH_NLS=1 ; shift ;;
40 --pdir) EXTRA_PACKAGING_DIR=1; shift ;;
41 --external_jack) EXTERNAL_JACK=$2; shift ; shift ;;
45 if [ x$EXTERNAL_JACK != x -a x$INTERNAL_JACK != x ] ; then
46 echo "It makes no sense to package JACK internally and externally. Please pick one."
49 release_version=`grep -m 1 '^ardour_version' ../../SConstruct | cut -d' ' -f 3 | sed "s/'//g"`
50 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d' ' -f 6 | sed 's/[";]//g'`
51 echo "Version is $release_version / $svn_version"
52 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
53 echo "Info string is $info_string"
55 # setup directory structure
57 if [ x$MIXBUS != x ] ; then
64 APPROOT=$APPDIR/Contents
65 Frameworks=$APPROOT/Frameworks
66 Resources=$APPROOT/Resources
67 Plugins=$APPROOT/Plugins
68 Surfaces=$APPROOT/Surfaces
69 Shared=$Resources/share
71 Locale=$Resources/locale
76 if [ x$PRINT_SYSDEPS != x ] ; then
78 # print system dependencies
81 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
82 if ! file $file | grep -qs Mach-O ; then
85 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
90 echo "Removing old $APPDIR tree ..."
94 echo "Building new app directory structure ..."
96 # only bother to make the longest paths
98 mkdir -p $APPROOT/MacOS
99 mkdir -p $APPROOT/Resources
100 mkdir -p $APPROOT/Plugins
101 mkdir -p $APPROOT/Surfaces
102 mkdir -p $Frameworks/modules
103 mkdir -p $Shared/templates
106 # maybe set variables
108 if test x$SAE != x ; then
109 appname="Ardour2/SAE"
110 env="$env<key>ARDOUR_SAE</key><string>true</string>"
112 # current default for SAE version is German keyboard layout without a keypad
114 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de-nokeypad</string>"
115 env="$env<key>ARDOUR_UI_CONF</key><string>ardour2_ui_sae.conf</string>"
116 env="$env<key>ARDOUR2_UI_RC</key><string>ardour2_ui_dark_sae.rc</string>"
117 elif test x$MIXBUS != x ; then
118 appname="Ardour2/Mixbus"
119 env="$env<key>ARDOUR_MIXBUS</key><string>true</string>"
121 # current default for MIXBUS version is US keyboard layout without a keypad
123 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>us-nokeypad</string>"
124 env="$env<key>ARDOUR_UI_CONF</key><string>ardour2_ui.conf</string>"
125 env="$env<key>ARDOUR2_UI_RC</key><string>ardour2_ui_dark.rc</string>"
131 # if we're not going to bundle JACK, make sure we can find
132 # jack in the places where it might be
135 if test x$INTERNAL_JACK != x ; then
136 env="$env<key>ARDOUR_INTERNAL_JACK</key><string>true</string>"
138 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin</string>"
139 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
142 env="<key>LSEnvironment</key><dict><key>ARDOUR_BUNDLED</key><string>true</string>$env</dict>"
145 sed -e "s?@ENV@?$env?g" \
146 -e "s?@VERSION@?$release_version/$svn_version?g" \
147 -e "s?@INFOSTRING@?$info_string?g" < Info.plist.in > Info.plist
149 sed -e "s?@APPNAME@?$appname?" \
150 -e "s?@ENV@?$env?g" \
151 -e "s?@VERSION@?$release_version/$svn_version?g" \
152 -e "s?@INFOSTRING@?$info_string?g" < InfoPlist.strings.in > Resources/InfoPlist.strings
156 cp Info.plist $APPROOT
157 cp -R Resources $APPROOT
160 # if we build a bundle without jack, then
161 # make the Ardour2 executable a helper
162 # script that checks to see if JACK is
166 if test x$INTERNAL_JACK != x ; then
167 MAIN_EXECUTABLE=Ardour2
169 cp startup_script $APPROOT/MacOS/Ardour2
170 chmod 775 $APPROOT/MacOS/Ardour2
171 MAIN_EXECUTABLE=Ardour2.bin
174 echo "Copying ardour executable ...."
175 cp ../../gtk2_ardour/ardour-$release_version $APPROOT/MacOS/$MAIN_EXECUTABLE
176 if test x$SAE != x ; then
177 # cp ../../gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
178 cp Ardour2-SAE.icns $Resources/appIcon.icns
179 elif test x$MIXBUS != x ; then
180 cp Mixbus.icns $Resources/appIcon.icns
182 cp Ardour2.icns $Resources/appIcon.icns
184 if test x$STRIP != x ; then
185 strip $APPROOT/MacOS/Ardour2
187 if test x$INTERNAL_JACK != x ; then
188 if [ -f /usr/local/lib/jack/jack_coreaudio.so ] ; then
189 cp /usr/local/lib/jack/jack_coreaudio.so $Frameworks
190 cp /usr/local/bin/jackd $APPROOT/MacOS
191 JACK_SHARED_OBJECTS="$Frameworks/*.so"
196 if test x$WITH_NLS != x ; then
197 echo "NLS support ..."
198 for file in ../../gtk2_ardour/*.mo
200 lang=`basename $file | sed 's/\.mo//'`
201 mkdir -p $Locale/$lang/LC_MESSAGES
202 cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo
205 echo "Skipping NLS support"
208 cp -R $GTKQUARTZ_ROOT/etc/* $Etc
209 echo "Copying all Pango modules ..."
210 cp -R $GTKQUARTZ_ROOT/lib/pango/1.6.0/modules/*.so $Frameworks/modules
211 echo "Copying all GDK Pixbuf loaders ..."
212 cp -R $GTKQUARTZ_ROOT/lib/gtk-2.0/2.10.0/loaders/*.so $Frameworks/modules
214 cp -R $GTKQUARTZ_ROOT/lib/charset.alias $Resources
218 if test x$WITH_LADSPA != x ; then
219 if test x$SAE != x ; then
221 elif test x$MIXBUS != x ; then
222 plugdir=mixbus_ladspa
226 echo "Copying `ls $plugdir | wc -l` plugins ..."
227 cp -r $plugdir/* $Plugins
230 # generate new Pango module file
233 ModulesPath=$GTKQUARTZ_ROOT/lib/pango/1.6.0/modules
235 env PANGO_RC_FILE=pangorc $GTKQUARTZ_ROOT/bin/pango-querymodules | sed "s?$GTKQUARTZ_ROOT/lib/pango/1.6.0/modules/?@executable_path/../Frameworks/modules/?" > $Resources/pango.modules
238 # generate a new GDK pixbufs loaders file
239 sed "s?$GTKQUARTZ_ROOT/lib/gtk-2.0/2.10.0/loaders/?@executable_path/../Frameworks/modules/?" < $GTKQUARTZ_ROOT/etc/gtk-2.0/gdk-pixbuf.loaders > $Resources/gdk-pixbuf.loaders
241 # this one is special - we will set GTK_PATH to $Frameworks/clearlooks
242 cp ../../libs/clearlooks-newer/libclearlooks.dylib $Frameworks
243 mkdir -p $Frameworks/clearlooks/engines
244 (cd $Frameworks/clearlooks/engines && ln -s ../../libclearlooks.dylib libclearlooks.dylib && ln -s ../../libclearlooks.dylib libclearlooks.so)
246 # XXX STILL NEED TO DO PANNERS FOR TRUNK
247 cp ../../libs/surfaces/*/libardour_*.dylib $Surfaces
248 # hack ... move libardour_cp back into Frameworks
249 mv $Surfaces/libardour_cp.dylib $Frameworks
251 # VAMP plugins that we use
252 cp ../../libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
256 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
257 if ! file $file | grep -qs Mach-O ; then
260 if test x$INTERNAL_JACK != x ; then
261 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)"`
263 # do not include libjack
264 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | grep -v 'libjack\.'`
267 for dep in $deps ; do
269 if ! test -f $Frameworks/$base; then
270 if echo $dep | grep -sq '^libs' ; then
271 cp ../../$dep $Frameworks
279 if test x$missing = xfalse ; then
280 # everything has been found
286 echo "Copying other stuff to $APPDIR ..."
288 cp ../../gtk2_ardour/ergonomic-us.bindings $Resources
289 cp ../../gtk2_ardour/mnemonic-us.bindings $Resources
290 cp ../../gtk2_ardour/SAE-de-keypad.bindings $Resources
291 cp ../../gtk2_ardour/SAE-de-nokeypad.bindings $Resources
292 cp ../../gtk2_ardour/SAE-us-keypad.bindings $Resources
293 cp ../../gtk2_ardour/SAE-us-nokeypad.bindings $Resources
294 cp ../../gtk2_ardour/ardour.menus $Resources
295 cp ../../gtk2_ardour/ardour-sae.menus $Resources
296 if test x$SAE != x ; then
297 cp ../../ardour_system_sae.rc $Resources/ardour_system.rc
298 echo cp ../../ardour_system_sae.rc $Resources/ardour_system.rc
299 cp ../../instant.xml.sae $Resources/instant.xml
300 echo cp ../../instant.xml.sae $Resources/instant.xml
302 # cp ../../ardour_system.rc $Resources/ardour_system.rc
303 # echo FOO cp ../../ardour_system.rc $Resources/ardour_system.rc
304 cp ../../instant.xml $Resources/instant.xml
305 echo cp ../../instant.xml $Resources/instant.xml
307 cp ../../gtk2_ardour/ardour2_ui_sae.conf $Resources
308 cp ../../gtk2_ardour/ardour2_ui_default.conf $Resources
309 cp ../../gtk2_ardour/ardour2_ui_light.rc $Resources
310 cp ../../gtk2_ardour/ardour2_ui_dark.rc $Resources
311 cp ../../gtk2_ardour/ardour2_ui_light_sae.rc $Resources
312 cp ../../gtk2_ardour/ardour2_ui_dark_sae.rc $Resources
314 cp -r ../../gtk2_ardour/icons $Resources
315 cp -r ../../gtk2_ardour/pixmaps $Resources
318 # put sooper sekrit ingredients here and they will be copied
321 if [ -d specialSauce ] ; then
322 cp -r specialSauce $Resources
327 cp -R ../../gtk2_ardour/splash.png $Shared
328 cp ../../templates/*.template $Shared/templates/
330 # go through and recursively remove any .svn dirs in the bundle
331 for svndir in `find $APPDIR -name .svn -type dir`; do
335 # now fix up the executables
336 echo "Fixing up executable dependency names ..."
337 executables=$MAIN_EXECUTABLE
338 if test x$INTERNAL_JACK != x ; then
339 executables="$executables jackd"
341 if test x$SAE != x ; then
342 executables="$executables"
345 for exe in $executables; do
346 EXE=$APPROOT/MacOS/$exe
348 if test x$INTERNAL_JACK != x ; then
349 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | awk '{print $1}'` ; do
351 changes="$changes -change $lib @executable_path/../Frameworks/$base"
354 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
356 changes="$changes -change $lib @executable_path/../Frameworks/$base"
359 if test "x$changes" != "x" ; then
360 install_name_tool $changes $EXE
364 echo "Fixing up library names ..."
365 # now do the same for all the libraries we include
366 for dylib in $JACK_SHARED_OBJECTS $Frameworks/*.dylib $Frameworks/modules/*.so $Surfaces/*.dylib ; do
368 if test ! -L $dylib ; then
370 # change all the dependencies
373 if test x$INTERNAL_JACK != x ; then
374 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | awk '{print $1}'` ; do
376 changes="$changes -change $lib @executable_path/../Frameworks/$base"
379 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
381 changes="$changes -change $lib @executable_path/../Frameworks/$base"
385 if test "x$changes" != x ; then
386 if install_name_tool $changes $dylib ; then
393 # now the change what the library thinks its own name is
395 base=`basename $dylib`
396 install_name_tool -id @executable_path/../Frameworks/$base $dylib
400 if [ x$EXTRA_PACKAGING_DIR != x ] ; then
402 if [ x$SAE != x ] ; then
406 echo "Creating SAE packaging directory"
409 mv $APPDIR $SAE_PKG_DIR/Ardour2-SAE.app
410 cp HowToInstallArdourSAE.pdf "$SAE_PKG_DIR/How To Install Ardour SAE.pdf"
411 cp SAE-de-keypad.pdf "$SAE_PKG_DIR/Ardour SAE Shortcuts (keypad).pdf"
412 cp SAE-de-nokeypad.pdf "$SAE_PKG_DIR/Ardour SAE Shortcuts.pdf"
414 elif [ x$MIXBUS != x ] ; then
418 echo "Creating Mixbus packaging directory"
419 rm -rf $MIXBUS_PKG_DIR
420 mkdir $MIXBUS_PKG_DIR
421 mv $APPDIR $MIXBUS_PKG_DIR/
422 # cp HowToInstallArdourMIXBUS.pdf "$MIXBUS_PKG_DIR/How To Install Ardour MIXBUS.pdf"
424 if [ -x$EXTERNAL_JACK != x ] ; then
425 cp $EXTERNAL_JACK $MIXBUS_PKG_DIR
430 echo "public packaging in an extra folder is not implemented yet"