From 4671e6b261174ae7a59cb96a890c41b54ce91b90 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 2 Jul 2010 21:20:18 +1200 Subject: [PATCH] Script to package a game build into a zip --- .../osx/OpenRA.app/Contents/MacOS/OpenRA | 5 +-- packaging/osx/package-game.sh | 35 +++++++++++++++++++ .../osx/{package.sh => package-launcher.sh} | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100755 packaging/osx/package-game.sh rename packaging/osx/{package.sh => package-launcher.sh} (99%) diff --git a/packaging/osx/OpenRA.app/Contents/MacOS/OpenRA b/packaging/osx/OpenRA.app/Contents/MacOS/OpenRA index 82b998fb0b..6f1718f045 100755 --- a/packaging/osx/OpenRA.app/Contents/MacOS/OpenRA +++ b/packaging/osx/OpenRA.app/Contents/MacOS/OpenRA @@ -1,12 +1,13 @@ #!/bin/bash -# Where is the game we are trying to load? -GAME_PATH="/Users/paul/src/OpenRA/" # Find where we are and what we want to run APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+3] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'` EXE_PATH="$APP_PATH/Contents/MacOS/" +# Where is the game we are trying to load? +GAME_PATH="$EXE_PATH../Resources/" + # Override paths within mono to avoid string-hacking the executable export LD_LIBRARY_PATH="$EXE_PATH/lib" export MONO_PATH="$EXE_PATH/lib" diff --git a/packaging/osx/package-game.sh b/packaging/osx/package-game.sh new file mode 100755 index 0000000000..8a35f9473e --- /dev/null +++ b/packaging/osx/package-game.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# OpenRA Packaging script for osx +# Packages game files into the launcher app +# previously created by the package-launcher script + +PWD=`pwd` +PACKAGING_PATH="$PWD/osxbuild" +LAUNCHER_PATH="$PACKAGING_PATH/launcher/OpenRA.app" +SOURCE_PATH="$PWD/." + +FILES="OpenRA.Game.exe OpenRA.Gl.dll OpenRA.FileFormats.dll FreeSans.ttf FreeSansBold.ttf titles.ttf shaders maps mods/ra mods/cnc" +EXCLUDE="*.mdb ./mods/cnc/packages/*.mix ./mods/ra/packages/*.mix ./mods/cnc/packages/*.MIX ./mods/ra/packages/*.MIX" + +# Copy source files into packaging dir +PAYLOAD="$PACKAGING_PATH/payload" +mkdir -p $PAYLOAD +mkdir -p "$PAYLOAD/mods" + +for i in $FILES; do + cp -RX "$i" "$PAYLOAD/$i" +done + +# Delete unwanted files +cd $PAYLOAD +for i in $EXCLUDE; do + find . -path "$i" -delete +done +cd $PACKAGING_PATH + +# Move everything into the app bundle +cp -r "$LAUNCHER_PATH" . +cp -r "$PAYLOAD/" "OpenRA.app/Contents/Resources/" +rm -rf $PAYLOAD +zip OpenRA -r -9 OpenRA.app +echo "Done!" \ No newline at end of file diff --git a/packaging/osx/package.sh b/packaging/osx/package-launcher.sh similarity index 99% rename from packaging/osx/package.sh rename to packaging/osx/package-launcher.sh index d05ac8a027..b0e261c08b 100755 --- a/packaging/osx/package.sh +++ b/packaging/osx/package-launcher.sh @@ -11,7 +11,7 @@ # A list of the binaries that we want to be able to run DEPS_LOCAL="OpenRA.Game.exe OpenRA.Gl.dll OpenRA.FileFormats.dll" -PACKAGING_DIR="osxbuild" +PACKAGING_DIR="osxbuild/launcher" SYSTEM_MONO="/Library/Frameworks/Mono.framework/Versions/2.6.3" # dylibs referred to by dlls in the gac; won't show up to otool