Fix versioning of .dmg filenames.
[dcpomatic.git] / platform / osx / make_dmg.sh
index 4999268766c71514884bd7fb08b728375bba4f4f..80205822a9637c44e5e76b6471e29a133439a46d 100644 (file)
@@ -7,7 +7,12 @@ SYNTAX="make_dmg.sh <environment> <builddir> <apple-id> <apple-password> <arch1>
 # Don't set -e here as egrep (used a few times) returns 1 if no matches
 # were found.
 
-version=`git describe --tags --abbrev=0 | sed -e "s/v//"`
+# Use a tag if what we've built is exactly on one
+version=$(git describe --tags --abbrev=0 --match=v2.*.* --exact-match $1 2> /dev/null)
+if [ "$?" != "0" ]; then
+       # Otherwise use <branch>-<commit>
+       version="$(basename $(git name-rev --name-only HEAD))-$(git rev-parse --short HEAD)"
+fi
 
 # DMG size in megabytes
 DMG_SIZE=256
@@ -84,19 +89,25 @@ function copy_lib_root {
 }
 
 function copy_lib_env {
-       for f in $ENV/$ARCH2/lib/$1*.dylib; do
-               if [ -h $f ]; then
-                       ln -s $(readlink $f) "$2/`basename $f`"
-               else
-                       if [ "$ARCH2" == "" ]; then
+       if [ "$ARCH2" == "" ]; then
+               for f in $ENV/$ARCH1/lib/$1*.dylib; do
+                       if [ -h $f ]; then
+                               ln -s $(readlink $f) "$2/`basename $f`"
+                       else
                                cp $f "$2/`basename $f`"
+                       fi
+               done
+       else
+               for f in $ENV/$ARCH2/lib/$1*.dylib; do
+                       if [ -h $f ]; then
+                               ln -s $(readlink $f) "$2/`basename $f`"
                        else
                                g=`echo $f | sed -e "s@/$ARCH2/@/$ARCH1/@g"`
                                mkdir -p "$2"
                                lipo -create $f $g -output "$2/$(basename $f)"
                        fi
-               fi
-       done
+               done
+       fi
     to_relink="$to_relink|$1"
 }
 
@@ -178,7 +189,8 @@ function copy_resources {
        else
                local prefix=$ROOT/$ARCH1
        fi
-    cp $prefix/src/dcpomatic/graphics/osx/dcpomatic_small.png "$dest"
+    cp $prefix/src/dcpomatic/graphics/osx/dcpomatic_small_white.png "$dest"
+    cp $prefix/src/dcpomatic/graphics/osx/dcpomatic_small_black.png "$dest"
     cp $prefix/src/dcpomatic/graphics/osx/dcpomatic2.icns "$dest"
     cp $prefix/src/dcpomatic/graphics/osx/dcpomatic2_kdm.icns "$dest"
     cp $prefix/src/dcpomatic/graphics/osx/dcpomatic2_server.icns "$dest"
@@ -255,7 +267,7 @@ function relink_relative {
 
        for arch in $arch1_name $arch2_name; do
                for obj in "${linkers[@]}"; do
-                       deps=`otool -arch $arch -L "$obj" | awk '{print $1}' | egrep "($to_relink)" | egrep "($ENV|$ROOT|boost|libicu|libssh)"`
+                       deps=`otool -arch $arch -L "$obj" | awk '{print $1}' | egrep "($to_relink)" | egrep "($ENV|$ROOT|@rpath|boost|libicu|libssh)"`
                        changes=""
                        for dep in $deps; do
                                base=`basename $dep`