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
}