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 : ${HARRISONCHANNELSTRIP=harrison_channelstrip}
29 . ../define_versions.sh
31 while [ $# -gt 0 ] ; do
36 # top level build targets
42 PRODUCT_PKG_DIR=ArdourSAE ;
51 PRODUCT_PKG_DIR=Mixbus;
54 --mixbus32c) MIXBUS=1;
61 PRODUCT_PKG_DIR=Mixbus32C;
62 APPNAME=Mixbus32C-${major_version} ;
69 PRODUCT_PKG_DIR=Ardour;
74 PRODUCT_PKG_DIR=Ardour ;
76 --test) SAE= ; STRIP= ; shift ;;
79 # specific build flags
82 --noharvid) WITH_HARVID= ; shift ;;
83 --nostrip) STRIP= ; shift ;;
84 --sysdeps) PRINT_SYSDEPS=1; shift ;;
85 --nls) WITH_NLS=1 ; shift ;;
86 --chanstrip) HARRISONCHANNELSTRIP=$2 ; shift; shift ;;
90 if test -z "$PRODUCT_PKG_DIR" -o -z "$APPNAME"; then
91 echo "application or product-name was not specified"
95 echo "Version is $release_version"
96 if [ "x$commit" != "x" ] ; then
97 info_string="$release_version ($commit) built on `hostname` by `whoami` on `date`"
99 info_string="$release_version built on `hostname` by `whoami` on `date`"
101 echo "Info string is $info_string"
103 if [ x$DEBUG = xT ]; then
105 echo "Debug build, strip disabled"
107 if test x$STRIP != x ; then
108 echo "No debug build, strip enabled"
110 echo "No debug build, but strip disabled."
114 # setup directory structure
116 APPDIR=${APPNAME}${major_version}.app
117 APPROOT=$APPDIR/Contents
118 Frameworks=$APPROOT/lib
119 Resources=$APPROOT/Resources
121 # Since this is OS X, don't try to distinguish between etc and shared
122 # (machine dependent and independent data) - just put everything
127 Locale=$Resources/locale
129 # Bundled Plugins live in a top level folder
131 Plugins=$APPROOT/Plugins
132 Surfaces=$Frameworks/surfaces
133 Panners=$Frameworks/panners
134 Backends=$Frameworks/backends
135 MidiMaps=$Shared/midi_maps
136 ExportFormats=$Shared/export
137 Templates=$Shared/templates
138 PatchFiles=$Shared/patchfiles
139 LuaScripts=$Shared/scripts
140 MackieControl=$Shared/mcp
141 Themes=$Shared/themes
143 if [ x$PRINT_SYSDEPS != x ] ; then
145 # print system dependencies
148 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
149 if ! file $file | grep -qs Mach-O ; then
152 otool -L $file | awk '{print $1}' | egrep -v "(^@executable_path|^Ardour[0-9][.0-9]*.app)"
157 echo "Removing old $APPDIR tree ..."
161 echo "Building new app directory structure ..."
163 # only bother to make the longest paths
165 mkdir -p $APPROOT/MacOS
166 mkdir -p $APPROOT/Resources
172 mkdir -p $ExportFormats
174 mkdir -p $Frameworks/modules
176 mkdir -p $MackieControl
181 # maybe set variables
183 if test x$SAE != x ; then
184 appname="Ardour${major_version}-SAE"
185 EXECUTABLE=${appname}
186 env="$env<key>ARDOUR_SAE</key><string>true</string>"
188 # current default for SAE version is German keyboard layout without a keypad
190 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>de-nokeypad</string>"
191 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui_sae.conf</string>"
192 elif test x$MIXBUS != x ; then
194 EXECUTABLE=${appname}${major_version}
195 env="$env<key>ARDOUR_MIXBUS</key><string>true</string>"
197 # current default for MIXBUS version is US keyboard layout without a keypad
199 env="$env<key>ARDOUR_KEYBOARD_LAYOUT</key><string>us-nokeypad</string>"
200 env="$env<key>ARDOUR_UI_CONF</key><string>ardour3_ui.conf</string>"
202 appname="Ardour${major_version}"
203 EXECUTABLE=${appname}
207 # if we're not going to bundle JACK, make sure we can find
208 # jack in the places where it might be
211 env="$env<key>PATH</key><string>/usr/local/bin:/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>"
212 env="$env<key>DYLIB_FALLBACK_LIBRARY_PATH</key><string>/usr/local/lib:/opt/lib</string>"
214 env="<key>LSEnvironment</key><dict>$env<key>ARDOUR_BUNDLED</key><string>true</string></dict>"
218 sed -e "s?@ENV@?$env?g" \
219 -e "s?@VERSION@?$release_version?g" \
220 -e "s?@INFOSTRING@?$info_string?g" \
221 -e "s?@IDSUFFIX@?$EXECUTABLE?g" \
222 -e "s?@BUNDLENAME@?${APPNAME}${major_version}?g" \
223 -e "s?@EXECUTABLE@?$EXECUTABLE?g" < Info.plist.in > Info.plist
225 sed -e "s?@APPNAME@?$appname?" \
226 -e "s?@ENV@?$env?g" \
227 -e "s?@VERSION@?$release_version?g" \
228 -e "s?@INFOSTRING@?$info_string?g" < InfoPlist.strings.in > Resources/InfoPlist.strings || exit 1
232 cp Info.plist $APPROOT
233 cp -R Resources $APPROOT
237 rm -f Resources/InfoPlist.strings
240 # if we build a bundle without jack, then
241 # make the Ardour executable a helper
242 # script that checks to see if JACK is
246 cp startup_script $APPROOT/MacOS/$EXECUTABLE
247 chmod 775 $APPROOT/MacOS/$EXECUTABLE
248 MAIN_EXECUTABLE=Ardour.bin ## used in startup_script
250 echo "Copying ardour executable ...."
251 cp $BUILD_ROOT/gtk2_ardour/ardour-$release_version $APPROOT/MacOS/$MAIN_EXECUTABLE
252 if test x$SAE != x ; then
253 # cp $BUILD_ROOT/gtk2_ardour/evtest $APPROOT/MacOS/gtkevents
254 cp Ardour3-SAE.icns $Resources/appIcon.icns
255 elif test x$MIXBUS32C != x ; then
256 cp Mixbus32C.icns $Resources/appIcon.icns
257 elif test x$MIXBUS != x ; then
258 cp Mixbus.icns $Resources/appIcon.icns
260 cp Ardour.icns $Resources/appIcon.icns
262 cp typeArdour.icns $Resources/
264 set +e # things below are not error-free (optional files etc) :(
267 if test x$WITH_NLS != x ; then
268 echo "NLS support ..."
269 echo "I hope you remembered to run waf i18n"
272 for pkg in gtk2_ardour libs/ardour libs/gtkmm2ext ; do
273 files=`find ../../$pkg -name "*.mo"`
276 # the package name is appended with a number so that
277 # it can be parallel installed during a regular install
278 # with older (and newer) versions. it is just the major
279 # number of the release (i.e. leading digits)
282 vsuffix=`echo $release_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
284 if [ -z "$files" ]; then
286 echo "!!!! WARNING !!!! - Did not find any .mo files in ../../$pkg"
293 lang=`basename $file | sed 's/\.mo//'`
294 mkdir -p $Locale/$lang/LC_MESSAGES
295 cp $file $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
296 echo copy $file to $Locale/$lang/LC_MESSAGES/`basename $pkg`$vsuffix.mo
297 if echo $LINGUAS | grep $lang >/dev/null 2>&1 ; then
300 LINGUAS="$LINGUAS $lang"
307 if [ -d $GTKSTACK_ROOT/share/locale/$l ] ; then
308 echo "Copying GTK i18n files for $l..."
309 cp -r $GTKSTACK_ROOT/share/locale/$l $Locale
311 # try with just the language spec
312 just_lang=`echo $l | sed 's/_[A-Z][A-Z]$//'`
313 if [ -d $GTKSTACK_ROOT/share/locale/$just_lang ] ; then
314 echo "Copying GTK i18n files for $l..."
315 cp -r $GTKSTACK_ROOT/share/locale/$just_lang $Locale
320 echo "Skipping NLS support"
324 # Copy stuff that may be dynamically loaded
327 cp -R $GTKSTACK_ROOT/etc/* $Etc
328 cp -R $GTKSTACK_ROOT/lib/charset.alias $Resources
330 # We rely on clearlooks, so include a version from our own build tree
331 # this one is special - we will set GTK_PATH to $Frameworks/gtkengines
333 GTK_ENGINE_DIR=$Frameworks/gtkengines/engines
334 mkdir -p $GTK_ENGINE_DIR
336 echo "Copying GTK engines ..."
337 cp $BUILD_ROOT/libs/clearlooks-newer/libclearlooks.dylib $Frameworks
338 (cd $GTK_ENGINE_DIR && ln -s ../../libclearlooks.dylib . && ln -s ../../libclearlooks.dylib libclearlooks.so)
340 cp $GTKSTACK_ROOT/lib/gtk-2.0/2.10.0/engines/libpixmap.so $Frameworks
341 (cd $GTK_ENGINE_DIR && ln -s ../../libpixmap.so)
344 # Control Surface shared libraries
345 cp $BUILD_ROOT/libs/surfaces/*/libardour_*.dylib $Surfaces
346 cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp*.dylib $Frameworks
349 cp $BUILD_ROOT/libs/panners/*/lib*.dylib $Panners
352 for backend in jack wavesaudio dummy coreaudio; do
353 cp $BUILD_ROOT/libs/backends/$backend/lib*.dylib $Backends
356 # Export Formats/Presets
357 for f in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do
358 cp "$f" $ExportFormats ;
361 # Session and Route templates
362 #for f in $BUILD_ROOT/../templates/* ; do
363 # if [ -d "$f" ] ; then
364 # cp -r "$f" $Templates ;
369 # got to be careful with names here
370 for x in $BUILD_ROOT/../midi_maps/*.map ; do
375 # got to be careful with names here
376 for x in $BUILD_ROOT/../patchfiles/*.midnam ; do
381 # got to be careful with names here
382 for x in $BUILD_ROOT/../scripts/*.lua ; do
384 if test "${BN:0:1}" = "_"; then
391 # got to be careful with names here
392 for x in $BUILD_ROOT/../mcp/*.device $BUILD_ROOT/../mcp/*.profile ; do
393 cp "$x" $MackieControl
396 # VAMP plugins that we use
397 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
399 # Suil modules (new dir 'build-stack')
400 if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
401 cp $GTKSTACK_ROOT/lib/suil-0/lib* $Frameworks
404 # Suil modules (old dir 'build-ardour-stack')
405 if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
406 cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Frameworks
409 # VST scanner app and wrapper script, if they exist
410 if test -d $BUILD_ROOT/libs/fst ; then
411 cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $Frameworks/
415 if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
416 mkdir -p $Frameworks/vfork
417 cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $Frameworks/
420 # TODO check if this is still needed, even when building on 10.5
421 if file $BUILD_ROOT/gtk2_ardour/ardour-$release_version | grep -q ppc; then
422 STDCPP='|libstdc\+\+'
429 for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Panners/*.dylib $Backends/*.dylib $Surfaces/*.dylib $Plugins/*.so ; do
430 if ! file $file | grep -qs Mach-O ; then
433 # libffi contains "S" (other section symbols) that should not be stripped.
434 if [[ $file == *"libffi"* ]] ; then
438 if test x$STRIP != x ; then
439 strip -u -r -arch all $file &>/dev/null
442 deps=`otool -L $file | awk '{print $1}' | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | grep -v 'libjack\.' | grep -v "$(basename $file)"`
444 for dep in $deps ; do
446 if ! test -f $Frameworks/$base; then
447 if echo $dep | grep -sq '^libs' ; then
448 cp $BUILD_ROOT/$dep $Frameworks
456 if test x$missing = xfalse ; then
457 # everything has been found
463 echo "Copying other stuff to $APPDIR ..."
465 cp $BUILD_ROOT/gtk2_ardour/ardour.keys $Resources
466 cp $BUILD_ROOT/gtk2_ardour/ardour.menus $Resources
467 cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Resources
468 cp $BUILD_ROOT/gtk2_ardour/clearlooks.rc $Resources
470 # Copied directly from source tree
472 mkdir ${Resources}/icons
473 mkdir ${Resources}/resources
474 cp ../../system_config $Resources/system_config
475 cp ../../instant.xml $Resources/instant.xml
476 cp ../../gtk2_ardour/icons/*.png ${Resources}/icons/
477 cp -r ../../gtk2_ardour/icons/cursor_* ${Resources}/icons/
478 cp ../../gtk2_ardour/ArdourMono.ttf $Shared
479 cp ../../gtk2_ardour/resources/${PRODUCT_PKG_DIR}-* ${Resources}/resources/
482 # Themes: only install those named for this app
483 lower_case_appname=`echo $APPNAME | tr '[:upper:]' '[:lower:]'`
484 cp ../../gtk2_ardour/themes/*-${lower_case_appname}.colors $Themes
486 # go through and recursively remove any .svn dirs in the bundle
487 for svndir in `find $APPDIR -name .svn -type dir`; do
491 # install bundled LV2s to <app>/Contents/lib/LV2/
492 cp -R $BUILD_ROOT/libs/LV2 $Frameworks/
494 # lv2 core, classifications etc - TODO check if we need the complete LV2 ontology
495 if test -d $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
496 cp -R $ARDOURSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
497 elif test -d $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 ; then
498 cp -R $GTKSTACK_ROOT/lib/lv2/lv2core.lv2 $Frameworks/LV2/
502 # now fix up the executables
503 echo "Fixing up executable dependency names ..."
504 executables=$MAIN_EXECUTABLE
505 if test x$SAE != x ; then
506 executables="$executables"
509 for exe in $executables; do
510 EXE=$APPROOT/MacOS/$exe
512 for lib in `otool -L $EXE | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
514 changes="$changes -change $lib @executable_path/../lib/$base"
516 if test "x$changes" != "x" ; then
517 install_name_tool $changes $EXE
521 echo "Fixing up library names ..."
522 # now do the same for all the libraries we include
523 for libdir in $Frameworks $Frameworks/modules $Surfaces $Panners $Backends $Frameworks/LV2/* ; do
525 libbase=`basename $libdir`
527 for dylib in $libdir/*.dylib $libdir/*.so ; do
531 if test -L $dylib ; then
535 # change all the dependencies
538 for lib in `otool -L $dylib | egrep "($GTKSTACK_ROOT|$ARDOURSTACK_ROOT|/opt/|/local/|libs/$STDCPP)" | awk '{print $1}' | grep -v 'libjack\.'` ; do
540 if echo $lib | grep -s libbase; then
541 changes="$changes -change $lib @executable_path/../$libbase/$base"
543 changes="$changes -change $lib @executable_path/../lib/$base"
547 if test "x$changes" != x ; then
548 if install_name_tool $changes $dylib ; then
555 # now the change what the library thinks its own name is
557 base=`basename $dylib`
558 install_name_tool -id @executable_path/../$libbase/$base $dylib
563 # and now ... the DMG
566 rm -rf $PRODUCT_PKG_DIR
567 mkdir $PRODUCT_PKG_DIR
572 if [ x$SAE != x ] ; then
576 echo "Creating SAE packaging directory"
577 mv $APPDIR $PRODUCT_PKG_DIR/Ardour3-SAE.app
578 cp HowToInstallArdourSAE.pdf "$PRODUCT_PKG_DIR/How To Install Ardour SAE.pdf"
579 cp SAE-de-keypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts (keypad).pdf"
580 cp SAE-de-nokeypad.pdf "$PRODUCT_PKG_DIR/Ardour SAE Shortcuts.pdf"
582 elif [ x$MIXBUS != x ] ; then
586 echo "Creating Mixbus packaging directory"
587 mv $APPDIR $PRODUCT_PKG_DIR/
588 DMGBACKGROUND=dmgbgMB
591 echo "Creating $APPNAME packaging directory"
592 mv $APPDIR $PRODUCT_PKG_DIR/
596 if file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q x86_64; then
599 elif file ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/$MAIN_EXECUTABLE | grep -q ppc; then
607 if test x$WITH_HARRISON_LV2 != x ; then
608 curl -s -S --fail -# \
609 -z "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
610 -o "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip" \
611 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_lv2s.${OSX_BENSID}.zip"
613 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
614 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
615 "${CACHEDIR}/harrison_lv2s.${OSX_BENSID}.zip"
618 if test x$WITH_HARVID != x ; then
619 echo "installing video tools.."
620 HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
621 XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
623 echo "copying harvid and xjadeo ..."
626 rsync://ardour.org/video-tools/harvid-osx-${HARVID_VERSION}.tgz \
627 "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz"
630 rsync://ardour.org/video-tools/jadeo-${XJADEO_VERSION:1}.dmg \
631 "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg"
634 -C $PRODUCT_PKG_DIR/$APPROOT \
635 -f "$CACHEDIR/harvid-${MULTIARCH}-${HARVID_VERSION}.tgz" || exit 1
637 JADEO=$(hdiutil attach "$CACHEDIR/jadeo-${XJADEO_VERSION:1}.dmg" | grep Apple_HFS | grep dev/ | cut -f 3)
638 cp -r "${JADEO}/Jadeo.app" "$PRODUCT_PKG_DIR/"
639 hdiutil detach "${JADEO}"
641 XJCONTENT=${PRODUCT_PKG_DIR}/Jadeo.app/Contents
642 HVLIBS=${PRODUCT_PKG_DIR}/$APPROOT/lib/harvid
644 for file in ${XJCONTENT}/MacOS/Jadeo-bin ${XJCONTENT}/Frameworks/*.dylib ${HVLIBS}/*.dylib ${PRODUCT_PKG_DIR}/$APPROOT/MacOS/*harvid* ; do
645 lipo -extract_family ${OSX_ARCH} ${file} -output ${file}.thin && \
646 mv ${file}.thin ${file}
650 YPOS=$[ $DMGWINBOTTOM - 300 ]
651 XJADEOPOS="set position of item \"Jadeo.app\" of container window to {310, ${YPOS}}"
653 DMGBACKGROUND=${DMGBACKGROUND}xj
656 ################################################################################
657 ### Mixbus plugins, etc
658 if test x$WITH_X42_LV2 != x ; then
659 echo "bundling x42 plugins"
660 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2"
662 for proj in x42-meters x42-midifilter x42-midimap x42-stereoroute x42-eq setBfree; do
663 X42_VERSION=$(curl -s -S http://x42-plugins.com/x42/osx/${proj}.latest.txt)
664 rsync -a -q --partial \
665 rsync://x42-plugins.com/x42/osx/${proj}-lv2-osx-${X42_VERSION}.zip \
666 "$CACHEDIR/${proj}-lv2-osx-${X42_VERSION}.zip"
667 bsdtar -C "${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/" -xf \
668 "$CACHEDIR/${proj}-lv2-osx-${X42_VERSION}.zip"
671 for file in ${PRODUCT_PKG_DIR}/${APPROOT}/lib/LV2/*/*.dylib ; do
672 lipo -extract_family ${OSX_ARCH} ${file} -output ${file}.thin
673 mv ${file}.thin ${file}
677 if test -n "$MIXBUS"; then
678 echo "deploying harrison channelstrip for $OSX_BENSID"
680 mkdir -p "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip"
682 curl -s -S --fail -# \
683 -z "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so" \
684 -o "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so" \
685 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so"
687 cp "${CACHEDIR}/${HARRISONCHANNELSTRIP}.${OSX_BENSID}.so" \
688 "${PRODUCT_PKG_DIR}/${APPROOT}/lib/ladspa/strip/${HARRISONCHANNELSTRIP}.so"
690 echo "deploying harrison vamp plugins for $OSX_BENSID"
692 curl -s -S --fail -# \
693 -z "${CACHEDIR}/harrison_vamp.${OSX_BENSID}.dylib" \
694 -o "${CACHEDIR}/harrison_vamp.${OSX_BENSID}.dylib" \
695 "http://www.harrisonconsoles.com/mixbus/mb3/beta/harrison-dsp/harrison_vamp.${OSX_BENSID}.dylib"
697 cp "${CACHEDIR}/harrison_vamp.${OSX_BENSID}.dylib" \
698 "${PRODUCT_PKG_DIR}/${APPROOT}/lib/harrison_vamp.dylib"
700 ################################################################################
702 ( cd $PRODUCT_PKG_DIR ; find . ) > file_list.txt
704 echo "Building DMG ..."
706 # UC_DMG=$APPNAME-${release_version}-UC.dmg
707 # FINAL_DMG=$APPNAME-${release_version}.dmg
709 if [ x$DEBUG = xT ]; then
710 UC_DMG=$APPNAME-$release_version-dbg.dmg
712 UC_DMG=$APPNAME-$release_version.dmg
714 VOLNAME=$APPNAME-$release_version
716 MNTPATH=`mktemp -d -t ardourimg`
717 TMPDMG=`mktemp -t ardour`
718 ICNSTMP=`mktemp -t ardouricon`
720 DMGMEGABYTES=$[ `du -sk "$PRODUCT_PKG_DIR" | cut -f 1` * 1024 / 1048576 + $EXTRA_SPACE_MB ]
722 echo "DMG MB = " $DMGMEGABYTES
724 rm -f $UC_DMG "$TMPDMG" "${TMPDMG}.dmg" "$ICNSTMP"
728 TMPDMG="${TMPDMG}.dmg"
730 trap "rm -rf $MNTPATH $TMPDMG ${TMPDMG}.dmg $ICNSTMP" EXIT
732 hdiutil create -megabytes $DMGMEGABYTES -fs HFS+ -volname "${VOLNAME}" "$TMPDMG"
733 DiskDevice=$(hdid -nomount "$TMPDMG" | grep Apple_HFS | cut -f 1 -d ' ')
734 mount -t hfs -o nobrowse "${DiskDevice}" "${MNTPATH}"
736 cp -r ${PRODUCT_PKG_DIR}/* "${MNTPATH}" || exit
737 mkdir "${MNTPATH}/.background"
738 cp -vi ${DMGBACKGROUND}.png "${MNTPATH}/.background/dmgbg.png"
740 echo "setting DMG background ..."
742 if test $(sw_vers -productVersion | cut -d '.' -f 2) -lt 9; then
746 # OSX 10.9.X and later
747 DISKNAME=`basename "${MNTPATH}"`
751 tell application "Finder"
753 tell disk "${DISKNAME}"
756 set current view of container window to icon view
757 set toolbar visible of container window to false
758 set statusbar visible of container window to false
759 set the bounds of container window to {400, 200, 800, ${DMGWINBOTTOM}}
760 set theViewOptions to the icon view options of container window
761 set arrangement of theViewOptions to not arranged
762 set icon size of theViewOptions to 64
763 set background picture of theViewOptions to file ".background:dmgbg.png"
764 make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
765 set position of item "${APPDIR}" of container window to {90, 100}
766 set position of item "Applications" of container window to {310, 100}
772 update without registering applications
779 chmod -Rf go-w "${MNTPATH}"
783 echo "compressing Image ..."
785 # Umount the image ('eject' above may already have done that)
786 umount "${DiskDevice}" || true
787 hdiutil eject "${DiskDevice}" || true
788 # Create a read-only version, use zlib compression
789 hdiutil convert -format UDZO "${TMPDMG}" -imagekey zlib-level=9 -o "${UC_DMG}"
791 if test $(sw_vers -productVersion | cut -d '.' -f 2) -gt 5; then
792 echo "setting file icon ..."
794 cp ${PRODUCT_PKG_DIR}/$Resources/appIcon.icns ${ICNSTMP}.icns
795 sips -i ${ICNSTMP}.icns
796 DeRez -only icns ${ICNSTMP}.icns > ${ICNSTMP}.rsrc
797 Rez -append ${ICNSTMP}.rsrc -o "$UC_DMG"
798 SetFile -a C "$UC_DMG"
800 rm ${ICNSTMP}.icns ${ICNSTMP}.rsrc
803 rm -rf ${PRODUCT_PKG_DIR}
806 echo "packaging suceeded."