Generate platform-specific artwork from common source files.

This commit is contained in:
Paul Chote
2020-08-30 10:32:07 +01:00
committed by teinarss
parent 62166a50d9
commit c1f79b348a
51 changed files with 68 additions and 47 deletions

View File

@@ -3,6 +3,7 @@
command -v curl >/dev/null 2>&1 || { echo >&2 "Windows packaging requires curl."; exit 1; }
command -v markdown >/dev/null 2>&1 || { echo >&2 "Windows packaging requires markdown."; exit 1; }
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
command -v convert >/dev/null 2>&1 || { echo >&2 "Windows packaging requires ImageMagick."; exit 1; }
if [ $# -ne "2" ]; then
echo "Usage: $(basename "$0") tag outputdir"
@@ -16,6 +17,7 @@ TAG="$1"
OUTPUTDIR="$2"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
ARTWORK_DIR="$(pwd)/../artwork/"
LAUNCHER_LIBS="-r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll -r:${BUILTDIR}/OpenRA.Game.exe"
FAQ_URL="http://wiki.openra.net/FAQ"
@@ -29,23 +31,33 @@ fi
function makelauncher()
{
sed "s|DISPLAY_NAME|$2|" WindowsLauncher.cs.in | sed "s|MOD_ID|$3|" | sed "s|FAQ_URL|${FAQ_URL}|" > WindowsLauncher.cs
csc WindowsLauncher.cs -warn:4 -warnaserror -platform:"$5" -out:"$1" -t:winexe ${LAUNCHER_LIBS} -win32icon:"$4"
LAUNCHER_NAME="${1}"
DISPLAY_NAME="${2}"
MOD_ID="${3}"
PLATFORM="${4}"
# Create multi-resolution icon
convert "${ARTWORK_DIR}/${MOD_ID}_16x16.png" "${ARTWORK_DIR}/${MOD_ID}_24x24.png" "${ARTWORK_DIR}/${MOD_ID}_32x32.png" "${ARTWORK_DIR}/${MOD_ID}_48x48.png" "${ARTWORK_DIR}/${MOD_ID}_256x256.png" "${BUILTDIR}/${MOD_ID}.ico"
sed "s|DISPLAY_NAME|${DISPLAY_NAME}|" WindowsLauncher.cs.in | sed "s|MOD_ID|${MOD_ID}|" | sed "s|FAQ_URL|${FAQ_URL}|" > WindowsLauncher.cs
csc WindowsLauncher.cs -warn:4 -warnaserror -platform:"${PLATFORM}" -out:"${BUILTDIR}/${LAUNCHER_NAME}" -t:winexe ${LAUNCHER_LIBS} -win32icon:"${BUILTDIR}/${MOD_ID}.ico"
rm WindowsLauncher.cs
if [ "$5" = "x86" ]; then
if [ "${PLATFORM}" = "x86" ]; then
# Enable the full 4GB address space for the 32 bit game executable
# The server and utility do not use enough memory to need this
csc MakeLAA.cs -warn:4 -warnaserror -out:"MakeLAA.exe"
mono "MakeLAA.exe" "$1"
mono "MakeLAA.exe" "${BUILTDIR}/${LAUNCHER_NAME}"
rm MakeLAA.exe
fi
}
function build_platform()
{
echo "Building core files ($1)"
if [ "$1" = "x86" ]; then
PLATFORM="${1}"
echo "Building core files (${PLATFORM})"
if [ "${PLATFORM}" = "x86" ]; then
TARGETPLATFORM="TARGETPLATFORM=win-x86"
IS_WIN32="WIN32=true"
USE_PROGRAMFILES32="-DUSE_PROGRAMFILES32=true"
@@ -63,13 +75,10 @@ function build_platform()
make install-dependencies "${TARGETPLATFORM}" gameinstalldir="" DESTDIR="${BUILTDIR}"
popd > /dev/null || exit 1
echo "Compiling Windows launchers ($1)"
makelauncher "${BUILTDIR}/RedAlert.exe" "Red Alert" "ra" RedAlert.ico $1
makelauncher "${BUILTDIR}/TiberianDawn.exe" "Tiberian Dawn" "cnc" TiberianDawn.ico $1
makelauncher "${BUILTDIR}/Dune2000.exe" "Dune 2000" "d2k" Dune2000.ico $1
# Windows specific files
cp OpenRA.ico RedAlert.ico TiberianDawn.ico Dune2000.ico "${BUILTDIR}"
echo "Compiling Windows launchers (${PLATFORM})"
makelauncher "RedAlert.exe" "Red Alert" "ra" ${PLATFORM}
makelauncher "TiberianDawn.exe" "Tiberian Dawn" "cnc" ${PLATFORM}
makelauncher "Dune2000.exe" "Dune 2000" "d2k" ${PLATFORM}
cp "${SRCDIR}/OpenRA.Game.exe.config" "${BUILTDIR}"
curl -s -L -O https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md