From bdec6a0596efaf72da696395d71cd064cb78cd50 Mon Sep 17 00:00:00 2001 From: pchote Date: Fri, 19 Feb 2010 21:59:04 +1300 Subject: [PATCH] Finish the osx packaging script --- Makefile | 3 ++ .../osx/{ => OpenRA.app/Contents}/Info.plist | 0 .../{ => OpenRA.app/Contents/MacOS}/OpenRA | 4 +++ .../Contents/Resources/OpenRa.icns} | Bin packaging/osx/package.sh | 33 +++++++++++------- 5 files changed, 27 insertions(+), 13 deletions(-) rename packaging/osx/{ => OpenRA.app/Contents}/Info.plist (100%) rename packaging/osx/{ => OpenRA.app/Contents/MacOS}/OpenRA (52%) rename packaging/osx/{OpenRA.icns => OpenRA.app/Contents/Resources/OpenRa.icns} (100%) diff --git a/Makefile b/Makefile index 7323aedb3f..e5f4ea4848 100644 --- a/Makefile +++ b/Makefile @@ -88,4 +88,7 @@ server: $(server_TARGET) seqed: $(seqed_TARGET) all: $(fileformats_TARGET) $(gl_TARGET) $(game_TARGET) $(ra_TARGET) $(cnc_TARGET) $(aftermath_TARGET) $(server_TARGET) $(seqed_TARGET) +dist-osx: + packaging/osx/package.sh + .DEFAULT: all diff --git a/packaging/osx/Info.plist b/packaging/osx/OpenRA.app/Contents/Info.plist similarity index 100% rename from packaging/osx/Info.plist rename to packaging/osx/OpenRA.app/Contents/Info.plist diff --git a/packaging/osx/OpenRA b/packaging/osx/OpenRA.app/Contents/MacOS/OpenRA similarity index 52% rename from packaging/osx/OpenRA rename to packaging/osx/OpenRA.app/Contents/MacOS/OpenRA index bcb9d150a2..16d958c0a5 100755 --- a/packaging/osx/OpenRA +++ b/packaging/osx/OpenRA.app/Contents/MacOS/OpenRA @@ -1,4 +1,8 @@ #!/bin/sh +# Application-launcher for OpenRA. +# Executes the game binary inside the ../Resources directory with the correct working directory +# Based on the file generated by the mono mkbundle utility + APP_PATH=`echo $0 | awk '{split($0,patharr,"/"); idx=1; while(patharr[idx+3] != "") { if (patharr[idx] != "/") {printf("%s/", patharr[idx]); idx++ }} }'` cd "$APP_PATH/Contents/Resources" ./OpenRA diff --git a/packaging/osx/OpenRA.icns b/packaging/osx/OpenRA.app/Contents/Resources/OpenRa.icns similarity index 100% rename from packaging/osx/OpenRA.icns rename to packaging/osx/OpenRA.app/Contents/Resources/OpenRa.icns diff --git a/packaging/osx/package.sh b/packaging/osx/package.sh index 924dbe31e9..a5d3804c27 100755 --- a/packaging/osx/package.sh +++ b/packaging/osx/package.sh @@ -1,21 +1,28 @@ #!/bin/sh +# OpenRA Packaging script for osx +# Creates a .app bundle for OpenRA game, and a command line app for OpenRa server +# Statically links all custom dlls into the executable, but requires the Mono and +# Cg frameworks installed on the target machine for these binaries to run -# Set the required environment variables +# 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 allies.mix conquer.mix expand2.mix general.mix hires.mix interior.mix redalert.mix russian.mix snow.mix sounds.mix temperat.mix line.fx chrome-shp.fx chrome-rgba.fx bogus.SNO bogus.TEM world-shp.fx tileSet.til templates.ini mods maps packaging/osx/settings.ini" + +# List of system files to copy into the app bundle +# TODO: Sort out whats going on with libglfw so we don't need to do this +SYSTEM_FILES=libglfw.dylib + +# Force 32-bit build and set the pkg-config path for mono.pc export AS="as -arch i386" export CC="gcc -arch i386" export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/ -# Package a command-line binary for the server -mkbundle --deps -o OpenRA_Server OpenRA.Server.exe OpenRa.FileFormats.dll +# Package the server binary +mkbundle --deps --static -o openra_server OpenRA.Server.exe OpenRa.FileFormats.dll -# Create the app bundle for the game -macpack -mode:winforms -n OpenRA -r OpenRa.FileFormats.dll,OpenRa.Gl.dll,libglfw.dylib,thirdparty/Tao/Tao.Glfw.dll,thirdparty/Tao/Tao.Cg.dll,thirdparty/Tao/Tao.OpenGl.dll,thirdparty/Tao/Tao.OpenAl.dll,allies.mix,conquer.mix,expand2.mix,general.mix,hires.mix,interior.mix,redalert.mix,russian.mix,snow.mix,sounds.mix,temperat.mix,packaging/osx/settings.ini,line.fx,chrome-shp.fx,chrome-rgba.fx,bogus.sno,bogus.tem,world-shp.fx,tileSet.til,templates.ini,packaging/osx/OpenRa.icns,mods,maps OpenRa.Game.exe +# Package the game binary +mkbundle --deps --static -o OpenRA OpenRa.Game.exe OpenRa.FileFormats.dll thirdparty/Tao/Tao.Glfw.dll thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.OpenAl.dll OpenRa.Gl.dll -# Package a new binary with included deps -mkbundle --deps -o OpenRA OpenRa.Game.exe OpenRa.Fileformats.dll - -# Modify the app bundle with our custom files -cp packaging/osx/Info.plist OpenRA.app/Contents/ -rm OpenRA.app/Contents/Resources/OpenRA.exe -cp OpenRA OpenRA.app/Contents/Resources/ -cp packaging/osx/OpenRA OpenRA.app/Contents/MacOS/ \ No newline at end of file +# Copy everything into our game bundle template +cp -R packaging/osx/OpenRA.app . +cp -R $GAME_FILES $SYSTEM_FILES OpenRA.app/Contents/Resources/