Tweak DMG creation for Apple changes.
[dcpomatic.git] / platform / osx / make_dmg.sh
index 93cbd077fde96d2627dc3c53fce53592dab272ae..b3674df690265bb63d50d61da8f44c7d3ddbfae1 100644 (file)
@@ -110,8 +110,8 @@ function copy_libs {
     local dest="$1"
     copy_lib_root libcxml "$dest"
     copy_lib_root libdcp-1.0 "$dest"
-    copy_lib_root libasdcp-cth "$dest"
-    copy_lib_root libkumu-cth "$dest"
+    copy_lib_root libasdcp-carl "$dest"
+    copy_lib_root libkumu-carl "$dest"
     copy_lib_root libsub "$dest"
     copy_lib_root libopenjp2 "$dest"
     copy_lib_root libavdevice "$dest"
@@ -166,6 +166,7 @@ function copy_libs {
     copy_lib_env libFLAC "$dest"
     copy_lib_env libvorbis "$dest"
     copy_lib_env libogg "$dest"
+    copy_lib_env libxerces-c "$dest"
 }
 
 # @param #1 directory to copy to
@@ -194,8 +195,8 @@ function copy_resources {
     cp $prefix/src/dcpomatic/graphics/osx/preferences/keys.png "$dest"
     cp $prefix/src/dcpomatic/graphics/osx/preferences/cover_sheet.png "$dest"
     cp $prefix/src/dcpomatic/graphics/osx/preferences/notifications.png "$dest"
-    cp $prefix/src/dcpomatic/graphics/osx/preferences/accounts.png "$dest"
     cp $prefix/src/dcpomatic/graphics/osx/preferences/locations.png "$dest"
+    cp $prefix/src/dcpomatic/graphics/osx/preferences/sound.png "$dest"
     cp $prefix/src/dcpomatic/fonts/LiberationSans-Regular.ttf "$dest"
     cp $prefix/src/dcpomatic/fonts/LiberationSans-Italic.ttf "$dest"
     cp $prefix/src/dcpomatic/fonts/LiberationSans-Bold.ttf "$dest"
@@ -207,6 +208,7 @@ function copy_resources {
     cp $prefix/src/dcpomatic/graphics/snap.png "$dest"
     cp $prefix/src/dcpomatic/graphics/sequence.png "$dest"
     cp $prefix/src/dcpomatic/graphics/me.jpg "$dest"
+    cp -r $prefix/share/libdcp/xsd "$dest"
 
     # i18n: DCP-o-matic .mo files
     for lang in de_DE es_ES fr_FR it_IT sv_SE nl_NL ru_RU pl_PL da_DK pt_PT pt_BR sk_SK cs_CZ uk_UA zh_CN tr_TR; do
@@ -258,7 +260,7 @@ function make_dmg {
     dmg="$full_name $version.dmg"
     vol_name=DCP-o-matic-$version
 
-    codesign --deep --force --verify --verbose --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$appdir"
+    codesign --deep --force --verify --verbose --options runtime --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$appdir"
     if [ "$?" != "0" ]; then
        echo "Failed to sign .app"
        exit 1
@@ -314,7 +316,6 @@ EOF
     chmod -Rf go-w /Volumes/"$vol_name"/"$appdir"
     sync
 
-    set -e
     hdiutil eject $device
     hdiutil convert -format UDZO $tmp_dmg -imagekey zlib-level=9 -o "$dmg"
     sips -i "$appdir/Contents/Resources/dcpomatic2.icns"
@@ -322,26 +323,39 @@ EOF
     Rez -append "$appdir/Contents/Resources/DCP-o-matic.rsrc" -o "$dmg"
     SetFile -a C "$dmg"
     xattr -c "$dmg"
-    codesign --verify --verbose --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$dmg"
-
-    id=$(xcrun altool --notarize-app -t osx -f "$dmg" --primary-bundle-id $bundle_id -u $APPLE_ID -p $APPLE_PASSWORD --output-format xml | grep -C1 RequestUUID | tail -n 1 | sed -e "s/<string>//g" | sed -e "s/<\/string>//g")
-    N=0
-    while [ 1 ]; do
-       echo "Checking up on $id"
-       status=$(xcrun altool --notarization-info $id -u $APPLE_ID -p $APPLE_PASSWORD --output-format xml | grep -C1 "<key>Status</key>" | tail -n 1 | sed -e "s/       .//g")
-       echo "Got $status"
-       if [ "$status" == "<string>success</string>" ]; then
-           break
-       fi
-       sleep 30
-       N=$((N+1))
-       if [ "$N" == "10" ]; then
-           echo "Timed out waiting for notarization"
-           exit 1
-       fi
-    done
 
-    xcrun stapler staple "$dmg"
+    set -e
+    codesign --verify --verbose --options runtime --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$dmg"
+
+    # We only notarize thin builds, as if we're building universal binaries we must be on an OS
+    # sufficiently old that it can't notarize anyway
+    if [ "$TYPE" == "thin" ]; then
+
+       id=$(xcrun altool --notarize-app -t osx -f "$dmg" --primary-bundle-id $bundle_id -u $APPLE_ID -p $APPLE_PASSWORD --output-format xml | grep -C1 RequestUUID | tail -n 1 | sed -e "s/<string>//g" | sed -e "s/<\/string>//g")
+       N=0
+       while [ 1 ]; do
+           echo "Checking up on $id"
+            status=$(xcrun altool --notarization-info $id -u $APPLE_ID -p $APPLE_PASSWORD --output-format xml)
+            summary=$(echo "$status" | grep -C1 "<key>Status</key>" | tail -n 1 | sed -e "s/    .//g")
+            echo "Got $summary"
+            if [ "$summary" == "<string>invalid</string>" ]; then
+                echo "Notarization failed."
+                echo $status
+                exit 1
+            fi
+           if [ "$summary" == "<string>success</string>" ]; then
+               break
+           fi
+           sleep 30
+           N=$((N+1))
+           if [ "$N" == "30" ]; then
+               echo "Timed out waiting for notarization"
+               exit 1
+           fi
+       done
+
+       xcrun stapler staple "$dmg"
+    fi
     set +e
 
     rm $tmp_dmg
@@ -377,6 +391,7 @@ copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2 "$approot/MacOS"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_cli "$approot/MacOS"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_create "$approot/MacOS"
 copy $ROOT bin/ffprobe "$approot/MacOS"
+copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
 cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2.Info.plist "$approot/Info.plist"
 rl=("$approot/MacOS/dcpomatic2" "$approot/MacOS/dcpomatic2_cli" "$approot/MacOS/dcpomatic2_create" "$approot/MacOS/ffprobe" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
@@ -386,6 +401,7 @@ make_dmg "$appdir" "DCP-o-matic" com.dcpomatic
 setup "DCP-o-matic 2 KDM Creator.app"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_kdm "$approot/MacOS"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_kdm_cli "$approot/MacOS"
+copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
 cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_kdm.Info.plist "$approot/Info.plist"
 rl=("$approot/MacOS/dcpomatic2_kdm" "$approot/MacOS/dcpomatic2_kdm_cli" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
@@ -395,6 +411,7 @@ make_dmg "$appdir" "DCP-o-matic KDM Creator" com.dcpomatic.kdm
 setup "DCP-o-matic 2 Encode Server.app"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_server "$approot/MacOS"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_server_cli "$approot/MacOS"
+copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
 cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_server.Info.plist "$approot/Info.plist"
 rl=("$approot/MacOS/dcpomatic2_server" "$approot/MacOS/dcpomatic2_server_cli" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
@@ -403,6 +420,7 @@ make_dmg "$appdir" "DCP-o-matic Encode Server" com.dcpomatic.server
 # DCP-o-matic Batch Converter
 setup "DCP-o-matic 2 Batch converter.app"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_batch "$approot/MacOS"
+copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
 cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_batch.Info.plist "$approot/Info.plist"
 rl=("$approot/MacOS/dcpomatic2_batch" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"
@@ -411,6 +429,7 @@ make_dmg "$appdir" "DCP-o-matic Batch Converter" com.dcpomatic.batch
 # DCP-o-matic Player
 setup "DCP-o-matic 2 Player.app"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_player "$approot/MacOS"
+copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
 cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_player.Info.plist "$approot/Info.plist"
 rl=("$approot/MacOS/dcpomatic2_player" "$approot/Frameworks/"*.dylib)
 relink "${rl[@]}"