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

@@ -7,16 +7,16 @@
# make RUNTIME=mono # make RUNTIME=mono
# #
# to compile using system libraries for native dependencies, run: # to compile using system libraries for native dependencies, run:
# make [RUNTIME=dotnet] TARGETPLATFORM=unix-generic # make [RUNTIME=net5] TARGETPLATFORM=unix-generic
# #
# to check the official mods for erroneous yaml files, run: # to check the official mods for erroneous yaml files, run:
# make [RUNTIME=dotnet] test # make [RUNTIME=net5] test
# #
# to check the engine and official mod dlls for code style violations, run: # to check the engine and official mod dlls for code style violations, run:
# make [RUNTIME=dotnet] check # make [RUNTIME=net5] check
# #
# to compile and install Red Alert, Tiberian Dawn, and Dune 2000, run: # to compile and install Red Alert, Tiberian Dawn, and Dune 2000, run:
# make [RUNTIME=dotnet] [prefix=/foo] [bindir=/bar/bin] install # make [RUNTIME=net5] [prefix=/foo] [bindir=/bar/bin] install
# #
# to compile and install Red Alert, Tiberian Dawn, and Dune 2000 # to compile and install Red Alert, Tiberian Dawn, and Dune 2000
# using system libraries for native dependencies, run: # using system libraries for native dependencies, run:
@@ -53,8 +53,9 @@ RM_R = $(RM) -r
RM_F = $(RM) -f RM_F = $(RM) -f
RM_RF = $(RM) -rf RM_RF = $(RM) -rf
RUNTIME ?= dotnet RUNTIME ?= net5
CONFIGURATION ?= Release CONFIGURATION ?= Release
# Only for use in target version: # Only for use in target version:
VERSION := $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || (c=$$(git rev-parse --short HEAD 2>/dev/null) && echo git-$$c)) VERSION := $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || (c=$$(git rev-parse --short HEAD 2>/dev/null) && echo git-$$c))
@@ -143,11 +144,7 @@ endif
@sh -c '. ./packaging/functions.sh; set_mod_version "$(VERSION)" mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml' @sh -c '. ./packaging/functions.sh; set_mod_version "$(VERSION)" mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml'
install: install:
ifeq ($(RUNTIME), mono) @sh -c '. ./packaging/functions.sh; install_assemblies $(CWD) $(DESTDIR)$(gameinstalldir) $(TARGETPLATFORM) $(RUNTIME) True True True'
@sh -c '. ./packaging/functions.sh; install_assemblies_mono $(CWD) $(DESTDIR)$(gameinstalldir) $(TARGETPLATFORM) True True True'
else
@sh -c '. ./packaging/functions.sh; install_assemblies $(CWD) $(DESTDIR)$(gameinstalldir) $(TARGETPLATFORM) True True True'
endif
@sh -c '. ./packaging/functions.sh; install_data $(CWD) $(DESTDIR)$(gameinstalldir) cnc d2k ra' @sh -c '. ./packaging/functions.sh; install_data $(CWD) $(DESTDIR)$(gameinstalldir) cnc d2k ra'
install-linux-shortcuts: install-linux-shortcuts:
@@ -164,20 +161,20 @@ help:
@echo ' make RUNTIME=mono' @echo ' make RUNTIME=mono'
@echo @echo
@echo 'to compile using system libraries for native dependencies, run:' @echo 'to compile using system libraries for native dependencies, run:'
@echo ' make [RUNTIME=dotnet] TARGETPLATFORM=unix-generic' @echo ' make [RUNTIME=net5] TARGETPLATFORM=unix-generic'
@echo @echo
@echo 'to check the official mods for erroneous yaml files, run:' @echo 'to check the official mods for erroneous yaml files, run:'
@echo ' make [RUNTIME=dotnet] test' @echo ' make [RUNTIME=net5] test'
@echo @echo
@echo 'to check the engine and official mod dlls for code style violations, run:' @echo 'to check the engine and official mod dlls for code style violations, run:'
@echo ' make [RUNTIME=dotnet] check' @echo ' make [RUNTIME=net5] check'
@echo @echo
@echo 'to compile and install Red Alert, Tiberian Dawn, and Dune 2000 run:' @echo 'to compile and install Red Alert, Tiberian Dawn, and Dune 2000 run:'
@echo ' make [RUNTIME=dotnet] [prefix=/foo] [TARGETPLATFORM=unix-generic] install' @echo ' make [RUNTIME=net5] [prefix=/foo] [TARGETPLATFORM=unix-generic] install'
@echo @echo
@echo 'to compile and install Red Alert, Tiberian Dawn, and Dune 2000' @echo 'to compile and install Red Alert, Tiberian Dawn, and Dune 2000'
@echo 'using system libraries for native dependencies, run:' @echo 'using system libraries for native dependencies, run:'
@echo ' make [RUNTIME=dotnet] [prefix=/foo] [bindir=/bar/bin] TARGETPLATFORM=unix-generic install' @echo ' make [RUNTIME=net5] [prefix=/foo] [bindir=/bar/bin] TARGETPLATFORM=unix-generic install'
@echo @echo
@echo 'to install Linux startup scripts, desktop files, icons, and MIME metadata' @echo 'to install Linux startup scripts, desktop files, icons, and MIME metadata'
@echo ' make install-linux-shortcuts' @echo ' make install-linux-shortcuts'

View File

@@ -6,78 +6,12 @@
# Copy-paste the entire script into http://shellcheck.net to check. # 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 # Compile and publish the core engine and specified mod assemblies to the target directory
# Arguments: # Arguments:
# SRC_PATH: Path to the root OpenRA directory # SRC_PATH: Path to the root OpenRA directory
# DEST_PATH: Path to the root of the install destination (will be created if necessary) # 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) # 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_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_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) # 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 # Windows packaging
# macOS packaging # macOS packaging
# Linux AppImage packaging # Linux AppImage packaging
# Mod SDK Windows packaging
# Mod SDK macOS packaging
# Mod SDK Linux AppImage packaging
install_assemblies() { install_assemblies() {
SRC_PATH="${1}" SRC_PATH="${1}"
DEST_PATH="${2}" DEST_PATH="${2}"
TARGETPLATFORM="${3}" TARGETPLATFORM="${3}"
COPY_GENERIC_LAUNCHER="${4}" RUNTIME="${4}"
COPY_CNC_DLL="${5}" COPY_GENERIC_LAUNCHER="${5}"
COPY_D2K_DLL="${6}" COPY_CNC_DLL="${6}"
COPY_D2K_DLL="${7}"
ORIG_PWD=$(pwd) ORIG_PWD=$(pwd)
cd "${SRC_PATH}" || exit 1 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 cd "${ORIG_PWD}" || exit 1
} }

View File

@@ -65,7 +65,7 @@ build_appimage() {
IS_D2K="True" IS_D2K="True"
fi 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}" install_data "${SRCDIR}" "${APPDIR}/usr/lib/openra" "${MOD_ID}"
set_engine_version "${TAG}" "${APPDIR}/usr/lib/openra" 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" 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 fi
# Install engine and mod files # Install engine and mod files
RUNTIME="net5"
if [ "${PLATFORM}" = "compat" ]; then if [ "${PLATFORM}" = "compat" ]; then
install_assemblies_mono "${SRCDIR}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "True" "True" "${IS_D2K}" RUNTIME="mono"
else
install_assemblies "${SRCDIR}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "True" "True" "${IS_D2K}"
fi fi
install_assemblies "${SRCDIR}" "${LAUNCHER_ASSEMBLY_DIR}" "osx-x64" "${RUNTIME}" "True" "True" "${IS_D2K}"
install_data "${SRCDIR}" "${LAUNCHER_RESOURCES_DIR}" "${MOD_ID}" install_data "${SRCDIR}" "${LAUNCHER_RESOURCES_DIR}" "${MOD_ID}"
set_engine_version "${TAG}" "${LAUNCHER_RESOURCES_DIR}" 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" 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="" USE_PROGRAMFILES32=""
fi 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" install_data "${SRCDIR}" "${BUILTDIR}" "cnc" "d2k" "ra"
set_engine_version "${TAG}" "${BUILTDIR}" 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" set_mod_version "${TAG}" "${BUILTDIR}/mods/cnc/mod.yaml" "${BUILTDIR}/mods/d2k/mod.yaml" "${BUILTDIR}/mods/ra/mod.yaml" "${BUILTDIR}/mods/modcontent/mod.yaml"