}
# param $1 list of things that link to other things
-function relink {
+function relink_relative {
to_relink=`echo $to_relink | sed -e "s/\+//g"`
local linkers=("$@")
done
}
+# param $1 directory containg things
+# $2 list of things that link to other things
+function relink_absolute {
+ to_relink=`echo $to_relink | sed -e "s/\+//g"`
+ target=$1
+ shift
+ local linkers=("$@")
+
+ for obj in "${linkers[@]}"; do
+ deps=`otool -L "$obj" | awk '{print $1}' | egrep "($to_relink)" | egrep "($ENV|$ROOT|boost|libicu)"`
+ changes=""
+ for dep in $deps; do
+ base=`basename $dep`
+ changes="$changes -change "$dep" \"$target/$base\""
+ done
+ if test "x$changes" != "x"; then
+ install_name_tool $changes -id "`basename "$obj"`" "$obj"
+ fi
+ done
+}
+
+function sign {
+ codesign --deep --force --verify --verbose --options runtime --sign "Developer ID Application: Carl Hetherington (R82DXSR997)" "$1"
+ if [ "$?" != "0" ]; then
+ echo "Failed to sign $1"
+ exit 1
+ fi
+}
+
+
# @param #1 .app directory
# @param #2 .pkg or ""
# @param #3 full name e.g. DCP-o-matic Batch Converter
dmg="$full_name $version.dmg"
vol_name=DCP-o-matic-$version
- 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
+ sign "$appdir"
+
+ if [ "$pkg" != "" ]; then
+ productsign --sign "Developer ID Installer: Carl Hetherington (R82DXSR997)" "$pkg" "signed_temp.pkg"
+ if [ "$?" != "0" ]; then
+ echo "Failed to sign .pkg"
+ exit 1
+ fi
+ mv signed_temp.pkg "$pkg"
fi
mkdir -p $vol_name
cp -a "$appdir" $vol_name
- if [ "$pkg" != ""]; then
+ if [ "$pkg" != "" ]; then
cp -a "$pkg" $vol_name
fi
ln -s /Applications "$vol_name/Applications"
mehr auftreten.
EOF
+ if [ "$pkg" != "" ]; then
+ cat<<EOF > "$vol_name/READ ME.txt"
+
+To run this software successfully you must install $pkg before running
+the .app
+EOF
+ fi
+
+ if [ "$pkg" != "" ]; then
+ cat<<EOF > "$vol_name/READ ME.de_DE.txt"
+
+To run this software successfully you must install $pkg before running
+the .app
+EOF
+
+ fi
rm -f $tmp_dmg "$dmg"
hdiutil create -srcfolder $vol_name -volname $vol_name -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size $DMG_SIZE $tmp_dmg
attach=$(hdiutil attach -readwrite -noverify -noautoopen $tmp_dmg)
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, 940, 300}
+ set the bounds of container window to {400, 200, 940, 600}
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 position of item "Applications" of container window to {265, 80}
set position of item "READ ME.txt" of container window to {430, 80}
set position of item "READ ME.de_DE.txt" of container window to {595, 80}
+ set position of item "DCP-o-matic Disk Writer.pkg" of container window to {90, 255}
close
open
update without registering applications
esac
# DCP-o-matic main
-setup "DCP-o-matic 2.app"
-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[@]}"
-make_dmg "$appdir" "" "DCP-o-matic" com.dcpomatic
+##setup "DCP-o-matic 2.app"
+##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_relative "${rl[@]}"
+##make_dmg "$appdir" "" "DCP-o-matic" com.dcpomatic
# DCP-o-matic KDM Creator
-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[@]}"
-make_dmg "$appdir" "" "DCP-o-matic KDM Creator" com.dcpomatic.kdm
+##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_relative "${rl[@]}"
+##make_dmg "$appdir" "" "DCP-o-matic KDM Creator" com.dcpomatic.kdm
# DCP-o-matic Encode Server
-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[@]}"
-make_dmg "$appdir" "" "DCP-o-matic Encode Server" com.dcpomatic.server
+##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_relative "${rl[@]}"
+##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[@]}"
-make_dmg "$appdir" "" "DCP-o-matic Batch Converter" com.dcpomatic.batch
+##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_relative "${rl[@]}"
+##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[@]}"
-make_dmg "$appdir" "" "DCP-o-matic Player" com.dcpomatic.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_relative "${rl[@]}"
+##make_dmg "$appdir" "" "DCP-o-matic Player" com.dcpomatic.player
# DCP-o-matic Playlist Editor
-setup "DCP-o-matic 2 Playlist Editor.app"
-copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_playlist "$approot/MacOS"
-copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
-cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_playlist.Info.plist "$approot/Info.plist"
-rl=("$approot/MacOS/dcpomatic2_playlist" "$approot/Frameworks/"*.dylib)
-relink "${rl[@]}"
-make_dmg "$appdir" "" "DCP-o-matic Playlist Editor" com.dcpomatic.playlist
-
-# DCP-o-matic Disk Writer
+##setup "DCP-o-matic 2 Playlist Editor.app"
+##copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_playlist "$approot/MacOS"
+##copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
+##cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_playlist.Info.plist "$approot/Info.plist"
+##rl=("$approot/MacOS/dcpomatic2_playlist" "$approot/Frameworks/"*.dylib)
+##relink_relative "${rl[@]}"
+##make_dmg "$appdir" "" "DCP-o-matic Playlist Editor" com.dcpomatic.playlist
+
+# DCP-o-matic Disk Writer .app
setup "DCP-o-matic 2 Disk Writer.app"
copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_disk "$approot/MacOS"
# XXX: this shouldn't really be necessary
copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_disk.Info.plist "$approot/Info.plist"
rl=("$approot/MacOS/dcpomatic2_disk" "$approot/Frameworks/"*.dylib)
-relink "${rl[@]}"
-rl=("$approot/MacOS/dcpomatic2_disk_writer" "$approot/Frameworks/"*.dylib)
-relink "${rl[@]}"
+relink_relative "${rl[@]}"
# DCP-o-matic Disk Writer daemon .pkg
pkgbase=tmp-disk-writer
target="$pkgroot/Library/Application Support/com.dcpomatic"
copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_disk_writer "$target"
copy_lib_root libcxml "$target"
-copy_lib_env libboost_system "$dest"
-copy_lib_env libboost_filesystem "$dest"
-copy_lib_env libboost_thread "$dest"
-copy_lib_env libboost_date_time "$dest"
-copy_lib_env libboost_locale "$dest"
-copy_lib_env libboost_regex "$dest"
-copy_lib_env libicui18n "$dest"
-copy_lib_env libicudata "$dest"
-copy_lib_env libicuio "$dest"
-copy_lib_env libicule "$dest"
-copy_lib_env libiculx "$dest"
-copy_lib_env libicutest "$dest"
-copy_lib_env libicutu "$dest"
-copy_lib_env libicuuc "$dest"
+copy_lib_env libboost_system "$target"
+copy_lib_env libboost_filesystem "$target"
+copy_lib_env libboost_thread "$target"
+copy_lib_env libboost_date_time "$target"
+copy_lib_env libboost_locale "$target"
+copy_lib_env libboost_regex "$target"
+copy_lib_env libicui18n "$target"
+copy_lib_env libicudata "$target"
+copy_lib_env libicuio "$target"
+copy_lib_env libicule "$target"
+copy_lib_env libiculx "$target"
+copy_lib_env libicutest "$target"
+copy_lib_env libicutu "$target"
+copy_lib_env libicuuc "$target"
+
+rl=("$target/dcpomatic2_disk_writer" "$target/"*.dylib)
+relink_absolute "${rl[@]}"
mkdir $pkgbase/scripts
cat > $pkgbase/scripts/postinstall <<EOF
/bin/launchctl load "/Library/LaunchDaemons/com.dcpomatic.disk.writer.plist"
exit 0
EOF
-chmod gou+x scripts/postinstall
+chmod gou+x $pkgbase/scripts/postinstall
+
+find "$target" -iname "*.dylib" -print0 | while IFS= read -r -d '' f; do
+ sign "$f"
+done
+sign "$target/dcpomatic2_disk_writer"
pkgbuild --root $pkgroot --identifier com.dcpomatic.disk.writer --scripts $pkgbase/scripts "DCP-o-matic Disk Writer.pkg"