diff --git a/packaging/osx/buildpackage.sh b/packaging/osx/buildpackage.sh index 2a5ebb6f4e..f09c158dc7 100755 --- a/packaging/osx/buildpackage.sh +++ b/packaging/osx/buildpackage.sh @@ -1,7 +1,7 @@ #!/bin/bash # OpenRA packaging script for Mac OSX -LAUNCHER_TAG="osx-launcher-20170211" +LAUNCHER_TAG="osx-launcher-20170414" if [ $# -ne "3" ]; then echo "Usage: `basename $0` tag files-dir outputdir" @@ -14,18 +14,49 @@ if [ -e "OpenRA.app" ]; then exit 2 fi +TAG="$1" +BUILTDIR="$2" +OUTPUTDIR="$3" + +modify_plist() { + sed "s|$1|$2|g" "$3" > "$3.tmp" && mv "$3.tmp" "$3" +} + +# Copies the game files and sets metadata +populate_template() { + cp -r OpenRA.app "$1" + cp -r $BUILTDIR/* "$1/Contents/Resources/" || exit 3 + cp "$2.icns" "$1/Contents/Resources/OpenRA.icns" + modify_plist "{MOD_ID}" "$2" "$1/Contents/Info.plist" + modify_plist "{MOD_NAME}" "$3" "$1/Contents/Info.plist" + modify_plist "{JOIN_SERVER_URL_SCHEME}" "openra-$2-$TAG" "$1/Contents/Info.plist" +} + +# Deletes from the first argument's mod dirs all the later arguments +delete_mods() { + pushd "$1/Contents/Resources/mods" > /dev/null + shift + rm -rf $@ + pushd > /dev/null +} + curl -s -L -O https://github.com/OpenRA/OpenRALauncherOSX/releases/download/${LAUNCHER_TAG}/launcher.zip || exit 3 unzip -qq launcher.zip rm launcher.zip -# Copy the template to build the game package -cp -r $2/* "OpenRA.app/Contents/Resources/" || exit 3 +modify_plist "{DEV_VERSION}" "${1}" "OpenRA.app/Contents/Info.plist" +modify_plist "{FAQ_URL}" "http://wiki.openra.net/FAQ" "OpenRA.app/Contents/Info.plist" -# Set version string -sed "s/{DEV_VERSION}/${1}/" OpenRA.app/Contents/Info.plist > OpenRA.app/Contents/Info.plist.tmp -mv OpenRA.app/Contents/Info.plist.tmp OpenRA.app/Contents/Info.plist +populate_template "OpenRA - Red Alert.app" "ra" "Red Alert" +delete_mods "OpenRA - Red Alert.app" "cnc" "d2k" + +populate_template "OpenRA - Tiberian Dawn.app" "cnc" "Tiberian Dawn" +delete_mods "OpenRA - Tiberian Dawn.app" "ra" "d2k" + +populate_template "OpenRA - Dune 2000.app" "d2k" "Dune 2000" +delete_mods "OpenRA - Dune 2000.app" "ra" "cnc" # Package app bundle into a zip and clean up -zip OpenRA-$1 -r -9 OpenRA.app --quiet --symlinks +zip OpenRA-$1 -r -9 "OpenRA - Red Alert.app" "OpenRA - Tiberian Dawn.app" "OpenRA - Dune 2000.app" --quiet --symlinks mv OpenRA-$1.zip $3 -rm -rf OpenRA.app +rm -rf OpenRA.app "OpenRA - Red Alert.app" "OpenRA - Tiberian Dawn.app" "OpenRA - Dune 2000.app" diff --git a/packaging/osx/cnc.icns b/packaging/osx/cnc.icns new file mode 100644 index 0000000000..2c177ffacb Binary files /dev/null and b/packaging/osx/cnc.icns differ diff --git a/packaging/osx/d2k.icns b/packaging/osx/d2k.icns new file mode 100644 index 0000000000..edeca60c32 Binary files /dev/null and b/packaging/osx/d2k.icns differ diff --git a/packaging/osx/ra.icns b/packaging/osx/ra.icns new file mode 100644 index 0000000000..6485059707 Binary files /dev/null and b/packaging/osx/ra.icns differ diff --git a/packaging/package-all.sh b/packaging/package-all.sh index 0c00e37d7d..a9be5551f7 100755 --- a/packaging/package-all.sh +++ b/packaging/package-all.sh @@ -80,7 +80,7 @@ fi popd >/dev/null pushd osx >/dev/null -echo "Zipping OS X package" +echo "Building OS X package" ./buildpackage.sh "$TAG" "$BUILTDIR" "$OUTPUTDIR" if [ $? -ne 0 ]; then echo "OS X package build failed."