5 # script for pulling together a MacOSX app bundle.
7 GTKSTACK_ROOT=$HOME/gtk/inst
8 ARDOURSTACK_ROOT=$HOME/a3/inst
11 # where harvid and xjadeo binaries are cached
12 if test -z "$CACHEDIR" -o ! -d "$CACHEDIR"; then
27 while [ $# -gt 0 ] ; do
32 # top level build targets
39 PRODUCT_PKG_DIR=ArdourSAE ;
49 PRODUCT_PKG_DIR=Mixbus;
55 PRODUCT_PKG_DIR=Ardour;
61 PRODUCT_PKG_DIR=Ardour ;
63 --test) SAE= ; WITH_LADSPA=; STRIP= ; shift ;;
66 # specific build flags
69 --noharvid) WITH_HARVID= ; shift ;;
70 --noladspa) WITH_LADSPA= ; shift ;;
71 --nostrip) STRIP= ; shift ;;
72 --sysdeps) PRINT_SYSDEPS=1; shift ;;
73 --nls) WITH_NLS=1 ; shift ;;
77 if test -z "$PRODUCT_PKG_DIR" -o -z "$APPNAME"; then
78 echo "application or product-name was not specified"
82 . ../define_versions.sh
83 echo "Version is $release_version"
84 if [ "x$commit" != "x" ] ; then
85 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
87 info_string="$release_version built on `hostname` by `whoami` on `date`"
89 echo "Info string is $info_string"
91 if [ x$DEBUG = xT ]; then
93 echo "Debug build, strip disabled"
95 if test x$STRIP != x ; then
96 echo "No debug build, strip enabled"
98 echo "No debug build, but strip disabled."
102 # setup directory structure
104 APPDIR=${APPNAME}${major_version}.app
105 APPROOT=$APPDIR/Contents
106 Frameworks=$APPROOT/lib
107 Resources=$APPROOT/Resources
109 # Since this is OS X, don't try to distinguish between etc and shared
110 # (machine dependent and independent data) - just put everything
115 Locale=$Resources/locale
117 # Bundled Plugins live in a top level folder
119 Plugins=$APPROOT/Plugins
120 Surfaces=$Frameworks/surfaces
121 Panners=$Frameworks/panners
122 Backends=$Frameworks/backends
123 MidiMaps=$Shared/midi_maps
124 ExportFormats=$Shared/export
125 Templates=$Shared/templates
126 PatchFiles=$Shared/patchfiles
127 LuaScripts=$Shared/scripts
128 MackieControl=$Shared/mcp
130 if [ x$PRINT_SYSDEPS != x ] ; then
132 # print system dependencies
135 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
136 if ! file $file | grep -qs Mach-O ; then
139 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
144 echo "Removing old $APPDIR tree ..."
148 echo "Building new app directory structure ..."
150 # only bother to make the longest paths
152 mkdir -p $APPROOT/MacOS
153 mkdir -p $APPROOT/Resources
159 mkdir -p $ExportFormats
161 mkdir -p $Frameworks/modules
163 mkdir -p $MackieControl
167 # maybe set variables
169 if test x$SAE != x ; then
170 appname="Ardour${major_version}-SAE"
171 EXECUTABLE=${appname}
172 env="$env<key>ARDOUR_SAE</key><string>true</string>"
174 # current default for SAE version is German keyboard layout without a keypad
176 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de-nokeypad</string>"
177 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui_sae.conf</string>"
178 elif test x$MIXBUS != x ; then
180 EXECUTABLE=${appname}${major_version}
181 env="$env<key>ARDOUR_MIXBUS</key><string>true</string>"
183 # current default for MIXBUS version is US keyboard layout without a keypad
185 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>us-nokeypad</string>"
186 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui.conf</string>"
188 appname="Ardour${major_version}"
189 EXECUTABLE=${appname}
193 # if we're not going to bundle JACK, make sure we can find
194 # jack in the places where it might be
197 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>"
198 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
200 env="<key>LSEnvironment</key><dict>$env<key>ARDOUR_BUNDLED</key><string>true</string></dict>"
204 sed -e "s?@ENV@?$env?g" \
205 -e "s?@VERSION@?$release_version?g" \
206 -e "s?@INFOSTRING@?$info_string?g" \
207 -e "s?@IDSUFFIX@?$EXECUTABLE?g" \
208 -e "s?@BUNDLENAME@?${APPNAME}${major_version}?g" \
209 -e "s?@EXECUTABLE@?$EXECUTABLE?g" < Info.plist.in > Info.plist
211 sed -e "s?@APPNAME@?$appname?" \
212 -e "s?@ENV@?$env?g" \
213 -e "s?@VERSION@?$release_version?g" \
214 -e "s?@INFOSTRING@?$info_string?g" < InfoPlist.strings.in > Resources/InfoPlist.strings || exit 1
218 cp Info.plist $APPROOT
219 cp -R Resources $APPROOT
223 rm -f Resources/InfoPlist.strings
226 # if we build a bundle without jack, then
227 # make the Ardour executable a helper
228 # script that checks to see if JACK is
232 cp startup_script $APPROOT/MacOS/$EXECUTABLE
233 chmod 775 $APPROOT/MacOS/$EXECUTABLE
234 MAIN_EXECUTABLE=Ardour.bin ## used in startup_script
236 echo "Copying ardour executable ...."
237 cp $BUILD_ROOT/gtk2_ardour/ardour-$release_version $APPROOT/MacOS/$MAIN_EXECUTABLE
238 if test x$SAE != x ; then
239 # cp $BUILD_ROOT/gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
240 cp Ardour3-SAE.icns $Resources/appIcon.icns
241 elif test x$MIXBUS != x ; then
242 cp Mixbus.icns $Resources/appIcon.icns
244 cp Ardour.icns $Resources/appIcon.icns
246 cp typeArdour.icns $Resources/
248 set +e # things below are not error-free (optional files etc) :(
251 if test x$WITH_NLS != x ; then
252 echo "NLS support ..."
253 echo "I hope you remembered to run waf i18n"
256 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
257 files=`find ../../$pkg -name "*.mo"`
260 # the package name is appended with a number so that
261 # it can be parallel installed during a regular install
262 # with older (and newer) versions. it is just the major
263 # number of the release (i.e. leading digits)
266 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
268 if [ -z "$files" ]; then
270 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
277 lang=`basename $file | sed 's/\.mo//'`
278 mkdir -p $Locale/$lang/LC_MESSAGES
279 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
280 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
281 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
284 LINGUAS="$LINGUAS $lang"
291 if [ -d $GTKSTACK_ROOT/share/locale/$l ] ; then
292 echo "Copying GTK i18n files for $l..."
293 cp -r $GTKSTACK_ROOT/share/locale/$l $Locale
295 # try with just the language spec
296 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
297 if [ -d $GTKSTACK_ROOT/share/locale/$just_lang ] ; then
298 echo "Copying GTK i18n files for $l..."
299 cp -r $GTKSTACK_ROOT/share/locale/$just_lang $Locale
304 echo "Skipping NLS support"
308 # Copy stuff that may be dynamically loaded
311 cp -R $GTKSTACK_ROOT/etc/* $Etc
312 cp -R $GTKSTACK_ROOT/lib/charset.alias $Resources
314 # We rely on clearlooks, so include a version from our own build tree
315 # this one is special - we will set GTK_PATH to $Frameworks/gtkengines
317 GTK_ENGINE_DIR=$Frameworks/gtkengines/engines
318 mkdir -p $GTK_ENGINE_DIR
320 echo "Copying GTK engines ..."
321 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.dylib $Frameworks
322 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.dylib . && ln -s ../../libclearlooks.dylib libclearlooks.so)
324 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Frameworks
325 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so)
328 if test x$WITH_LADSPA != x ; then
329 if test x$SAE != x ; then
331 elif test x$MIXBUS != x ; then
332 plugdir=mixbus_ladspa
336 if [ -d $plugdir -a "x$(ls $plugdir)" != x ] ; then
337 echo "Copying `ls $plugdir | wc -l` plugins ..."
338 cp -r $plugdir/* $Plugins
342 # Control Surface shared libraries
343 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.dylib $Surfaces
344 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp*.dylib $Frameworks
347 cp $BUILD_ROOT/libs/panners/*/lib*.dylib $Panners
350 for backend in jack wavesaudio dummy coreaudio; do
351 cp $BUILD_ROOT/libs/backends/$backend/lib*.dylib $Backends
354 # Export Formats/Presets
355 for f in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
356 cp "$f" $ExportFormats ;
359 # Session and Route templates
360 #for f in $BUILD_ROOT/../templates/* ; do
361 # if [ -d "$f" ] ; then
362 # cp -r "$f" $Templates ;
367 # got to be careful with names here
368 for x in $BUILD_ROOT/../midi_maps/*.map ; do
373 # got to be careful with names here
374 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
379 # got to be careful with names here
380 for x in $BUILD_ROOT/../scripts/*.lua ; do
385 # got to be careful with names here
386 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
387 cp "$x" $MackieControl
390 # VAMP plugins that we use
391 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
393 # Suil modules (new dir 'build-stack')
394 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
395 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Frameworks
398 # Suil modules (old dir 'build-ardour-stack')
399 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
400 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Frameworks
403 # VST scanner app and wrapper script, if they exist
404 if test -d $BUILD_ROOT/libs/fst ; then
405 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $Frameworks/
409 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
410 mkdir -p $Frameworks/vfork
411 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $Frameworks/
414 # TODO check if this is still needed, even when building on 10.5
415 if file $BUILD_ROOT/gtk2_ardour/ardour-$release_version | grep -q ppc; then
416 STDCPP='|libstdc\+\+'
423 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Panners/*.dylib $Backends/*.dylib $Surfaces/*.dylib $Plugins/*.so ; do
424 if ! file $file | grep -qs Mach-O ; then
427 # libffi contains "S" (other section symbols) that should not be stripped.
428 if [[ $file == *"libffi"* ]] ; then
432 if test x$STRIP != x ; then
433 strip -u -r -arch all $file &>/dev/null
436 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | grep -v 'libjack\.' | grep -v "$(basename $file)"`
438 for dep in $deps ; do
440 if ! test -f $Frameworks/$base; then
441 if echo $dep | grep -sq '^libs' ; then
442 cp $BUILD_ROOT/$dep $Frameworks
450 if test x$missing = xfalse ; then
451 # everything has been found
457 echo "Copying other stuff to $APPDIR ..."
459 cp $BUILD_ROOT/gtk2_ardour/ardour.keys $Resources
460 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Resources
461 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Resources
462 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Resources
464 # Copied directly from source tree
466 cp ../../system_config $Resources/system_config
467 cp ../../instant.xml $Resources/instant.xml
468 cp -r ../../gtk2_ardour/icons $Resources
469 cp -r ../../gtk2_ardour/pixmaps $Resources
470 cp ../../gtk2_ardour/dark.colors $Resources
471 cp -R ../../gtk2_ardour/splash.png $Shared
472 cp -R ../../gtk2_ardour/small-splash.png $Shared
473 cp -R ../../gtk2_ardour/ArdourMono.ttf $Shared
475 # go through and recursively remove any .svn dirs in the bundle
476 for svndir in `find $APPDIR -name .svn -type dir`; do
480 # install bundled LV2s to <app>/Contents/lib/LV2/
481 cp -R $BUILD_ROOT/libs/LV2 $Frameworks/
483 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
484 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
485 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
486 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
487 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
491 # now fix up the executables
492 echo "Fixing up executable dependency names ..."
493 executables=$MAIN_EXECUTABLE
494 if test x$SAE != x ; then
495 executables="$executables"
498 for exe in $executables; do
499 EXE=$APPROOT/MacOS/$exe
501 for lib in `otool -L $EXE | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
503 changes="$changes -change $lib @executable_path/../lib/$base"
505 if test "x$changes" != "x" ; then
506 install_name_tool $changes $EXE
510 echo "Fixing up library names ..."
511 # now do the same for all the libraries we include
512 for libdir in $Frameworks $Frameworks/modules $Surfaces $Panners $Backends ; do
514 libbase=`basename $libdir`
516 for dylib in $libdir/*.dylib $libdir/*.so ; do
520 if test -L $dylib ; then
524 # change all the dependencies
527 for lib in `otool -L $dylib | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
529 if echo $lib | grep -s libbase; then
530 changes="$changes -change $lib @executable_path/../$libbase/$base"
532 changes="$changes -change $lib @executable_path/../lib/$base"
536 if test "x$changes" != x ; then
537 if install_name_tool $changes $dylib ; then
544 # now the change what the library thinks its own name is
546 base=`basename $dylib`
547 install_name_tool -id @executable_path/../$libbase/$base $dylib
552 # and now ... the DMG
555 rm -rf $PRODUCT_PKG_DIR
556 mkdir $PRODUCT_PKG_DIR
561 if [ x$SAE != x ] ; then
565 echo "Creating SAE packaging directory"
566 mv $APPDIR $PRODUCT_PKG_DIR/Ardour3-SAE.app
567 cp HowToInstallArdourSAE.pdf "$PRODUCT_PKG_DIR/How To Install Ardour SAE.pdf"
568 cp SAE-de-keypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts (keypad).pdf"
569 cp SAE-de-nokeypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts.pdf"
571 elif [ x$MIXBUS != x ] ; then
575 echo "Creating Mixbus packaging directory"
576 mv $APPDIR $PRODUCT_PKG_DIR/
577 DMGBACKGROUND=dmgbgMB
580 echo "Creating $APPNAME packaging directory"
581 mv $APPDIR $PRODUCT_PKG_DIR/
585 if file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q x86_64; then
588 elif file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q ppc; then
596 if test x$WITH_HARRISON_LV2 != x ; then
597 curl -s -S --fail -# \
598 -z "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
599 -o "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
600 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_lv2s.${OSX_BENSID}.zip"
602 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
603 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
604 "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip"
607 if test x$WITH_HARVID != x ; then
608 echo "installing video tools.."
609 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
610 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
612 echo "copying harvid and xjadeo ..."
615 rsync://ardour.org/video-tools/harvid-osx-${HARVID_VERSION}.tgz \
616 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
619 rsync://ardour.org/video-tools/jadeo-${XJADEO_VERSION:1}.dmg \
620 "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg"
623 -C $PRODUCT_PKG_DIR/$APPROOT \
624 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
626 JADEO=$(hdiutil attach "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg" | grep Apple_HFS | grep dev/ | cut -f 3)
627 cp -r "${JADEO}/Jadeo.app" "$PRODUCT_PKG_DIR/"
628 hdiutil detach "${JADEO}"
630 XJCONTENT=${PRODUCT_PKG_DIR}/Jadeo.app/Contents
631 HVLIBS=${PRODUCT_PKG_DIR}/$APPROOT/lib/harvid
633 for file in ${XJCONTENT}/MacOS/Jadeo-bin ${XJCONTENT}/Frameworks/*.dylib ${HVLIBS}/*.dylib ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/*harvid* ; do
634 lipo -extract_family ${OSX_ARCH} ${file} -output ${file}.thin && \
635 mv ${file}.thin ${file}
639 YPOS=$[ $DMGWINBOTTOM - 300 ]
640 XJADEOPOS="set position of item \"Jadeo.app\" of container window to {310, ${YPOS}}"
642 DMGBACKGROUND=${DMGBACKGROUND}xj
645 ################################################################################
646 ### Mixbus plugins, etc
647 if test x$WITH_X42_LV2 != x ; then
648 echo "bundling x42 plugins"
649 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
651 METERS_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/x42-meters.latest.txt)
652 rsync -a -q --partial \
653 rsync://x42-plugins.com/x42/osx/x42-meters-lv2-osx-${METERS_VERSION}.zip \
654 "$CACHEDIR/x42-meters-lv2-osx-${METERS_VERSION}.zip"
655 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
656 "$CACHEDIR/x42-meters-lv2-osx-${METERS_VERSION}.zip"
658 EQ_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/x42-eq.latest.txt)
659 rsync -a -q --partial \
660 rsync://x42-plugins.com/x42/osx/x42-eq-lv2-osx-${EQ_VERSION}.zip \
661 "$CACHEDIR/x42-eq-lv2-osx-${EQ_VERSION}.zip"
662 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
663 "$CACHEDIR/x42-eq-lv2-osx-${EQ_VERSION}.zip"
665 SETBFREE_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/setBfree.latest.txt)
666 rsync -a -q --partial \
667 rsync://x42-plugins.com/x42/osx/setBfree-lv2-osx-${SETBFREE_VERSION}.zip \
668 "$CACHEDIR/setBfree-lv2-osx-${SETBFREE_VERSION}.zip"
669 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
670 "$CACHEDIR/setBfree-lv2-osx-${SETBFREE_VERSION}.zip"
672 MIDIFILTER_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/x42-midifilter.latest.txt)
673 rsync -a -q --partial \
674 rsync://x42-plugins.com/x42/osx/x42-midifilter-lv2-osx-${MIDIFILTER_VERSION}.zip \
675 "$CACHEDIR/x42-midifilter-lv2-osx-${MIDIFILTER_VERSION}.zip"
676 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
677 "$CACHEDIR/x42-midifilter-lv2-osx-${MIDIFILTER_VERSION}.zip"
679 for file in ${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/*/*.dylib ; do
680 lipo -extract_family ${OSX_ARCH} ${file} -output ${file}.thin
681 mv ${file}.thin ${file}
685 if test -n "$MIXBUS"; then
686 echo "deploying harrison tools for $OSX_BENSID"
688 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip"
690 curl -s -S --fail -# \
691 -z "${CACHEDIR}/harrison_channelstrip.${OSX_BENSID}.so" \
692 -o "${CACHEDIR}/harrison_channelstrip.${OSX_BENSID}.so" \
693 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_channelstrip.${OSX_BENSID}.so"
695 cp "${CACHEDIR}/harrison_channelstrip.${OSX_BENSID}.so" \
696 "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip/harrison_channelstrip.so"
698 ################################################################################
700 ( cd $PRODUCT_PKG_DIR ; find . ) > file_list.txt
702 echo "Building DMG ..."
704 # UC_DMG=$APPNAME-${release_version}-UC.dmg
705 # FINAL_DMG=$APPNAME-${release_version}.dmg
707 if [ x$DEBUG = xT ]; then
708 UC_DMG=$APPNAME-$release_version-dbg.dmg
710 UC_DMG=$APPNAME-$release_version.dmg
712 VOLNAME=$APPNAME-$release_version
714 MNTPATH=`mktemp -d -t ardourimg`
715 TMPDMG=`mktemp -t ardour`
716 ICNSTMP=`mktemp -t ardouricon`
718 DMGMEGABYTES=$[ `du -sk "$PRODUCT_PKG_DIR" | cut -f 1` * 1024 / 1048576 + $EXTRA_SPACE_MB ]
720 echo "DMG MB = " $DMGMEGABYTES
722 rm -f $UC_DMG "$TMPDMG" "${TMPDMG}.dmg" "$ICNSTMP"
726 TMPDMG="${TMPDMG}.dmg"
728 trap "rm -rf $MNTPATH $TMPDMG ${TMPDMG}.dmg $ICNSTMP" EXIT
730 hdiutil create -megabytes $DMGMEGABYTES -fs HFS+ -volname "${VOLNAME}" "$TMPDMG"
731 DiskDevice=$(hdid -nomount "$TMPDMG" | grep Apple_HFS | cut -f 1 -d ' ')
732 mount -t hfs -o nobrowse "${DiskDevice}" "${MNTPATH}"
734 cp -r ${PRODUCT_PKG_DIR}/* "${MNTPATH}" || exit
735 mkdir "${MNTPATH}/.background"
736 cp -vi ${DMGBACKGROUND}.png "${MNTPATH}/.background/dmgbg.png"
738 echo "setting DMG background ..."
740 if test $(sw_vers -productVersion | cut -d '.' -f 2) -lt 9; then
744 # OSX 10.9.X and later
745 DISKNAME=`basename "${MNTPATH}"`
749 tell application "Finder"
751 tell disk "${DISKNAME}"
754 set current view of container window to icon view
755 set toolbar visible of container window to false
756 set statusbar visible of container window to false
757 set the bounds of container window to {400, 200, 800, ${DMGWINBOTTOM}}
758 set theViewOptions to the icon view options of container window
759 set arrangement of theViewOptions to not arranged
760 set icon size of theViewOptions to 64
761 set background picture of theViewOptions to file ".background:dmgbg.png"
762 make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
763 set position of item "${APPDIR}" of container window to {90, 100}
764 set position of item "Applications" of container window to {310, 100}
770 update without registering applications
777 chmod -Rf go-w "${MNTPATH}"
781 echo "compressing Image ..."
783 # Umount the image ('eject' above may already have done that)
784 umount "${DiskDevice}" || true
785 hdiutil eject "${DiskDevice}" || true
786 # Create a read-only version, use zlib compression
787 hdiutil convert -format UDZO "${TMPDMG}" -imagekey zlib-level=9 -o "${UC_DMG}"
789 if test $(sw_vers -productVersion | cut -d '.' -f 2) -gt 5; then
790 echo "setting file icon ..."
792 cp ${PRODUCT_PKG_DIR}/$Resources/appIcon.icns ${ICNSTMP}.icns
793 sips -i ${ICNSTMP}.icns
794 DeRez -only icns ${ICNSTMP}.icns > ${ICNSTMP}.rsrc
795 Rez -append ${ICNSTMP}.rsrc -o "$UC_DMG"
796 SetFile -a C "$UC_DMG"
798 rm ${ICNSTMP}.icns ${ICNSTMP}.rsrc
801 rm -rf ${PRODUCT_PKG_DIR}
804 echo "packaging suceeded."