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;
62 PRODUCT_PKG_DIR=Ardour ;
64 --test) SAE= ; WITH_LADSPA=; STRIP= ; shift ;;
67 # specific build flags
70 --noharvid) WITH_HARVID= ; shift ;;
71 --noladspa) WITH_LADSPA= ; shift ;;
72 --nostrip) STRIP= ; shift ;;
73 --sysdeps) PRINT_SYSDEPS=1; shift ;;
74 --nls) WITH_NLS=1 ; shift ;;
78 if test -z "$PRODUCT_PKG_DIR" -o -z "$APPNAME"; then
79 echo "application or product-name was not specified"
83 . ../define_versions.sh
84 echo "Version is $release_version"
85 if [ "x$commit" != "x" ] ; then
86 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
88 info_string="$release_version built on `hostname` by `whoami` on `date`"
90 echo "Info string is $info_string"
92 if [ x$DEBUG = xT ]; then
94 echo "Debug build, strip disabled"
96 if test x$STRIP != x ; then
97 echo "No debug build, strip enabled"
99 echo "No debug build, but strip disabled."
103 # setup directory structure
105 APPDIR=${APPNAME}${major_version}.app
106 APPROOT=$APPDIR/Contents
107 Frameworks=$APPROOT/lib
108 Resources=$APPROOT/Resources
110 # Since this is OS X, don't try to distinguish between etc and shared
111 # (machine dependent and independent data) - just put everything
116 Locale=$Resources/locale
118 # Bundled Plugins live in a top level folder
120 Plugins=$APPROOT/Plugins
121 Surfaces=$Frameworks/surfaces
122 Panners=$Frameworks/panners
123 Backends=$Frameworks/backends
124 MidiMaps=$Shared/midi_maps
125 ExportFormats=$Shared/export
126 Templates=$Shared/templates
127 PatchFiles=$Shared/patchfiles
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
166 # maybe set variables
168 if test x$SAE != x ; then
169 appname="Ardour${major_version}-SAE"
170 EXECUTABLE=${appname}
171 env="$env<key>ARDOUR_SAE</key><string>true</string>"
173 # current default for SAE version is German keyboard layout without a keypad
175 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de-nokeypad</string>"
176 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui_sae.conf</string>"
177 elif test x$MIXBUS != x ; then
179 EXECUTABLE=${appname}${major_version}
180 env="$env<key>ARDOUR_MIXBUS</key><string>true</string>"
182 # current default for MIXBUS version is US keyboard layout without a keypad
184 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>us-nokeypad</string>"
185 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui.conf</string>"
187 appname="Ardour${major_version}"
188 EXECUTABLE=${appname}
192 # if we're not going to bundle JACK, make sure we can find
193 # jack in the places where it might be
196 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>"
197 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
199 env="<key>LSEnvironment</key><dict>$env<key>ARDOUR_BUNDLED</key><string>true</string></dict>"
203 sed -e "s?@ENV@?$env?g" \
204 -e "s?@VERSION@?$release_version?g" \
205 -e "s?@INFOSTRING@?$info_string?g" \
206 -e "s?@IDSUFFIX@?$EXECUTABLE?g" \
207 -e "s?@EXECUTABLE@?$EXECUTABLE?g" < Info.plist.in > Info.plist
209 sed -e "s?@APPNAME@?$appname?" \
210 -e "s?@ENV@?$env?g" \
211 -e "s?@VERSION@?$release_version?g" \
212 -e "s?@INFOSTRING@?$info_string?g" < InfoPlist.strings.in > Resources/InfoPlist.strings || exit 1
216 cp Info.plist $APPROOT
217 cp -R Resources $APPROOT
221 rm -f Resources/InfoPlist.strings
224 # if we build a bundle without jack, then
225 # make the Ardour executable a helper
226 # script that checks to see if JACK is
230 cp startup_script $APPROOT/MacOS/$EXECUTABLE
231 chmod 775 $APPROOT/MacOS/$EXECUTABLE
232 MAIN_EXECUTABLE=Ardour.bin ## used in startup_script
234 echo "Copying ardour executable ...."
235 cp $BUILD_ROOT/gtk2_ardour/ardour-$release_version $APPROOT/MacOS/$MAIN_EXECUTABLE
236 if test x$SAE != x ; then
237 # cp $BUILD_ROOT/gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
238 cp Ardour3-SAE.icns $Resources/appIcon.icns
239 elif test x$MIXBUS != x ; then
240 cp Mixbus.icns $Resources/appIcon.icns
242 cp Ardour.icns $Resources/appIcon.icns
244 cp typeArdour.icns $Resources/
246 set +e # things below are not error-free (optional files etc) :(
249 if test x$WITH_NLS != x ; then
250 echo "NLS support ..."
251 echo "I hope you remembered to run waf i18n"
254 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
255 files=`find ../../$pkg -name "*.mo"`
258 # the package name is appended with a number so that
259 # it can be parallel installed during a regular install
260 # with older (and newer) versions. it is just the major
261 # number of the release (i.e. leading digits)
264 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
266 if [ -z "$files" ]; then
268 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
275 lang=`basename $file | sed 's/\.mo//'`
276 mkdir -p $Locale/$lang/LC_MESSAGES
277 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
278 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
279 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
282 LINGUAS="$LINGUAS $lang"
289 if [ -d $GTKSTACK_ROOT/share/locale/$l ] ; then
290 echo "Copying GTK i18n files for $l..."
291 cp -r $GTKSTACK_ROOT/share/locale/$l $Locale
293 # try with just the language spec
294 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
295 if [ -d $GTKSTACK_ROOT/share/locale/$just_lang ] ; then
296 echo "Copying GTK i18n files for $l..."
297 cp -r $GTKSTACK_ROOT/share/locale/$just_lang $Locale
302 echo "Skipping NLS support"
306 # Copy stuff that may be dynamically loaded
309 cp -R $GTKSTACK_ROOT/etc/* $Etc
310 cp -R $GTKSTACK_ROOT/lib/charset.alias $Resources
312 # We rely on clearlooks, so include a version from our own build tree
313 # this one is special - we will set GTK_PATH to $Frameworks/gtkengines
315 GTK_ENGINE_DIR=$Frameworks/gtkengines/engines
316 mkdir -p $GTK_ENGINE_DIR
318 echo "Copying GTK engines ..."
319 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.dylib $Frameworks
320 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.dylib . && ln -s ../../libclearlooks.dylib libclearlooks.so)
322 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Frameworks
323 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so)
326 if test x$WITH_LADSPA != x ; then
327 if test x$SAE != x ; then
329 elif test x$MIXBUS != x ; then
330 plugdir=mixbus_ladspa
334 if [ -d $plugdir -a "x$(ls $plugdir)" != x ] ; then
335 echo "Copying `ls $plugdir | wc -l` plugins ..."
336 cp -r $plugdir/* $Plugins
340 # Control Surface shared libraries
341 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.dylib $Surfaces
342 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp*.dylib $Frameworks
345 cp $BUILD_ROOT/libs/panners/*/lib*.dylib $Panners
348 for backend in jack wavesaudio dummy coreaudio; do
349 cp $BUILD_ROOT/libs/backends/$backend/lib*.dylib $Backends
352 # Export Formats/Presets
353 for f in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
354 cp "$f" $ExportFormats ;
357 # Session and Route templates
358 #for f in $BUILD_ROOT/../templates/* ; do
359 # if [ -d "$f" ] ; then
360 # cp -r "$f" $Templates ;
365 # got to be careful with names here
366 for x in $BUILD_ROOT/../midi_maps/*.map ; do
371 # got to be careful with names here
372 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
377 # got to be careful with names here
378 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
379 cp "$x" $MackieControl
382 # VAMP plugins that we use
383 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
385 # Suil modules (new dir 'build-stack')
386 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
387 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Frameworks
390 # Suil modules (old dir 'build-ardour-stack')
391 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
392 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Frameworks
395 # VST scanner app and wrapper script, if they exist
396 if test -d $BUILD_ROOT/libs/fst ; then
397 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $Frameworks/
401 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
402 mkdir -p $Frameworks/vfork
403 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $Frameworks/
409 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Panners/*.dylib $Backends/*.dylib $Surfaces/*.dylib $Plugins/*.so ; do
410 if ! file $file | grep -qs Mach-O ; then
413 # libffi contains "S" (other section symbols) that should not be stripped.
414 if [[ $file == *"libffi"* ]] ; then
418 if test x$STRIP != x ; then
419 strip -u -r -arch all $file &>/dev/null
422 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/|libstdc\+\+)" | grep -v 'libjack\.' | grep -v "$(basename $file)"`
424 for dep in $deps ; do
426 if ! test -f $Frameworks/$base; then
427 if echo $dep | grep -sq '^libs' ; then
428 cp $BUILD_ROOT/$dep $Frameworks
436 if test x$missing = xfalse ; then
437 # everything has been found
443 echo "Copying other stuff to $APPDIR ..."
445 #cp $BUILD_ROOT/gtk2_ardour/ergonomic-us.bindings $Resources
447 cp $BUILD_ROOT/gtk2_ardour/mnemonic-us.bindings $Resources
448 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Resources
449 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Resources
450 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Resources
452 # Copied directly from source tree
454 cp ../../system_config $Resources/system_config
455 cp ../../instant.xml $Resources/instant.xml
456 cp ../../gtk2_ardour/step_editing.bindings $Resources
457 cp ../../gtk2_ardour/mixer.bindings $Resources
458 cp -r ../../gtk2_ardour/icons $Resources
459 cp -r ../../gtk2_ardour/pixmaps $Resources
460 cp ../../gtk2_ardour/dark.colors $Resources
461 cp -R ../../gtk2_ardour/splash.png $Shared
462 cp -R ../../gtk2_ardour/small-splash.png $Shared
463 cp -R ../../gtk2_ardour/ArdourMono.ttf $Shared
465 # go through and recursively remove any .svn dirs in the bundle
466 for svndir in `find $APPDIR -name .svn -type dir`; do
470 # install bundled LV2s to <app>/Contents/lib/LV2/
471 cp -R $BUILD_ROOT/libs/LV2 $Frameworks/
473 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
474 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
475 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
476 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
477 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
481 # now fix up the executables
482 echo "Fixing up executable dependency names ..."
483 executables=$MAIN_EXECUTABLE
484 if test x$SAE != x ; then
485 executables="$executables"
488 for exe in $executables; do
489 EXE=$APPROOT/MacOS/$exe
491 for lib in `otool -L $EXE | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/|libstdc\+\+)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
493 changes="$changes -change $lib @executable_path/../lib/$base"
495 if test "x$changes" != "x" ; then
496 install_name_tool $changes $EXE
500 echo "Fixing up library names ..."
501 # now do the same for all the libraries we include
502 for libdir in $Frameworks $Frameworks/modules $Surfaces $Panners $Backends ; do
504 libbase=`basename $libdir`
506 for dylib in $libdir/*.dylib $libdir/*.so ; do
510 if test -L $dylib ; then
514 # change all the dependencies
517 for lib in `otool -L $dylib | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/|libstdc\+\+)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
519 if echo $lib | grep -s libbase; then
520 changes="$changes -change $lib @executable_path/../$libbase/$base"
522 changes="$changes -change $lib @executable_path/../lib/$base"
526 if test "x$changes" != x ; then
527 if install_name_tool $changes $dylib ; then
534 # now the change what the library thinks its own name is
536 base=`basename $dylib`
537 install_name_tool -id @executable_path/../$libbase/$base $dylib
542 # and now ... the DMG
545 rm -rf $PRODUCT_PKG_DIR
546 mkdir $PRODUCT_PKG_DIR
551 if [ x$SAE != x ] ; then
555 echo "Creating SAE packaging directory"
556 mv $APPDIR $PRODUCT_PKG_DIR/Ardour3-SAE.app
557 cp HowToInstallArdourSAE.pdf "$PRODUCT_PKG_DIR/How To Install Ardour SAE.pdf"
558 cp SAE-de-keypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts (keypad).pdf"
559 cp SAE-de-nokeypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts.pdf"
561 elif [ x$MIXBUS != x ] ; then
565 echo "Creating Mixbus packaging directory"
566 mv $APPDIR $PRODUCT_PKG_DIR/
567 DMGBACKGROUND=dmgbgMB
570 echo "Creating $APPNAME packaging directory"
571 mv $APPDIR $PRODUCT_PKG_DIR/
575 if file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q x86_64; then
578 elif file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q ppc; then
585 if test x$WITH_HARRISON_LV2 != x ; then
586 curl -s -S --fail -# \
587 -z "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
588 -o "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
589 http://www.harrisonconsoles.com/mixbus/mb3/${OSX_BENSID}/harrison_lv2s.zip
591 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
592 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
593 "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip"
596 if test x$WITH_HARVID != x ; then
597 echo "installing video tools.."
598 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
599 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
601 echo "copying harvid and xjadeo ..."
604 rsync://ardour.org/video-tools/harvid-osx-${HARVID_VERSION}.tgz \
605 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
608 rsync://ardour.org/video-tools/jadeo-${XJADEO_VERSION:1}.dmg \
609 "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg"
612 -C $PRODUCT_PKG_DIR/$APPROOT \
613 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
615 JADEO=$(hdiutil attach "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg" | grep Apple_HFS | grep dev/ | cut -f 3)
616 cp -r "${JADEO}/Jadeo.app" "$PRODUCT_PKG_DIR/"
617 hdiutil detach "${JADEO}"
619 XJCONTENT=${PRODUCT_PKG_DIR}/Jadeo.app/Contents
620 HVLIBS=${PRODUCT_PKG_DIR}/$APPROOT/lib/harvid
622 for file in ${XJCONTENT}/MacOS/Jadeo-bin ${XJCONTENT}/Frameworks/*.dylib ${HVLIBS}/*.dylib ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/*harvid* ; do
623 lipo -thin ${OSX_ARCH} ${file} -output ${file}.thin
624 mv ${file}.thin ${file}
628 YPOS=$[ $DMGWINBOTTOM - 300 ]
629 XJADEOPOS="set position of item \"Jadeo.app\" of container window to {310, ${YPOS}}"
631 DMGBACKGROUND=${DMGBACKGROUND}xj
634 ################################################################################
635 ### Mixbus plugins, etc
636 if test x$WITH_X42_LV2 != x ; then
637 echo "bundling x42 plugins"
638 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
640 METERS_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/x42-meters.latest.txt)
641 rsync -a -q --partial \
642 rsync://x42-plugins.com/x42/osx/x42-meters-lv2-osx-${METERS_VERSION}.zip \
643 "$CACHEDIR/x42-meters-lv2-osx-${METERS_VERSION}.zip"
644 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
645 "$CACHEDIR/x42-meters-lv2-osx-${METERS_VERSION}.zip"
647 SETBFREE_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/setBfree.latest.txt)
648 rsync -a -q --partial \
649 rsync://x42-plugins.com/x42/osx/setBfree-lv2-osx-${SETBFREE_VERSION}.zip \
650 "$CACHEDIR/setBfree-lv2-osx-${SETBFREE_VERSION}.zip"
651 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
652 "$CACHEDIR/setBfree-lv2-osx-${SETBFREE_VERSION}.zip"
654 MIDIFILTER_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/x42-midifilter.latest.txt)
655 rsync -a -q --partial \
656 rsync://x42-plugins.com/x42/osx/x42-midifilter-lv2-osx-${MIDIFILTER_VERSION}.zip \
657 "$CACHEDIR/x42-midifilter-lv2-osx-${MIDIFILTER_VERSION}.zip"
658 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
659 "$CACHEDIR/x42-midifilter-lv2-osx-${MIDIFILTER_VERSION}.zip"
661 for file in ${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/*/*.dylib ; do
662 lipo -thin ${OSX_ARCH} ${file} -output ${file}.thin
663 mv ${file}.thin ${file}
667 if test -n "$MIXBUS"; then
668 echo "deploying harrison tools for $OSX_BENSID"
670 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip"
672 curl -s -S --fail -# \
673 -z "${CACHEDIR}/harrison_channelstrip.${OSX_BENSID}.so" \
674 -o "${CACHEDIR}/harrison_channelstrip.${OSX_BENSID}.so" \
675 http://www.harrisonconsoles.com/mixbus/mb3/${OSX_BENSID}/harrison_channelstrip.so
677 cp "${CACHEDIR}/harrison_channelstrip.${OSX_BENSID}.so" \
678 "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip/harrison_channelstrip.so"
680 ################################################################################
682 ( cd $PRODUCT_PKG_DIR ; find . ) > file_list.txt
684 echo "Building DMG ..."
686 # UC_DMG=$APPNAME-${release_version}-UC.dmg
687 # FINAL_DMG=$APPNAME-${release_version}.dmg
689 if [ x$DEBUG = xT ]; then
690 UC_DMG=$APPNAME-$release_version-dbg.dmg
692 UC_DMG=$APPNAME-$release_version.dmg
694 VOLNAME=$APPNAME-$release_version
696 MNTPATH=`mktemp -d -t ardourimg`
697 TMPDMG=`mktemp -t ardour`
698 ICNSTMP=`mktemp -t ardouricon`
700 DMGMEGABYTES=$[ `du -sk "$PRODUCT_PKG_DIR" | cut -f 1` * 1024 / 1048576 + $EXTRA_SPACE_MB ]
702 echo "DMG MB = " $DMGMEGABYTES
704 rm -f $UC_DMG "$TMPDMG" "${TMPDMG}.dmg" "$ICNSTMP"
708 TMPDMG="${TMPDMG}.dmg"
710 trap "rm -rf $MNTPATH $TMPDMG ${TMPDMG}.dmg $ICNSTMP" EXIT
712 hdiutil create -megabytes $DMGMEGABYTES "$TMPDMG"
713 DiskDevice=$(hdid -nomount "$TMPDMG" | grep Apple_HFS | cut -f 1 -d ' ')
714 newfs_hfs -v "${VOLNAME}" "${DiskDevice}"
715 mount -t hfs -o nobrowse "${DiskDevice}" "${MNTPATH}"
717 cp -r ${PRODUCT_PKG_DIR}/* "${MNTPATH}" || exit
718 mkdir "${MNTPATH}/.background"
719 cp -vi ${DMGBACKGROUND}.png "${MNTPATH}/.background/dmgbg.png"
721 echo "setting DMG background ..."
723 if test $(sw_vers -productVersion | cut -d '.' -f 2) -lt 9; then
727 # OSX 10.9.X and later
728 DISKNAME=`basename "${MNTPATH}"`
732 tell application "Finder"
734 tell disk "${DISKNAME}"
737 set current view of container window to icon view
738 set toolbar visible of container window to false
739 set statusbar visible of container window to false
740 set the bounds of container window to {400, 200, 800, ${DMGWINBOTTOM}}
741 set theViewOptions to the icon view options of container window
742 set arrangement of theViewOptions to not arranged
743 set icon size of theViewOptions to 64
744 set background picture of theViewOptions to file ".background:dmgbg.png"
745 make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
746 set position of item "${APPDIR}" of container window to {90, 100}
747 set position of item "Applications" of container window to {310, 100}
753 update without registering applications
760 chmod -Rf go-w "${MNTPATH}"
764 echo "compressing Image ..."
766 # Umount the image ('eject' above may already have done that)
767 umount "${DiskDevice}" || true
768 hdiutil eject "${DiskDevice}" || true
769 # Create a read-only version, use zlib compression
770 hdiutil convert -format UDZO "${TMPDMG}" -imagekey zlib-level=9 -o "${UC_DMG}"
772 if test $(sw_vers -productVersion | cut -d '.' -f 2) -gt 5; then
773 echo "setting file icon ..."
775 cp ${PRODUCT_PKG_DIR}/$Resources/appIcon.icns ${ICNSTMP}.icns
776 sips -i ${ICNSTMP}.icns
777 DeRez -only icns ${ICNSTMP}.icns > ${ICNSTMP}.rsrc
778 Rez -append ${ICNSTMP}.rsrc -o "$UC_DMG"
779 SetFile -a C "$UC_DMG"
781 rm ${ICNSTMP}.icns ${ICNSTMP}.rsrc
784 rm -rf ${PRODUCT_PKG_DIR}
787 echo "packaging suceeded."