Overhaul packaging scripts and helpers:

- Shared helpers extracted to functions.sh for use by upstream packaging,
  Mod SDK, and downstream packaging (via the Makefile targets).
- Assembly management separated from data and combined between engine
  and mods to prepare for pending .NET core requirements.
- Streamline Makefile targets.
- Clean up a lot of old technical debt.
This commit is contained in:
Paul Chote
2020-12-05 20:48:24 +00:00
committed by teinarss
parent f3ebe07540
commit b1560ae69c
12 changed files with 542 additions and 428 deletions

View File

@@ -19,7 +19,7 @@
!include "WordFunc.nsh"
Name "OpenRA"
OutFile "OpenRA.Setup.exe"
OutFile "${OUTFILE}"
ManifestDPIAware true

View File

@@ -1,4 +1,7 @@
#!/bin/bash
# OpenRA packaging script for Windows
set -e
command -v curl >/dev/null 2>&1 || { echo >&2 "Windows packaging requires curl."; exit 1; }
command -v makensis >/dev/null 2>&1 || { echo >&2 "Windows packaging requires makensis."; exit 1; }
@@ -12,6 +15,7 @@ fi
# Set the working dir to the location of this script
cd "$(dirname "$0")" || exit 1
. ../functions.sh
TAG="$1"
OUTPUTDIR="$2"
@@ -19,7 +23,7 @@ SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
ARTWORK_DIR="$(pwd)/../artwork/"
FAQ_URL="http://wiki.openra.net/FAQ"
FAQ_URL="https://wiki.openra.net/FAQ"
SUFFIX=" (dev)"
if [[ ${TAG} == release* ]]; then
@@ -35,19 +39,8 @@ function makelauncher()
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"
# Create mod-specific launcher
msbuild -t:Build "${SRCDIR}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -restore -p:Configuration=Release -p:TargetPlatform="win-${PLATFORM}" -p:LauncherName="${LAUNCHER_NAME}" -p:LauncherIcon="${BUILTDIR}/${MOD_ID}.ico" -p:ModID="${MOD_ID}" -p:DisplayName="${DISPLAY_NAME}" -p:FaqUrl="${FAQ_URL}"
cp "${SRCDIR}/bin/${LAUNCHER_NAME}.exe" "${BUILTDIR}"
cp "${SRCDIR}/bin/${LAUNCHER_NAME}.exe.config" "${BUILTDIR}"
# Enable the full 4GB address space for the 32 bit game executable
# The server and utility do not use enough memory to need this
if [ "${PLATFORM}" = "x86" ]; then
python3 MakeLAA.py "${BUILTDIR}/${LAUNCHER_NAME}.exe"
fi
install_windows_launcher "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${LAUNCHER_NAME}" "${DISPLAY_NAME}" "${BUILTDIR}/${MOD_ID}.ico" "${FAQ_URL}"
}
function build_platform()
@@ -55,37 +48,24 @@ function build_platform()
PLATFORM="${1}"
echo "Building core files (${PLATFORM})"
if [ "${PLATFORM}" = "win-x86" ]; then
if [ "${PLATFORM}" = "x86" ]; then
USE_PROGRAMFILES32="-DUSE_PROGRAMFILES32=true"
else
USE_PROGRAMFILES32=""
fi
pushd "${SRCDIR}" > /dev/null || exit 1
make clean
make core TARGETPLATFORM="win-${PLATFORM}"
make version VERSION="${TAG}"
make install-engine TARGETPLATFORM="win-${PLATFORM}" gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-common-mod-files gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-default-mods gameinstalldir="" DESTDIR="${BUILTDIR}"
make install-dependencies TARGETPLATFORM="win-${PLATFORM}" gameinstalldir="" DESTDIR="${BUILTDIR}"
popd > /dev/null || exit 1
install_assemblies_mono "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "False" "True" "True"
install_data "${SRCDIR}" "${BUILTDIR}" "cnc" "d2k" "ra"
set_engine_version "${TAG}" "${BUILTDIR}"
set_mod_version "${TAG}" "${BUILTDIR}/mods/cnc/mod.yaml" "${BUILTDIR}/mods/d2k/mod.yaml" "${BUILTDIR}/mods/ra/mod.yaml" "${BUILTDIR}/mods/modcontent/mod.yaml"
echo "Compiling Windows launchers (${PLATFORM})"
makelauncher "RedAlert" "Red Alert" "ra" ${PLATFORM}
makelauncher "TiberianDawn" "Tiberian Dawn" "cnc" ${PLATFORM}
makelauncher "Dune2000" "Dune 2000" "d2k" ${PLATFORM}
# Remove redundant generic launcher
rm "${BUILTDIR}/OpenRA.exe"
makelauncher "RedAlert" "Red Alert" "ra" "${PLATFORM}"
makelauncher "TiberianDawn" "Tiberian Dawn" "cnc" "${PLATFORM}"
makelauncher "Dune2000" "Dune 2000" "d2k" "${PLATFORM}"
echo "Building Windows setup.exe ($1)"
makensis -V2 -DSRCDIR="${BUILTDIR}" -DTAG="${TAG}" -DSUFFIX="${SUFFIX}" ${USE_PROGRAMFILES32} OpenRA.nsi
if [ $? -eq 0 ]; then
mv OpenRA.Setup.exe "${OUTPUTDIR}/OpenRA-${TAG}-${PLATFORM}.exe"
else
exit 1
fi
makensis -V2 -DSRCDIR="${BUILTDIR}" -DTAG="${TAG}" -DSUFFIX="${SUFFIX}" -DOUTFILE="${OUTPUTDIR}/OpenRA-${TAG}-${PLATFORM}.exe" ${USE_PROGRAMFILES32} OpenRA.nsi || exit 1
echo "Packaging zip archive ($1)"
pushd "${BUILTDIR}" > /dev/null