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
28 : ${HARRISONCHANNELSTRIP=harrison_channelstrip}
30 . ../define_versions.sh
32 while [ $# -gt 0 ] ; do
37 # top level build targets
44 PRODUCT_PKG_DIR=ArdourSAE ;
54 PRODUCT_PKG_DIR=Mixbus;
57 --mixbus32c) MIXBUS=1;
65 PRODUCT_PKG_DIR=Mixbus32C;
66 APPNAME=Mixbus32C-${major_version} ;
74 PRODUCT_PKG_DIR=Ardour;
80 PRODUCT_PKG_DIR=Ardour ;
82 --test) SAE= ; WITH_LADSPA=; STRIP= ; shift ;;
85 # specific build flags
88 --noharvid) WITH_HARVID= ; shift ;;
89 --noladspa) WITH_LADSPA= ; shift ;;
90 --nostrip) STRIP= ; shift ;;
91 --sysdeps) PRINT_SYSDEPS=1; shift ;;
92 --nls) WITH_NLS=1 ; shift ;;
93 --chanstrip) HARRISONCHANNELSTRIP=$2 ; shift; shift ;;
97 if test -z "$PRODUCT_PKG_DIR" -o -z "$APPNAME"; then
98 echo "application or product-name was not specified"
102 echo "Version is $release_version"
103 if [ "x$commit" != "x" ] ; then
104 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
106 info_string="$release_version built on `hostname` by `whoami` on `date`"
108 echo "Info string is $info_string"
110 if [ x$DEBUG = xT ]; then
112 echo "Debug build, strip disabled"
114 if test x$STRIP != x ; then
115 echo "No debug build, strip enabled"
117 echo "No debug build, but strip disabled."
121 # setup directory structure
123 APPDIR=${APPNAME}${major_version}.app
124 APPROOT=$APPDIR/Contents
125 Frameworks=$APPROOT/lib
126 Resources=$APPROOT/Resources
128 # Since this is OS X, don't try to distinguish between etc and shared
129 # (machine dependent and independent data) - just put everything
134 Locale=$Resources/locale
136 # Bundled Plugins live in a top level folder
138 Plugins=$APPROOT/Plugins
139 Surfaces=$Frameworks/surfaces
140 Panners=$Frameworks/panners
141 Backends=$Frameworks/backends
142 MidiMaps=$Shared/midi_maps
143 ExportFormats=$Shared/export
144 Templates=$Shared/templates
145 PatchFiles=$Shared/patchfiles
146 LuaScripts=$Shared/scripts
147 MackieControl=$Shared/mcp
148 Themes=$Shared/themes
150 if [ x$PRINT_SYSDEPS != x ] ; then
152 # print system dependencies
155 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
156 if ! file $file | grep -qs Mach-O ; then
159 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
164 echo "Removing old $APPDIR tree ..."
168 echo "Building new app directory structure ..."
170 # only bother to make the longest paths
172 mkdir -p $APPROOT/MacOS
173 mkdir -p $APPROOT/Resources
179 mkdir -p $ExportFormats
181 mkdir -p $Frameworks/modules
183 mkdir -p $MackieControl
188 # maybe set variables
190 if test x$SAE != x ; then
191 appname="Ardour${major_version}-SAE"
192 EXECUTABLE=${appname}
193 env="$env<key>ARDOUR_SAE</key><string>true</string>"
195 # current default for SAE version is German keyboard layout without a keypad
197 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de-nokeypad</string>"
198 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui_sae.conf</string>"
199 elif test x$MIXBUS != x ; then
201 EXECUTABLE=${appname}${major_version}
202 env="$env<key>ARDOUR_MIXBUS</key><string>true</string>"
204 # current default for MIXBUS version is US keyboard layout without a keypad
206 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>us-nokeypad</string>"
207 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui.conf</string>"
209 appname="Ardour${major_version}"
210 EXECUTABLE=${appname}
214 # if we're not going to bundle JACK, make sure we can find
215 # jack in the places where it might be
218 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>"
219 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
221 env="<key>LSEnvironment</key><dict>$env<key>ARDOUR_BUNDLED</key><string>true</string></dict>"
225 sed -e "s?@ENV@?$env?g" \
226 -e "s?@VERSION@?$release_version?g" \
227 -e "s?@INFOSTRING@?$info_string?g" \
228 -e "s?@IDSUFFIX@?$EXECUTABLE?g" \
229 -e "s?@BUNDLENAME@?${APPNAME}${major_version}?g" \
230 -e "s?@EXECUTABLE@?$EXECUTABLE?g" < Info.plist.in > Info.plist
232 sed -e "s?@APPNAME@?$appname?" \
233 -e "s?@ENV@?$env?g" \
234 -e "s?@VERSION@?$release_version?g" \
235 -e "s?@INFOSTRING@?$info_string?g" < InfoPlist.strings.in > Resources/InfoPlist.strings || exit 1
239 cp Info.plist $APPROOT
240 cp -R Resources $APPROOT
244 rm -f Resources/InfoPlist.strings
247 # if we build a bundle without jack, then
248 # make the Ardour executable a helper
249 # script that checks to see if JACK is
253 cp startup_script $APPROOT/MacOS/$EXECUTABLE
254 chmod 775 $APPROOT/MacOS/$EXECUTABLE
255 MAIN_EXECUTABLE=Ardour.bin ## used in startup_script
257 echo "Copying ardour executable ...."
258 cp $BUILD_ROOT/gtk2_ardour/ardour-$release_version $APPROOT/MacOS/$MAIN_EXECUTABLE
259 if test x$SAE != x ; then
260 # cp $BUILD_ROOT/gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
261 cp Ardour3-SAE.icns $Resources/appIcon.icns
262 elif test x$MIXBUS32C != x ; then
263 cp Mixbus32C.icns $Resources/appIcon.icns
264 elif test x$MIXBUS != x ; then
265 cp Mixbus.icns $Resources/appIcon.icns
267 cp Ardour.icns $Resources/appIcon.icns
269 cp typeArdour.icns $Resources/
271 set +e # things below are not error-free (optional files etc) :(
274 if test x$WITH_NLS != x ; then
275 echo "NLS support ..."
276 echo "I hope you remembered to run waf i18n"
279 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
280 files=`find ../../$pkg -name "*.mo"`
283 # the package name is appended with a number so that
284 # it can be parallel installed during a regular install
285 # with older (and newer) versions. it is just the major
286 # number of the release (i.e. leading digits)
289 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
291 if [ -z "$files" ]; then
293 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
300 lang=`basename $file | sed 's/\.mo//'`
301 mkdir -p $Locale/$lang/LC_MESSAGES
302 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
303 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
304 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
307 LINGUAS="$LINGUAS $lang"
314 if [ -d $GTKSTACK_ROOT/share/locale/$l ] ; then
315 echo "Copying GTK i18n files for $l..."
316 cp -r $GTKSTACK_ROOT/share/locale/$l $Locale
318 # try with just the language spec
319 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
320 if [ -d $GTKSTACK_ROOT/share/locale/$just_lang ] ; then
321 echo "Copying GTK i18n files for $l..."
322 cp -r $GTKSTACK_ROOT/share/locale/$just_lang $Locale
327 echo "Skipping NLS support"
331 # Copy stuff that may be dynamically loaded
334 cp -R $GTKSTACK_ROOT/etc/* $Etc
335 cp -R $GTKSTACK_ROOT/lib/charset.alias $Resources
337 # We rely on clearlooks, so include a version from our own build tree
338 # this one is special - we will set GTK_PATH to $Frameworks/gtkengines
340 GTK_ENGINE_DIR=$Frameworks/gtkengines/engines
341 mkdir -p $GTK_ENGINE_DIR
343 echo "Copying GTK engines ..."
344 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.dylib $Frameworks
345 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.dylib . && ln -s ../../libclearlooks.dylib libclearlooks.so)
347 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Frameworks
348 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so)
351 if test x$WITH_LADSPA != x ; then
352 if test x$SAE != x ; then
354 elif test x$MIXBUS != x ; then
355 plugdir=mixbus_ladspa
359 if [ -d $plugdir -a "x$(ls $plugdir)" != x ] ; then
360 echo "Copying `ls $plugdir | wc -l` plugins ..."
361 cp -r $plugdir/* $Plugins
365 # Control Surface shared libraries
366 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.dylib $Surfaces
367 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp*.dylib $Frameworks
370 cp $BUILD_ROOT/libs/panners/*/lib*.dylib $Panners
373 for backend in jack wavesaudio dummy coreaudio; do
374 cp $BUILD_ROOT/libs/backends/$backend/lib*.dylib $Backends
377 # Export Formats/Presets
378 for f in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
379 cp "$f" $ExportFormats ;
382 # Session and Route templates
383 #for f in $BUILD_ROOT/../templates/* ; do
384 # if [ -d "$f" ] ; then
385 # cp -r "$f" $Templates ;
390 # got to be careful with names here
391 for x in $BUILD_ROOT/../midi_maps/*.map ; do
396 # got to be careful with names here
397 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
402 # got to be careful with names here
403 for x in $BUILD_ROOT/../scripts/*.lua ; do
408 # got to be careful with names here
409 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
410 cp "$x" $MackieControl
413 # VAMP plugins that we use
414 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
416 # Suil modules (new dir 'build-stack')
417 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
418 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Frameworks
421 # Suil modules (old dir 'build-ardour-stack')
422 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
423 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Frameworks
426 # VST scanner app and wrapper script, if they exist
427 if test -d $BUILD_ROOT/libs/fst ; then
428 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $Frameworks/
432 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
433 mkdir -p $Frameworks/vfork
434 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $Frameworks/
437 # TODO check if this is still needed, even when building on 10.5
438 if file $BUILD_ROOT/gtk2_ardour/ardour-$release_version | grep -q ppc; then
439 STDCPP='|libstdc\+\+'
446 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Panners/*.dylib $Backends/*.dylib $Surfaces/*.dylib $Plugins/*.so ; do
447 if ! file $file | grep -qs Mach-O ; then
450 # libffi contains "S" (other section symbols) that should not be stripped.
451 if [[ $file == *"libffi"* ]] ; then
455 if test x$STRIP != x ; then
456 strip -u -r -arch all $file &>/dev/null
459 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | grep -v 'libjack\.' | grep -v "$(basename $file)"`
461 for dep in $deps ; do
463 if ! test -f $Frameworks/$base; then
464 if echo $dep | grep -sq '^libs' ; then
465 cp $BUILD_ROOT/$dep $Frameworks
473 if test x$missing = xfalse ; then
474 # everything has been found
480 echo "Copying other stuff to $APPDIR ..."
482 cp $BUILD_ROOT/gtk2_ardour/ardour.keys $Resources
483 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Resources
484 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Resources
485 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Resources
487 # Copied directly from source tree
489 mkdir ${Resources}/icons
490 mkdir ${Resources}/resources
491 cp ../../system_config $Resources/system_config
492 cp ../../instant.xml $Resources/instant.xml
493 cp ../../gtk2_ardour/icons/*.png ${Resources}/icons/
494 cp -r ../../gtk2_ardour/icons/cursor_* ${Resources}/icons/
495 cp ../../gtk2_ardour/ArdourMono.ttf $Shared
496 cp ../../gtk2_ardour/resources/${PRODUCT_PKG_DIR}-* ${Resources}/resources/
499 # Themes: only install those named for this app
500 lower_case_appname=`echo $APPNAME | tr '[:upper:]' '[:lower:]'`
501 cp ../../gtk2_ardour/themes/*-${lower_case_appname}.colors $Themes
503 # go through and recursively remove any .svn dirs in the bundle
504 for svndir in `find $APPDIR -name .svn -type dir`; do
508 # install bundled LV2s to <app>/Contents/lib/LV2/
509 cp -R $BUILD_ROOT/libs/LV2 $Frameworks/
511 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
512 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
513 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
514 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
515 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
519 # now fix up the executables
520 echo "Fixing up executable dependency names ..."
521 executables=$MAIN_EXECUTABLE
522 if test x$SAE != x ; then
523 executables="$executables"
526 for exe in $executables; do
527 EXE=$APPROOT/MacOS/$exe
529 for lib in `otool -L $EXE | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
531 changes="$changes -change $lib @executable_path/../lib/$base"
533 if test "x$changes" != "x" ; then
534 install_name_tool $changes $EXE
538 echo "Fixing up library names ..."
539 # now do the same for all the libraries we include
540 for libdir in $Frameworks $Frameworks/modules $Surfaces $Panners $Backends $Frameworks/LV2/* ; do
542 libbase=`basename $libdir`
544 for dylib in $libdir/*.dylib $libdir/*.so ; do
548 if test -L $dylib ; then
552 # change all the dependencies
555 for lib in `otool -L $dylib | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
557 if echo $lib | grep -s libbase; then
558 changes="$changes -change $lib @executable_path/../$libbase/$base"
560 changes="$changes -change $lib @executable_path/../lib/$base"
564 if test "x$changes" != x ; then
565 if install_name_tool $changes $dylib ; then
572 # now the change what the library thinks its own name is
574 base=`basename $dylib`
575 install_name_tool -id @executable_path/../$libbase/$base $dylib
580 # and now ... the DMG
583 rm -rf $PRODUCT_PKG_DIR
584 mkdir $PRODUCT_PKG_DIR
589 if [ x$SAE != x ] ; then
593 echo "Creating SAE packaging directory"
594 mv $APPDIR $PRODUCT_PKG_DIR/Ardour3-SAE.app
595 cp HowToInstallArdourSAE.pdf "$PRODUCT_PKG_DIR/How To Install Ardour SAE.pdf"
596 cp SAE-de-keypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts (keypad).pdf"
597 cp SAE-de-nokeypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts.pdf"
599 elif [ x$MIXBUS != x ] ; then
603 echo "Creating Mixbus packaging directory"
604 mv $APPDIR $PRODUCT_PKG_DIR/
605 DMGBACKGROUND=dmgbgMB
608 echo "Creating $APPNAME packaging directory"
609 mv $APPDIR $PRODUCT_PKG_DIR/
613 if file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q x86_64; then
616 elif file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q ppc; then
624 if test x$WITH_HARRISON_LV2 != x ; then
625 curl -s -S --fail -# \
626 -z "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
627 -o "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
628 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_lv2s.${OSX_BENSID}.zip"
630 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
631 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
632 "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip"
635 if test x$WITH_HARVID != x ; then
636 echo "installing video tools.."
637 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
638 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
640 echo "copying harvid and xjadeo ..."
643 rsync://ardour.org/video-tools/harvid-osx-${HARVID_VERSION}.tgz \
644 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
647 rsync://ardour.org/video-tools/jadeo-${XJADEO_VERSION:1}.dmg \
648 "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg"
651 -C $PRODUCT_PKG_DIR/$APPROOT \
652 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
654 JADEO=$(hdiutil attach "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg" | grep Apple_HFS | grep dev/ | cut -f 3)
655 cp -r "${JADEO}/Jadeo.app" "$PRODUCT_PKG_DIR/"
656 hdiutil detach "${JADEO}"
658 XJCONTENT=${PRODUCT_PKG_DIR}/Jadeo.app/Contents
659 HVLIBS=${PRODUCT_PKG_DIR}/$APPROOT/lib/harvid
661 for file in ${XJCONTENT}/MacOS/Jadeo-bin ${XJCONTENT}/Frameworks/*.dylib ${HVLIBS}/*.dylib ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/*harvid* ; do
662 lipo -extract_family ${OSX_ARCH} ${file} -output ${file}.thin && \
663 mv ${file}.thin ${file}
667 YPOS=$[ $DMGWINBOTTOM - 300 ]
668 XJADEOPOS="set position of item \"Jadeo.app\" of container window to {310, ${YPOS}}"
670 DMGBACKGROUND=${DMGBACKGROUND}xj
673 ################################################################################
674 ### Mixbus plugins, etc
675 if test x$WITH_X42_LV2 != x ; then
676 echo "bundling x42 plugins"
677 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
679 for proj in x42-meters x42-midifilter x42-midimap x42-stereoroute x42-eq setBfree; do
680 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/${proj}.latest.txt)
681 rsync -a -q --partial \
682 rsync://x42-plugins.com/x42/osx/${proj}-lv2-osx-${X42_VERSION}.zip \
683 "$CACHEDIR/${proj}-lv2-osx-${X42_VERSION}.zip"
684 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
685 "$CACHEDIR/${proj}-lv2-osx-${X42_VERSION}.zip"
688 for file in ${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/*/*.dylib ; do
689 lipo -extract_family ${OSX_ARCH} ${file} -output ${file}.thin
690 mv ${file}.thin ${file}
694 if test -n "$MIXBUS"; then
695 echo "deploying harrison channelstrip for $OSX_BENSID"
697 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip"
699 curl -s -S --fail -# \
700 -z "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so" \
701 -o "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so" \
702 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so"
704 cp "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so" \
705 "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip/${HARRISONCHANNELSTRIP}.so"
707 echo "deploying harrison vamp plugins for $OSX_BENSID"
709 curl -s -S --fail -# \
710 -z "${CACHEDIR}/harrison_vamp.${OSX_BENSID}.dylib" \
711 -o "${CACHEDIR}/harrison_vamp.${OSX_BENSID}.dylib" \
712 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_vamp.${OSX_BENSID}.dylib"
714 cp "${CACHEDIR}/harrison_vamp.${OSX_BENSID}.dylib" \
715 "${PRODUCT_PKG_DIR}/${APPROOT}/lib/harrison_vamp.dylib"
717 ################################################################################
719 ( cd $PRODUCT_PKG_DIR ; find . ) > file_list.txt
721 echo "Building DMG ..."
723 # UC_DMG=$APPNAME-${release_version}-UC.dmg
724 # FINAL_DMG=$APPNAME-${release_version}.dmg
726 if [ x$DEBUG = xT ]; then
727 UC_DMG=$APPNAME-$release_version-dbg.dmg
729 UC_DMG=$APPNAME-$release_version.dmg
731 VOLNAME=$APPNAME-$release_version
733 MNTPATH=`mktemp -d -t ardourimg`
734 TMPDMG=`mktemp -t ardour`
735 ICNSTMP=`mktemp -t ardouricon`
737 DMGMEGABYTES=$[ `du -sk "$PRODUCT_PKG_DIR" | cut -f 1` * 1024 / 1048576 + $EXTRA_SPACE_MB ]
739 echo "DMG MB = " $DMGMEGABYTES
741 rm -f $UC_DMG "$TMPDMG" "${TMPDMG}.dmg" "$ICNSTMP"
745 TMPDMG="${TMPDMG}.dmg"
747 trap "rm -rf $MNTPATH $TMPDMG ${TMPDMG}.dmg $ICNSTMP" EXIT
749 hdiutil create -megabytes $DMGMEGABYTES -fs HFS+ -volname "${VOLNAME}" "$TMPDMG"
750 DiskDevice=$(hdid -nomount "$TMPDMG" | grep Apple_HFS | cut -f 1 -d ' ')
751 mount -t hfs -o nobrowse "${DiskDevice}" "${MNTPATH}"
753 cp -r ${PRODUCT_PKG_DIR}/* "${MNTPATH}" || exit
754 mkdir "${MNTPATH}/.background"
755 cp -vi ${DMGBACKGROUND}.png "${MNTPATH}/.background/dmgbg.png"
757 echo "setting DMG background ..."
759 if test $(sw_vers -productVersion | cut -d '.' -f 2) -lt 9; then
763 # OSX 10.9.X and later
764 DISKNAME=`basename "${MNTPATH}"`
768 tell application "Finder"
770 tell disk "${DISKNAME}"
773 set current view of container window to icon view
774 set toolbar visible of container window to false
775 set statusbar visible of container window to false
776 set the bounds of container window to {400, 200, 800, ${DMGWINBOTTOM}}
777 set theViewOptions to the icon view options of container window
778 set arrangement of theViewOptions to not arranged
779 set icon size of theViewOptions to 64
780 set background picture of theViewOptions to file ".background:dmgbg.png"
781 make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
782 set position of item "${APPDIR}" of container window to {90, 100}
783 set position of item "Applications" of container window to {310, 100}
789 update without registering applications
796 chmod -Rf go-w "${MNTPATH}"
800 echo "compressing Image ..."
802 # Umount the image ('eject' above may already have done that)
803 umount "${DiskDevice}" || true
804 hdiutil eject "${DiskDevice}" || true
805 # Create a read-only version, use zlib compression
806 hdiutil convert -format UDZO "${TMPDMG}" -imagekey zlib-level=9 -o "${UC_DMG}"
808 if test $(sw_vers -productVersion | cut -d '.' -f 2) -gt 5; then
809 echo "setting file icon ..."
811 cp ${PRODUCT_PKG_DIR}/$Resources/appIcon.icns ${ICNSTMP}.icns
812 sips -i ${ICNSTMP}.icns
813 DeRez -only icns ${ICNSTMP}.icns > ${ICNSTMP}.rsrc
814 Rez -append ${ICNSTMP}.rsrc -o "$UC_DMG"
815 SetFile -a C "$UC_DMG"
817 rm ${ICNSTMP}.icns ${ICNSTMP}.rsrc
820 rm -rf ${PRODUCT_PKG_DIR}
823 echo "packaging suceeded."