Switch Appimages to net 5.

This commit is contained in:
Paul Chote
2020-12-30 15:21:39 +00:00
committed by abcdefg30
parent 2fae69c0ba
commit 69ffd70d3f
7 changed files with 11 additions and 80 deletions

View File

@@ -16,7 +16,6 @@
# 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)
# Linux AppImage packaging
# Mod SDK Linux AppImage packaging
# Mod SDK macOS packaging
# Mod SDK Windows packaging
@@ -107,6 +106,7 @@ install_assemblies_mono() {
# Used by:
# Windows packaging
# macOS packaging
# Linux AppImage packaging
install_assemblies() {
SRC_PATH="${1}"
DEST_PATH="${2}"

View File

@@ -2,43 +2,15 @@
HERE="$(dirname "$(readlink -f "${0}")")"
# Stash original environment values so they can be restored
# when switching to other mods using restore-environment
export OPENRA_ORIG_PATH="${PATH}"
export OPENRA_ORIG_XDG_DATA_DIRS="${XDG_DATA_DIRS}"
export OPENRA_ORIG_DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}"
export OPENRA_ORIG_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
export OPENRA_ORIG_MONO_PATH="${MONO_PATH}"
export OPENRA_ORIG_MONO_CFG_DIR="${MONO_CFG_DIR}"
export OPENRA_ORIG_MONO_CONFIG="${MONO_CONFIG}"
# Override runtime paths to use bundled mono and shared libraries
export PATH="${HERE}/usr/bin:${PATH}"
export XDG_DATA_DIRS="${HERE}/usr/share:${XDG_DATA_DIRS}"
export DYLD_LIBRARY_PATH="${HERE}/usr/lib:${DYLD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}"
export MONO_PATH="${HERE}/usr/lib/mono/4.5"
export MONO_CFG_DIR="${HERE}/etc"
export MONO_CONFIG="${HERE}/etc/mono/config"
# Update/create the mono certificate store to enable https web queries
if [ -f "/etc/pki/tls/certs/ca-bundle.crt" ]; then
mono "${HERE}/usr/lib/mono/4.5/cert-sync.exe" --quiet --user /etc/pki/tls/certs/ca-bundle.crt
elif [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then
mono "${HERE}/usr/lib/mono/4.5/cert-sync.exe" --quiet --user /etc/ssl/certs/ca-certificates.crt
else
echo "WARNING: Unable to sync system certificate store - https requests will fail"
fi
# Run the game or server
if [ -n "$1" ] && [ "$1" = "--server" ]; then
# Drop the --server argument
shift
exec "openra-{MODID}-server" "$@"
"${HERE}/usr/bin/openra-{MODID}-server" "$@"
elif [ -n "$1" ] && [ "$1" = "--utility" ]; then
# Drop the --utility argument
shift
exec "openra-{MODID}-utility" "$@"
"${HERE}/usr/bin/openra-{MODID}-utility" "$@"
else
exec "openra-{MODID}" "$@"
"${HERE}/usr/bin/openra-{MODID}" "$@"
fi

View File

@@ -19,7 +19,6 @@ cd "$(dirname "$0")" || exit 1
TAG="$1"
OUTPUTDIR="$2"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
ARTWORK_DIR="$(pwd)/../artwork/"
UPDATE_CHANNEL=""
@@ -43,28 +42,16 @@ if [ ! -d "${OUTPUTDIR}" ]; then
fi
# Add native libraries
echo "Downloading dependencies"
echo "Downloading appimagetool"
if command -v curl >/dev/null 2>&1; then
curl -s -L -O https://github.com/OpenRA/AppImageSupport/releases/download/${DEPENDENCIES_TAG}/mono.tar.bz2 || exit 3
curl -s -L -O https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3
else
wget -cq https://github.com/OpenRA/AppImageSupport/releases/download/${DEPENDENCIES_TAG}/mono.tar.bz2 || exit 3
wget -cq https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage || exit 3
fi
chmod a+x appimagetool-x86_64.AppImage
echo "Building AppImage"
mkdir "${BUILTDIR}"
tar xf mono.tar.bz2 -C "${BUILTDIR}"
chmod 0755 "${BUILTDIR}/usr/bin/mono"
chmod 0644 "${BUILTDIR}/etc/mono/config"
chmod 0644 "${BUILTDIR}/etc/mono/4.5/machine.config"
chmod 0644 "${BUILTDIR}/usr/lib/mono/4.5/Facades/"*.dll
chmod 0644 "${BUILTDIR}/usr/lib/mono/4.5/"*.dll "${BUILTDIR}/usr/lib/mono/4.5/"*.exe
chmod 0755 "${BUILTDIR}/usr/lib/"*.so
rm -rf mono.tar.bz2
echo "Building AppImages"
build_appimage() {
MOD_ID=${1}
@@ -73,14 +60,12 @@ build_appimage() {
APPDIR="$(pwd)/${MOD_ID}.appdir"
APPIMAGE="OpenRA-$(echo "${DISPLAY_NAME}" | sed 's/ /-/g')${SUFFIX}-x86_64.AppImage"
cp -r "${BUILTDIR}" "${APPDIR}"
IS_D2K="False"
if [ "${MOD_ID}" = "d2k" ]; then
IS_D2K="True"
fi
install_assemblies_mono "${SRCDIR}" "${APPDIR}/usr/lib/openra" "linux-x64" "True" "True" "${IS_D2K}"
install_assemblies "${SRCDIR}" "${APPDIR}/usr/lib/openra" "linux-x64" "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"
@@ -111,6 +96,7 @@ build_appimage() {
fi
done
mkdir -p "${APPDIR}/usr/bin"
sed "s/{MODID}/${MOD_ID}/g" openra.appimage.in | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > "${APPDIR}/usr/bin/openra-${MOD_ID}"
chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}"
@@ -121,7 +107,6 @@ build_appimage() {
chmod 0755 "${APPDIR}/usr/bin/openra-${MOD_ID}-utility"
install -m 0755 gtk-dialog.py "${APPDIR}/usr/bin/gtk-dialog.py"
install -m 0755 restore-environment.sh "${APPDIR}/usr/bin/restore-environment.sh"
# Embed update metadata if (and only if) compiled on GitHub Actions
if [ -n "${GITHUB_REPOSITORY}" ]; then

View File

@@ -2,4 +2,4 @@
HERE="$(dirname "$(readlink -f "${0}")")"
cd "${HERE}/../lib/openra" || exit 1
mono --debug OpenRA.Server.dll Game.Mod="{MODID}" "$@"
./OpenRA.Server Game.Mod="{MODID}" "$@"

View File

@@ -2,4 +2,4 @@
# OpenRA.Utility relies on keeping the original working directory, so don't change directory
HERE="$(dirname "$(readlink -f "${0}")")"
mono --debug "${HERE}/../lib/openra/OpenRA.Utility.dll" {MODID} "$@"
"${HERE}/../lib/openra/OpenRA.Utility" {MODID} "$@"

View File

@@ -35,7 +35,7 @@ fi
# Run the game
export SDL_VIDEO_X11_WMCLASS="openra-{MODID}-{TAG}"
mono --debug OpenRA.dll Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" Engine.LaunchWrapper="${HERE}/restore-environment.sh" "${JOIN_SERVER}" "$@"
./OpenRA Game.Mod={MODID} Engine.LaunchPath="${LAUNCHER}" "${JOIN_SERVER}" "$@"
# Show a crash dialog if something went wrong
if [ $? != 0 ] && [ $? != 1 ]; then

View File

@@ -1,26 +0,0 @@
#!/bin/sh
# Restore the environment variables that were set by AppRun
export PATH="${OPENRA_ORIG_PATH}"
export XDG_DATA_DIRS="${OPENRA_ORIG_XDG_DATA_DIRS}"
export DYLD_LIBRARY_PATH="${OPENRA_ORIG_DYLD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${OPENRA_ORIG_LD_LIBRARY_PATH}"
unset OPENRA_ORIG_PATH OPENRA_ORIG_XDG_DATA_DIRS OPENRA_ORIG_DYLD_LIBRARY_PATH OPENRA_ORIG_LD_LIBRARY_PATH
unset MONO_PATH MONO_CFG_DIR MONO_CONFIG
if [ -n "${OPENRA_ORIG_MONO_PATH}" ]; then
export MONO_PATH="${OPENRA_ORIG_MONO_PATH}"
fi
if [ -n "${OPENRA_ORIG_MONO_CFG_DIR}" ]; then
export MONO_CFG_DIR="${OPENRA_ORIG_MONO_CFG_DIR}"
fi
if [ -n "${OPENRA_ORIG_MONO_CONFIG}" ]; then
export MONO_CONFIG="${OPENRA_ORIG_MONO_CONFIG}"
fi
unset SDL_VIDEO_X11_WMCLASS OPENRA_ORIG_MONO_PATH OPENRA_ORIG_MONO_CFG_DIR OPENRA_ORIG_MONO_CONFIG
# Run the given command
exec "$@"