Merge branch 'plugin-automation'
[ardour.git] / tools / osx_packaging / osx_build
index ad45651b93261d0912e492fe165934e2f62565dd..ba503d14c7ff40db95d4395c88bbf40ee23ed4ab 100755 (executable)
@@ -8,8 +8,9 @@ BUILD_ROOT=../../build
 
 # where harvid and xjadeo binaries are cached
 if test -z "$CACHEDIR" -o ! -d "$CACHEDIR"; then
-       CACHEDIR=`pwd`
+       CACHEDIR=/var/tmp
 fi
+mkdir -p "$CACHEDIR"
 
 SAE=
 MIXBUS=
@@ -109,13 +110,14 @@ ExportFormats=$Shared/export
 Templates=$Shared/templates
 PatchFiles=$Shared/patchfiles
 MackieControl=$Shared/mcp
+VFork=$Frameworks/vfork
 
 if [ x$PRINT_SYSDEPS != x ] ; then
 #
 # print system dependencies
 #
 
-    for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do 
+for file in $APPROOT/MacOS/* $Frameworks/* $Frameworks/modules/* $Plugins/*.so ; do
        if ! file $file | grep -qs Mach-O ; then
            continue
        fi
@@ -144,6 +146,8 @@ mkdir -p $Templates
 mkdir -p $Frameworks/modules
 mkdir -p $Etc
 mkdir -p $MackieControl
+mkdir -p $PatchFiles
+mkdir -p $VFork
 
 # maybe set variables
 env=""
@@ -194,6 +198,10 @@ sed -e "s?@APPNAME@?$appname?" \
 cp Info.plist $APPROOT
 cp -R Resources $APPROOT
 
+# ..and clean up
+rm -f Info.plist
+rm -f Resources/InfoPlist.strings
+
 #
 # if we build a bundle without jack, then
 # make the Ardour3 executable a helper
@@ -336,7 +344,9 @@ cp $BUILD_ROOT/libs/surfaces/control_protocol/libardourcp*.dylib $Frameworks
 cp $BUILD_ROOT/libs/panners/*/lib*.dylib $Panners
 
 # Backends
-cp $BUILD_ROOT/libs/backends/*/lib*.dylib $Backends
+for backend in jack wavesaudio dummy; do
+    cp $BUILD_ROOT/libs/backends/$backend/lib*.dylib $Backends
+done
 
 # Export Formats/Presets
 for f in $BUILD_ROOT/../export/*.preset $BUILD_ROOT/../export/*.format ; do 
@@ -371,14 +381,26 @@ done
 # VAMP plugins that we use
 cp $BUILD_ROOT/libs/vamp-plugins/libardourvampplugins.dylib $Frameworks
 
-# Suil modules
-cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Frameworks
+# Suil modules (new dir 'build-stack')
+if test -d $GTKSTACK_ROOT/lib/suil-0/ ; then
+    cp $GTKSTACK_ROOT/lib/suil-0/lib* $Frameworks
+fi
+
+# Suil modules (old dir 'build-ardour-stack')
+if test -d $ARDOURSTACK_ROOT/lib/suil-0/ ; then
+    cp $ARDOURSTACK_ROOT/lib/suil-0/lib* $Frameworks
+fi
 
 # VST scanner app and wrapper script, if they exist
-cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $Frameworks/ || true
+if test -d $BUILD_ROOT/libs/fst ; then
+    cp $BUILD_ROOT/libs/fst/ardour-vst-scanner* $Frameworks/ || true
+fi
 
 # vfork wrapper
-cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $Frameworks/
+if test -f $BUILD_ROOT/libs/vfork/ardour-exec-wrapper ; then
+    mkdir -p $Frameworks/vfork
+    cp $BUILD_ROOT/libs/vfork/ardour-exec-wrapper $VFork
+fi
 
 
 while [ true ] ; do 
@@ -422,19 +444,21 @@ if test x$SAE != x ; then
     cp $BUILD_ROOT/gtk2_ardour/SAE-de-nokeypad.bindings  $Resources
     cp $BUILD_ROOT/gtk2_ardour/SAE-us-keypad.bindings  $Resources
     cp $BUILD_ROOT/gtk2_ardour/SAE-us-nokeypad.bindings  $Resources
-    cp $BUILD_ROOT/ardour_system_sae.rc $Resources/ardour_system.rc
-    echo cp $BUILD_ROOT/ardour_system_sae.rc $Resources/ardour_system.rc
     cp $BUILD_ROOT/instant.xml.sae $Resources/instant.xml
     echo cp $BUILD_ROOT/instant.xml.sae $Resources/instant.xml
 else
-    cp ../../ardour_system.rc $Resources/ardour_system.rc
+    cp ../../system_config $Resources/system_config
     cp ../../instant.xml $Resources/instant.xml
     echo cp ../../instant.xml $Resources/instant.xml
 fi
-cp ../../gtk2_ardour/ardour3_ui_default.conf $Resources
-cp ../../gtk2_ardour/ardour3_ui_default.conf $Resources/ardour3_ui.conf
-cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_light.rc $Resources
-cp $BUILD_ROOT/gtk2_ardour/ardour3_ui_dark.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/default_ui_config $Resources
+cp $BUILD_ROOT/gtk2_ardour/dark_fonts.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/dark_styles.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/light_fonts.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/light_styles.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/ui_dark.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/ui_light.rc $Resources
+cp $BUILD_ROOT/gtk2_ardour/widgets.rc $Resources
 
 cp -r ../../gtk2_ardour/icons $Resources
 cp -r ../../gtk2_ardour/pixmaps $Resources
@@ -553,6 +577,7 @@ if test x$WITH_HARVID != x ; then
        echo "installing video tools.."
        HARVID_VERSION=$(curl -s -S http://ardour.org/files/video-tools/harvid_version.txt)
        XJADEO_VERSION=$(curl -s -S http://ardour.org/files/video-tools/xjadeo_version.txt)
+       MULTIARCH=osx
        echo "copying harvid and xjadeo ..."
 
        rsync -Pa \
@@ -587,7 +612,7 @@ VOLNAME=$APPNAME-$release_version
 
 # TODO use mktemp
 export TMPDIR=`pwd`
-MNTPATH=`mktemp -d -t /ardourimg`
+MNTPATH=`mktemp -d -t ardourimg`
 TMPDMG=`mktemp -t ardour`
 ICNSTMP=`mktemp -t ardouricon`
 EXTRA_SPACE_MB=30
@@ -612,32 +637,41 @@ cp -vi ${DMGBACKGROUND} "${MNTPATH}/.background/dmgbg.png"
 
 echo "setting DMG background ..."
 
-echo '
-   tell application "Finder"
-     tell disk "'${VOLNAME}'"
-           open
-           set current view of container window to icon view
-           set toolbar visible of container window to false
-           set statusbar visible of container window to false
-           set the bounds of container window to {400, 200, 800, '${DMGWINBOTTOM}'}
-           set theViewOptions to the icon view options of container window
-           set arrangement of theViewOptions to not arranged
-           set icon size of theViewOptions to 64
-           set background picture of theViewOptions to file ".background:dmgbg.png"
-           make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
-           set position of item "'${APPDIR}'" of container window to {90, 100}
-           set position of item "Applications" of container window to {310, 100}
-           '${MIXBUSPOS}'
-           '${HARVIDPOS}'
-           '${XJADEOPOS}'
-           close
-           open
-           update without registering applications
-           delay 5
-           eject
-     end tell
-   end tell
-' | osascript
+if test $(sw_vers -productVersion | cut -d '.' -f 2) -lt 9; then
+       # OSX ..10.8.X
+       DISKNAME=${VOLNAME}
+else
+       # OSX 10.9.X and later
+       DISKNAME=`basename "${MNTPATH}"`
+fi
+
+osascript << EOF
+  tell application "Finder"
+    activate
+    tell disk "${DISKNAME}"
+      open
+      set current view of container window to icon view
+      set toolbar visible of container window to false
+      set statusbar visible of container window to false
+      set the bounds of container window to {400, 200, 800, ${DMGWINBOTTOM}}
+      set theViewOptions to the icon view options of container window
+      set arrangement of theViewOptions to not arranged
+      set icon size of theViewOptions to 64
+      set background picture of theViewOptions to file ".background:dmgbg.png"
+      make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
+      set position of item "${APPDIR}" of container window to {90, 100}
+      set position of item "Applications" of container window to {310, 100}
+      ${MIXBUSPOS}
+      ${HARVIDPOS}
+      ${XJADEOPOS}
+      close
+      open
+      update without registering applications
+      delay 5
+      eject
+    end tell
+  end tell
+EOF
 
 chmod -Rf go-w "${MNTPATH}"
 sync
@@ -656,10 +690,10 @@ rm -rf "$MNTPATH"
 echo "setting file icon ..."
 
 cp ${PRODUCT_PKG_DIR}/$Resources/appIcon.icns ${ICNSTMP}.icns
-/usr/bin/sips -i ${ICNSTMP}.icns
-/Developer/Tools/DeRez -only icns ${ICNSTMP}.icns > ${ICNSTMP}.rsrc
-/Developer/Tools/Rez -append ${ICNSTMP}.rsrc -o "$UC_DMG"
-/Developer/Tools/SetFile -a C "$UC_DMG"
+sips -i ${ICNSTMP}.icns
+DeRez -only icns ${ICNSTMP}.icns > ${ICNSTMP}.rsrc
+Rez -append ${ICNSTMP}.rsrc -o "$UC_DMG"
+SetFile -a C "$UC_DMG"
 
 rm ${ICNSTMP}.icns ${ICNSTMP}.rsrc