Compare commits

..

5 Commits

Author SHA1 Message Date
Paul Chote
759dc34e03 Use ULFO format for non-compat disk images (requires macOS 10.11+). 2020-12-23 23:34:53 +00:00
Paul Chote
668ab78b1b Trim unused assemblies to reduce packaged size further. 2020-12-23 23:00:17 +00:00
Paul Chote
c754d6a892 Replace duplicate runtime files with hardlinks to reduce dmg size. 2020-12-23 20:05:48 +00:00
Paul Chote
e9108479b5 Switch macOS packages to .NET 5. 2020-12-23 20:05:48 +00:00
teinarss
857da21b0f Add support for dotnet core for Windows 2020-12-23 18:41:27 +01:00
11 changed files with 99 additions and 26 deletions

View File

@@ -42,8 +42,14 @@ namespace OpenRA
var resolvedPath = FileSystem.FileSystem.ResolveAssemblyPath(path, manifest, mods);
if (resolvedPath == null)
throw new FileNotFoundException("Assembly `{0}` not found.".F(path));
#if !MONO
var loader = new AssemblyLoader(resolvedPath);
var platformType = loader.LoadDefaultAssembly();
assemblyList.Add(platformType);
#else
LoadAssembly(assemblyList, resolvedPath);
#endif
}
AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly;
@@ -60,7 +66,6 @@ namespace OpenRA
if (!ResolvedAssemblies.TryGetValue(hash, out var assembly))
{
#if MONO
assembly = Assembly.LoadFile(resolvedPath);
ResolvedAssemblies.Add(hash, assembly);
@@ -75,11 +80,6 @@ namespace OpenRA
LoadAssembly(assemblyList, depedencyPath);
}
}
#else
var loader = new AssemblyLoader(resolvedPath);
assembly = loader.LoadDefaultAssembly();
ResolvedAssemblies.Add(hash, assembly);
#endif
}
assemblyList.Add(assembly);

View File

@@ -9,8 +9,7 @@
*/
#endregion
// Not used/usable on Mono. Only used for Dotnet Core.
// Based on https://github.com/natemcmaster/DotNetCorePlugins and used under the terms of the Apache 2.0 license
// Not used/usable on Mono. Only used for Dotnet Core. Based on https://github.com/natemcmaster/DotNetCorePlugins
#if !MONO
using System;
using System.Collections.Generic;

View File

@@ -1,3 +1,6 @@
[[prereqs]]
name = "net-4.7.2"
[[actions]]
os = "windows"
name = "Red Alert"

View File

@@ -141,7 +141,7 @@ install_data() {
DEST_PATH="${2}"
shift 2
"${SRC_PATH}"/fetch-geoip.sh
"${SRC_PATH}"/fetch-geoip.sh
echo "Installing engine files to ${DEST_PATH}"
for FILE in VERSION AUTHORS COPYING IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP "global mix database.dat"; do

View File

@@ -2,15 +2,43 @@
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
"${HERE}/usr/bin/openra-{MODID}-server" "$@"
exec "openra-{MODID}-server" "$@"
elif [ -n "$1" ] && [ "$1" = "--utility" ]; then
# Drop the --utility argument
shift
"${HERE}/usr/bin/openra-{MODID}-utility" "$@"
exec "openra-{MODID}-utility" "$@"
else
"${HERE}/usr/bin/openra-{MODID}" "$@"
exec "openra-{MODID}" "$@"
fi

View File

@@ -19,6 +19,7 @@ cd "$(dirname "$0")" || exit 1
TAG="$1"
OUTPUTDIR="$2"
SRCDIR="$(pwd)/../.."
BUILTDIR="$(pwd)/build"
ARTWORK_DIR="$(pwd)/../artwork/"
UPDATE_CHANNEL=""
@@ -42,16 +43,30 @@ if [ ! -d "${OUTPUTDIR}" ]; then
fi
# Add native libraries
echo "Downloading appimagetool"
echo "Downloading dependencies"
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
# travis-ci doesn't support mounting FUSE filesystems so extract and run the contents manually
chmod a+x appimagetool-x86_64.AppImage
./appimagetool-x86_64.AppImage --appimage-extract
echo "Building AppImages"
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
build_appimage() {
MOD_ID=${1}
@@ -60,12 +75,14 @@ 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 "${SRCDIR}" "${APPDIR}/usr/lib/openra" "linux-x64" "True" "True" "${IS_D2K}"
install_assemblies_mono "${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"
@@ -96,7 +113,6 @@ 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}"
@@ -107,13 +123,14 @@ 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
ARCH=x86_64 ./appimagetool-x86_64.AppImage --no-appstream -u "zsync|https://master.openra.net/appimagecheck?mod=${MOD_ID}&channel=${UPDATE_CHANNEL}" "${APPDIR}" "${OUTPUTDIR}/${APPIMAGE}"
ARCH=x86_64 ./squashfs-root/AppRun --no-appstream -u "zsync|https://master.openra.net/appimagecheck?mod=${MOD_ID}&channel=${UPDATE_CHANNEL}" "${APPDIR}" "${OUTPUTDIR}/${APPIMAGE}"
zsyncmake -u "https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}/${APPIMAGE}" -o "${OUTPUTDIR}/${APPIMAGE}.zsync" "${OUTPUTDIR}/${APPIMAGE}"
else
ARCH=x86_64 ./appimagetool-x86_64.AppImage --no-appstream "${APPDIR}" "${OUTPUTDIR}/${APPIMAGE}"
ARCH=x86_64 ./squashfs-root/AppRun --no-appstream "${APPDIR}" "${OUTPUTDIR}/${APPIMAGE}"
fi
rm -rf "${APPDIR}"
@@ -124,4 +141,4 @@ build_appimage "cnc" "Tiberian Dawn" "699223250181292033"
build_appimage "d2k" "Dune 2000" "712711732770111550"
# Clean up
rm -rf appimagetool-x86_64.AppImage "${BUILTDIR}"
rm -rf appimagetool-x86_64.AppImage squashfs-root "${BUILTDIR}"

View File

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

View File

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

View File

@@ -0,0 +1,26 @@
#!/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 "$@"

View File

@@ -282,10 +282,10 @@ fi
if [ -n "${MACOS_DEVELOPER_USERNAME}" ] && [ -n "${MACOS_DEVELOPER_PASSWORD}" ]; then
# Parallelize processing
(notarize_package "build.dmg") &
(notarize_package "build-compat.dmg") &
(notarize_package "standard" "build.dmg") &
(notarize_package "compat" "build-compat.dmg") &
wait
fi
finalize_package "standard" "build.dmg" "${OUTPUTDIR}/OpenRA-${TAG}.dmg"
finalize_package "compat" "build-compat.dmg" "${OUTPUTDIR}/OpenRA-${TAG}-compat.dmg"
finalize_package "build.dmg" "${OUTPUTDIR}/OpenRA-${TAG}.dmg"
finalize_package "build-compat.dmg" "${OUTPUTDIR}/OpenRA-${TAG}-compat.dmg"