3 # script for pulling together a MacOSX app bundle.
5 GTKQUARTZ_ROOT=$HOME/gtk/inst
7 if pkg-config --modversion gtk+-2.0 | grep -s 2.22 ; then
9 GDKPIXBUF_LOADERS=$GTKQUARTZ_ROOT/lib/gtk-2.0/2.10.0/loaders
12 echo "*****************************************************"
13 echo "You are building with the OLD GTK stack. I hope that is ok"
14 echo "*****************************************************"
19 GDKPIXBUF_LOADERS=$GTKQUARTZ_ROOT/lib/gdk-pixbuf-2.0/2.10.0/loaders
22 echo "*****************************************************"
23 echo "You are building with the NEW GTK stack. I hope that is ok"
24 echo "*****************************************************"
36 while [ $# -gt 0 ] ; do
41 # top level build targets
48 PRODUCT_PKG_DIR=ArdourSAE ;
56 PRODUCT_PKG_DIR=MixBus;
63 PRODUCT_PKG_DIR=Ardour;
70 PRODUCT_PKG_DIR=Ardour ;
72 --test) SAE= ; WITH_LADSPA=; STRIP= ; shift ;;
75 # specific build flags
78 --noladspa) WITH_LADSPA= ; shift ;;
79 --nostrip) STRIP= ; shift ;;
80 --sysdeps) PRINT_SYSDEPS=1; shift ;;
81 --nls) WITH_NLS=1 ; shift ;;
85 BUILD_ROOT=../../build
87 #release_version=`grep -m 1 '^VERSION' ../../wscript | cut -d' ' -f 3 | sed "s/'//g"`
89 svn_version=`grep -m 1 'svn_revision =' ../../libs/ardour/svn_revision.cc | cut -d' ' -f 8 | sed 's/[^0-9]//g'`
90 echo "Version is $release_version / $svn_version"
91 info_string="$release_version/$svn_version built on `hostname` by `whoami` on `date`"
92 echo "Info string is $info_string"
94 # setup directory structure
97 APPROOT=$APPDIR/Contents
98 Frameworks=$APPROOT/Frameworks
99 Resources=$APPROOT/Resources
101 # Since this is OS X, don't try to distinguish between etc and shared
102 # (machine dependent and independent data) - just put everything
107 Locale=$Resources/locale
109 # Bundled Plugins live in a top level folder
111 Plugins=$APPROOT/Plugins
112 Surfaces=$Frameworks/surfaces
113 Panners=$Frameworks/panners
114 MidiMaps=$Shared/midi_maps
115 ExportFormats=$Shared/export
116 Templates=$Shared/templates
117 PatchFiles=$Shared/patchfiles
120 if [ x$PRINT_SYSDEPS != x ] ; then
122 # print system dependencies
125 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
126 if ! file $file | grep -qs Mach-O ; then
129 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
134 echo "Removing old $APPDIR tree ..."
138 echo "Building new app directory structure ..."
140 # only bother to make the longest paths
142 mkdir -p $APPROOT/MacOS
143 mkdir -p $APPROOT/Resources
148 mkdir -p $ExportFormats
150 mkdir -p $Frameworks/modules
151 mkdir -p $Shared/templates
154 # maybe set variables
156 if test x$SAE != x ; then
157 appname="Ardour3/SAE"
158 env="$env<key>ARDOUR_SAE</key><string>true</string>"
160 # current default for SAE version is German keyboard layout without a keypad
162 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de-nokeypad</string>"
163 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui_sae.conf</string>"
164 env="$env<key>ARDOUR3_UI_RC</key><string>ardour3_ui_dark_sae.rc</string>"
165 elif test x$MIXBUS != x ; then
166 appname="Ardour3/Mixbus"
167 env="$env<key>ARDOUR_MIXBUS</key><string>true</string>"
169 # current default for MIXBUS version is US keyboard layout without a keypad
171 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>us-nokeypad</string>"
172 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui.conf</string>"
173 env="$env<key>ARDOUR3_UI_RC</key><string>ardour3_ui_dark.rc</string>"
179 # if we're not going to bundle JACK, make sure we can find
180 # jack in the places where it might be
183 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>"
184 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
186 env="<key>LSEnvironment</key><dict>$env<key>ARDOUR_BUNDLED</key><string>true</string></dict>"
189 sed -e "s?@ENV@?$env?g" \
190 -e "s?@VERSION@?$release_version/$svn_version?g" \
191 -e "s?@INFOSTRING@?$info_string?g" < Info.plist.in > Info.plist
193 sed -e "s?@APPNAME@?$appname?" \
194 -e "s?@ENV@?$env?g" \
195 -e "s?@VERSION@?$release_version/$svn_version?g" \
196 -e "s?@INFOSTRING@?$info_string?g" < InfoPlist.strings.in > Resources/InfoPlist.strings || exit 1
200 cp Info.plist $APPROOT
201 cp -R Resources $APPROOT
204 # if we build a bundle without jack, then
205 # make the Ardour3 executable a helper
206 # script that checks to see if JACK is
210 cp startup_script $APPROOT/MacOS/Ardour3
211 chmod 775 $APPROOT/MacOS/Ardour3
212 MAIN_EXECUTABLE=Ardour3.bin
214 echo "Copying ardour executable ...."
215 cp $BUILD_ROOT/gtk2_ardour/ardour-$release_version $APPROOT/MacOS/$MAIN_EXECUTABLE
216 if test x$SAE != x ; then
217 # cp $BUILD_ROOT/gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
218 cp Ardour3-SAE.icns $Resources/appIcon.icns
219 elif test x$MIXBUS != x ; then
220 cp Mixbus.icns $Resources/appIcon.icns
222 cp Ardour3.icns $Resources/appIcon.icns
224 cp typeArdour.icns $Resources/
225 if test x$STRIP != x ; then
226 strip $APPROOT/MacOS/Ardour3
230 if test x$WITH_NLS != x ; then
231 echo "NLS support ..."
232 echo "I hope you remembered to run scons msgupdate!"
234 for file in $BUILD_ROOT/gtk2_ardour/*.mo
236 lang=`basename $file | sed 's/\.mo//'`
237 mkdir -p $Locale/$lang/LC_MESSAGES
238 cp $file $Locale/$lang/LC_MESSAGES/gtk2_ardour.mo
239 LINGUAS="$LINGUAS $lang"
241 for file in $BUILD_ROOT/libs/ardour/*.mo
243 lang=`basename $file | sed 's/\.mo//'`
244 mkdir -p $Locale/$lang/LC_MESSAGES
245 cp $file $Locale/$lang/LC_MESSAGES/libardour.mo
249 if [ -d $GTKQUARTZ_ROOT/share/locale/$l ] ; then
250 echo "Copying GTK i18n files for $l..."
251 cp -r $GTKQUARTZ_ROOT/share/locale/$l $Locale
253 # try with just the language spec
254 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
255 if [ -d $GTKQUARTZ_ROOT/share/locale/$just_lang ] ; then
256 echo "Copying GTK i18n files for $l..."
257 cp -r $GTKQUARTZ_ROOT/share/locale/$just_lang $Locale
262 echo "Skipping NLS support"
265 cp -R $GTKQUARTZ_ROOT/etc/* $Etc
266 echo "Copying all Pango modules ..."
267 cp -R $GTKQUARTZ_ROOT/lib/pango/1.6.0/modules/*.so $Frameworks/modules
268 echo "Copying all GDK Pixbuf loaders ..."
269 cp -R $GDKPIXBUF_LOADERS/*.so $Frameworks/modules
271 cp -R $GTKQUARTZ_ROOT/lib/charset.alias $Resources
275 if test x$WITH_LADSPA != x ; then
276 if test x$SAE != x ; then
278 elif test x$MIXBUS != x ; then
279 plugdir=mixbus_ladspa
283 echo "Copying `ls $plugdir | wc -l` plugins ..."
284 cp -r $plugdir/* $Plugins
287 # generate new Pango module file
290 ModulesPath=$GTKQUARTZ_ROOT/lib/pango/1.6.0/modules
292 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
295 # generate a new GDK pixbufs loaders file
296 gdk-pixbuf-query-loaders | sed "s?$GDKPIXBUF_LOADERS/?@executable_path/../Frameworks/modules/?" > $Resources/gdk-pixbuf.loaders
298 # this one is special - we will set GTK_PATH to $Frameworks/clearlooks
299 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.dylib $Frameworks
300 mkdir -p $Frameworks/clearlooks/engines
301 (cd $Frameworks/clearlooks/engines && ln -s $BUILD_ROOT/libclearlooks.dylib libclearlooks.dylib && ln -s ../../libclearlooks.dylib libclearlooks.so)
303 # Control Surface shared libraries
304 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.dylib $Surfaces
305 # hack ... move libardour_cp back into Frameworks
306 mv $Surfaces/libardourcp*.dylib $Frameworks
309 cp $BUILD_ROOT/libs/panners/*/lib*.dylib $Panners
312 # Export Formats/Presets
313 for f in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
314 echo ExportFormat: $f
315 cp "$f" $ExportFormats ;
318 # Session and Route templates
319 for f in $BUILD_ROOT/../templates/* ; do
320 if [ -d "$f" ] ; then
322 cp -r "$f" $Templates ;
327 # got to be careful with names here
328 for x in $BUILD_ROOT/../midi_maps/*.map ; do
330 echo Copied MIDI map $x
334 # got to be careful with names here
335 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
337 echo Copied MIDNAM file "$x"
341 # got to be careful with names here
342 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
344 echo Copied Mackie Control file $x
347 # VAMP plugins that we use
348 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
352 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Panners/*.dylib $Surfaces/*.dylib $Plugins/*.so ; do
353 if ! file $file | grep -qs Mach-O ; then
356 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | grep -v 'libjack\.'`
358 for dep in $deps ; do
360 if ! test -f $Frameworks/$base; then
361 if echo $dep | grep -sq '^libs' ; then
362 cp $BUILD_ROOT/$dep $Frameworks
370 if test x$missing = xfalse ; then
371 # everything has been found
377 echo "Copying other stuff to $APPDIR ..."
379 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Resources
381 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Resources
382 cp ../../gtk2_ardour/mixer.bindings $Resources
383 cp ../../gtk2_ardour/step_editing.bindings $Resources
384 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Resources
386 if test x$SAE != x ; then
387 cp $BUILD_ROOT/gtk2_ardour/SAE-de-keypad.bindings $Resources
388 cp $BUILD_ROOT/gtk2_ardour/SAE-de-nokeypad.bindings $Resources
389 cp $BUILD_ROOT/gtk2_ardour/SAE-us-keypad.bindings $Resources
390 cp $BUILD_ROOT/gtk2_ardour/SAE-us-nokeypad.bindings $Resources
391 cp $BUILD_ROOT/ardour_system_sae.rc $Resources/ardour_system.rc
392 echo cp $BUILD_ROOT/ardour_system_sae.rc $Resources/ardour_system.rc
393 cp $BUILD_ROOT/instant.xml.sae $Resources/instant.xml
394 echo cp $BUILD_ROOT/instant.xml.sae $Resources/instant.xml
396 # cp $BUILD_ROOT/ardour_system.rc $Resources/ardour_system.rc
397 # echo FOO cp $BUILD_ROOT/ardour_system.rc $Resources/ardour_system.rc
398 cp ../../instant.xml $Resources/instant.xml
399 echo cp ../../instant.xml $Resources/instant.xml
401 cp ../../gtk2_ardour/ardour3_ui_default.conf $Resources
402 cp ../../gtk2_ardour/ardour3_ui_default.conf $Resources/ardour3_ui.conf
403 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_light.rc $Resources
404 cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_dark.rc $Resources
406 cp -r ../../gtk2_ardour/icons $Resources
407 cp -r ../../gtk2_ardour/pixmaps $Resources
409 # splash screen stuff
410 cp -R ../../gtk2_ardour/splash.png $Shared
412 # go through and recursively remove any .svn dirs in the bundle
413 for svndir in `find $APPDIR -name .svn -type dir`; do
417 # now fix up the executables
418 echo "Fixing up executable dependency names ..."
419 executables=$MAIN_EXECUTABLE
420 if test x$SAE != x ; then
421 executables="$executables"
424 for exe in $executables; do
425 EXE=$APPROOT/MacOS/$exe
427 for lib in `otool -L $EXE | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
429 changes="$changes -change $lib @executable_path/../Frameworks/$base"
431 if test "x$changes" != "x" ; then
432 install_name_tool $changes $EXE
436 echo "Fixing up library names ..."
437 # now do the same for all the libraries we include
438 for libdir in $Frameworks $Frameworks/modules $Surfaces $Panners ; do
440 libbase=`basename $libdir`
442 for dylib in $libdir/*.dylib $libdir/*.so ; do
446 if test -L $dylib ; then
450 # change all the dependencies
453 for lib in `otool -L $dylib | egrep "($GTKQUARTZ_ROOT|/opt/|/local/|libs/)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
455 if echo $lib | grep -s libbase; then
456 changes="$changes -change $lib @executable_path/../$libbase/$base"
458 changes="$changes -change $lib @executable_path/../Frameworks/$base"
462 if test "x$changes" != x ; then
463 if install_name_tool $changes $dylib ; then
470 # now the change what the library thinks its own name is
472 base=`basename $dylib`
473 install_name_tool -id @executable_path/../$libbase/$base $dylib
478 # and now ... the DMG
481 rm -rf $PRODUCT_PKG_DIR
482 mkdir $PRODUCT_PKG_DIR
484 if [ x$SAE != x ] ; then
488 echo "Creating SAE packaging directory"
489 mv $APPDIR $PRODUCT_PKG_DIR/Ardour3-SAE.app
490 cp HowToInstallArdourSAE.pdf "$PRODUCT_PKG_DIR/How To Install Ardour SAE.pdf"
491 cp SAE-de-keypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts (keypad).pdf"
492 cp SAE-de-nokeypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts.pdf"
494 elif [ x$MIXBUS != x ] ; then
498 echo "Creating Mixbus packaging directory"
499 mv $APPDIR $PRODUCT_PKG_DIR/
500 cp MixBus_Install_QuickStart.pdf "$PRODUCT_PKG_DIR/Mixbus Install & Quick Start Guide.pdf"
504 echo "Creating $APPNAME packaging directory"
505 mv $APPDIR $PRODUCT_PKG_DIR/
509 echo "Building DMG ..."
511 # UC_DMG=$APPNAME-${release_version}-${svn_version}-UC.dmg
512 # FINAL_DMG=$APPNAME-${release_version}-${svn_version}.dmg
513 UC_DMG=$APPNAME-${release_version}-${svn_version}.dmg
516 echo hdiutil create $UC_DMG -volname $APPNAME-$release_version -fs HFS+ -srcfolder $PRODUCT_PKG_DIR
517 hdiutil create $UC_DMG -volname $APPNAME-$release_version -fs HFS+ -srcfolder $PRODUCT_PKG_DIR
520 # echo "Compressing DMG ..."
522 # hdiutil convert $UC_DMG -format UDBZ -o $FINAL_DMG