From d1a871ff6f68c6d91b2a6e6c4fe90ee9c72c59e5 Mon Sep 17 00:00:00 2001 From: pchote Date: Mon, 22 Feb 2010 02:57:33 +1300 Subject: [PATCH] Package all dependencies inside the game bundle. --- packaging/osx/package.sh | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/packaging/osx/package.sh b/packaging/osx/package.sh index 7bffa552bb..d3b434f2ef 100755 --- a/packaging/osx/package.sh +++ b/packaging/osx/package.sh @@ -5,9 +5,33 @@ # to run on a non-development machine # List of game files to copy into the app bundle -# TODO: This will be significantly shorter once we move the ra files into its mod dir GAME_FILES="OpenRA shaders mods maps packaging/osx/settings.ini FreeSans.ttf FreeSansBold.ttf" +# dylibs referred to by dlls in the gac; won't show up to otool +GAC_DYLIBS="/Library/Frameworks/Mono.framework/Versions/2.6.1/lib/libMonoPosixHelper.dylib /Library/Frameworks/Mono.framework/Versions/2.6.1/lib/libgdiplus.dylib" + +# Recursively modify and copy the mono files depended on by OpenRA into the app bundle +function patch_mono { + echo "Patching: "$1 + LIBS=$( otool -L $1 | grep /Library/Frameworks/Mono.framework/ | awk {'print $1'} ) + for i in $LIBS; do + if [ "`basename $i`" == "`basename $1`" ]; then + install_name_tool -id @executable_path/../${i:9} $1 + else + install_name_tool -change $i @executable_path/../${i:9} $1 + fi + done + for i in $LIBS; do + if [ -e OpenRA.app/Contents/${i:9} ]; then + echo "File already processed: "${i:9} + else + mkdir -p OpenRA.app/Contents/`dirname ${i:9}` + cp $i OpenRA.app/Contents/`dirname ${i:9}` + patch_mono OpenRA.app/Contents/${i:9} + fi + done +} + # Force 32-bit build and set the pkg-config path for mono.pc export AS="as -arch i386" export CC="gcc -arch i386" @@ -25,5 +49,17 @@ cp -R $GAME_FILES OpenRA.app/Contents/Resources/ # Copy frameworks into our game bundle template mkdir OpenRa.app/Contents/Frameworks/ +patch_mono OpenRA.app/Contents/Resources/OpenRA + +# The dylibs referenced by dll.configs in the gac don't show up to otool: patch them manually +perl -pi -e 's/\/Library\/Frameworks/..\/Frameworks\/.\/.\/./g' OpenRA.app/Contents/Resources/OpenRA + +# Copy the gac dylibs into the app bundle +for i in $GAC_DYLIBS; do + mkdir -p OpenRA.app/Contents/`dirname ${i:9}` + cp $i OpenRA.app/Contents/`dirname ${i:9}` + patch_mono OpenRA.app/Contents/${i:9} +done + cp -R /Library/Frameworks/Cg.Framework OpenRa.app/Contents/Frameworks/ cp -R /Library/Frameworks/SDL.Framework OpenRa.app/Contents/Frameworks/ \ No newline at end of file