Change makefile/packaging "RUNTIME=dotnet" to "RUNTIME=net5".

This commit is contained in:
Paul Chote
2021-05-03 13:42:11 +01:00
committed by abcdefg30
parent 1c6ca394c1
commit f8ed768e39
5 changed files with 69 additions and 91 deletions

View File

@@ -6,78 +6,12 @@
# Copy-paste the entire script into http://shellcheck.net to check.
####
# Compile and publish (using Mono) the core engine and specified mod assemblies to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# DEST_PATH: Path to the root of the install destination (will be created if necessary)
# TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, linux-x64, unix-generic)
# COPY_GENERIC_LAUNCHER: If set to True the OpenRA.exe will also be copied (True, False)
# COPY_CNC_DLL: If set to True the OpenRA.Mods.Cnc.dll will also be copied (True, False)
# COPY_D2K_DLL: If set to True the OpenRA.Mods.D2k.dll will also be copied (True, False)
# Used by:
# Makefile (install target for local installs and downstream packaging)
# Mod SDK Linux AppImage packaging
# Mod SDK macOS packaging
# Mod SDK Windows packaging
install_assemblies_mono() {
SRC_PATH="${1}"
DEST_PATH="${2}"
TARGETPLATFORM="${3}"
COPY_GENERIC_LAUNCHER="${4}"
COPY_CNC_DLL="${5}"
COPY_D2K_DLL="${6}"
echo "Building assemblies"
ORIG_PWD=$(pwd)
cd "${SRC_PATH}" || exit 1
rm -rf "${SRC_PATH}/OpenRA."*/obj
rm -rf "${SRC_PATH:?}/bin"
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}" -p:Mono=true
if [ "${TARGETPLATFORM}" = "unix-generic" ]; then
./configure-system-libraries.sh
fi
if [ "${COPY_GENERIC_LAUNCHER}" != "True" ]; then
rm "${SRC_PATH}/bin/OpenRA.dll"
fi
if [ "${COPY_CNC_DLL}" != "True" ]; then
rm "${SRC_PATH}/bin/OpenRA.Mods.Cnc.dll"
fi
if [ "${COPY_D2K_DLL}" != "True" ]; then
rm "${SRC_PATH}/bin/OpenRA.Mods.D2k.dll"
fi
cd "${ORIG_PWD}" || exit 1
echo "Installing engine to ${DEST_PATH}"
install -d "${DEST_PATH}"
for LIB in "${SRC_PATH}/bin/"*.dll "${SRC_PATH}/bin/"*.dll.config; do
install -m644 "${LIB}" "${DEST_PATH}"
done
if [ "${TARGETPLATFORM}" = "linux-x64" ]; then
for LIB in "${SRC_PATH}/bin/"*.so; do
install -m755 "${LIB}" "${DEST_PATH}"
done
fi
if [ "${TARGETPLATFORM}" = "osx-x64" ]; then
for LIB in "${SRC_PATH}/bin/"*.dylib; do
install -m755 "${LIB}" "${DEST_PATH}"
done
fi
}
# Compile and publish the core engine and specified mod assemblies to the target directory
# Arguments:
# SRC_PATH: Path to the root OpenRA directory
# DEST_PATH: Path to the root of the install destination (will be created if necessary)
# TARGETPLATFORM: Platform type (win-x86, win-x64, osx-x64, linux-x64, unix-generic)
# RUNTIME: Runtime type (net5, mono)
# COPY_GENERIC_LAUNCHER: If set to True the OpenRA.exe will also be copied (True, False)
# COPY_CNC_DLL: If set to True the OpenRA.Mods.Cnc.dll will also be copied (True, False)
# COPY_D2K_DLL: If set to True the OpenRA.Mods.D2k.dll will also be copied (True, False)
@@ -86,19 +20,66 @@ install_assemblies_mono() {
# Windows packaging
# macOS packaging
# Linux AppImage packaging
# Mod SDK Windows packaging
# Mod SDK macOS packaging
# Mod SDK Linux AppImage packaging
install_assemblies() {
SRC_PATH="${1}"
DEST_PATH="${2}"
TARGETPLATFORM="${3}"
COPY_GENERIC_LAUNCHER="${4}"
COPY_CNC_DLL="${5}"
COPY_D2K_DLL="${6}"
RUNTIME="${4}"
COPY_GENERIC_LAUNCHER="${5}"
COPY_CNC_DLL="${6}"
COPY_D2K_DLL="${7}"
ORIG_PWD=$(pwd)
cd "${SRC_PATH}" || exit 1
dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -p:PublishTrimmed=true -p:CopyGenericLauncher="${COPY_GENERIC_LAUNCHER}" -p:CopyCncDll="${COPY_CNC_DLL}" -p:CopyD2kDll="${COPY_D2K_DLL}" -r "${TARGETPLATFORM}" -o "${DEST_PATH}" --self-contained true
if [ "${RUNTIME}" = "mono" ]; then
echo "Building assemblies"
rm -rf "${SRC_PATH}/OpenRA."*/obj
rm -rf "${SRC_PATH:?}/bin"
msbuild -verbosity:m -nologo -t:Build -restore -p:Configuration=Release -p:TargetPlatform="${TARGETPLATFORM}" -p:Mono=true
if [ "${TARGETPLATFORM}" = "unix-generic" ]; then
./configure-system-libraries.sh
fi
if [ "${COPY_GENERIC_LAUNCHER}" != "True" ]; then
rm "${SRC_PATH}/bin/OpenRA.dll"
fi
if [ "${COPY_CNC_DLL}" != "True" ]; then
rm "${SRC_PATH}/bin/OpenRA.Mods.Cnc.dll"
fi
if [ "${COPY_D2K_DLL}" != "True" ]; then
rm "${SRC_PATH}/bin/OpenRA.Mods.D2k.dll"
fi
cd "${ORIG_PWD}" || exit 1
echo "Installing engine to ${DEST_PATH}"
install -d "${DEST_PATH}"
for LIB in "${SRC_PATH}/bin/"*.dll "${SRC_PATH}/bin/"*.dll.config; do
install -m644 "${LIB}" "${DEST_PATH}"
done
if [ "${TARGETPLATFORM}" = "linux-x64" ]; then
for LIB in "${SRC_PATH}/bin/"*.so; do
install -m755 "${LIB}" "${DEST_PATH}"
done
fi
if [ "${TARGETPLATFORM}" = "osx-x64" ]; then
for LIB in "${SRC_PATH}/bin/"*.dylib; do
install -m755 "${LIB}" "${DEST_PATH}"
done
fi
else
dotnet publish -c Release -p:TargetPlatform="${TARGETPLATFORM}" -p:PublishTrimmed=true -p:CopyGenericLauncher="${COPY_GENERIC_LAUNCHER}" -p:CopyCncDll="${COPY_CNC_DLL}" -p:CopyD2kDll="${COPY_D2K_DLL}" -r "${TARGETPLATFORM}" -o "${DEST_PATH}" --self-contained true
fi
cd "${ORIG_PWD}" || exit 1
}

View File

@@ -65,7 +65,7 @@ build_appimage() {
IS_D2K="True"
fi
install_assemblies "${SRCDIR}" "${APPDIR}/usr/lib/openra" "linux-x64" "True" "True" "${IS_D2K}"
install_assemblies "${SRCDIR}" "${APPDIR}/usr/lib/openra" "linux-x64" "net5" "True" "True" "${IS_D2K}"
install_data "${SRCDIR}" "${APPDIR}/usr/lib/openra" "${MOD_ID}"
set_engine_version "${TAG}" "${APPDIR}/usr/lib/openra"
set_mod_version "${TAG}" "${APPDIR}/usr/lib/openra/mods/${MOD_ID}/mod.yaml" "${APPDIR}/usr/lib/openra/mods/modcontent/mod.yaml"

View File

@@ -74,12 +74,12 @@ build_app() {
fi
# Install engine and mod files
RUNTIME="net5"
if [ "${PLATFORM}" = "compat" ]; then
install_assemblies_mono "${SRCDIR}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "True" "True" "${IS_D2K}"
else
install_assemblies "${SRCDIR}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "True" "True" "${IS_D2K}"
RUNTIME="mono"
fi
install_assemblies "${SRCDIR}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "${RUNTIME}" "True" "True" "${IS_D2K}"
install_data "${SRCDIR}" "${LAUNCHER_RESOURCES_DIR}" "${MOD_ID}"
set_engine_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}"
set_mod_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}/mods/${MOD_ID}/mod.yaml" "${LAUNCHER_RESOURCES_DIR}/mods/modcontent/mod.yaml"

View File

@@ -62,7 +62,7 @@ function build_platform()
USE_PROGRAMFILES32=""
fi
install_assemblies "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "False" "True" "True"
install_assemblies "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "net5" "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"