Package mono 5.10 in the AppImages.

This commit is contained in:
Paul Chote
2019-03-15 22:44:22 +00:00
committed by Oliver Brakmann
parent 2ba2510018
commit 2afd8a3a74
3 changed files with 37 additions and 75 deletions

View File

@@ -1,71 +1,23 @@
#!/bin/sh #!/bin/sh
# Make sure the user has a sufficiently recent version of mono on the PATH
MINIMUM_MONO_VERSION="4.2"
prompt_apt_install_mono_complete() {
command -v mono >/dev/null 2>&1 && command -v cert-sync >/dev/null 2>&1 && return 1
command -v apt-cache > /dev/null || return 1
command -v xdg-mime > /dev/null || return 1
command -v xdg-open > /dev/null || return 1
[ ! "$(xdg-mime query default x-scheme-handler/apt)" ] && return 1
apt-cache search --names-only mono-complete | cut -d' ' -f1 | grep "^mono-complete$" > /dev/null || return 1
return 0
}
make_version() {
echo "$1" | tr '.' '\n' | head -n 4 | xargs printf "%03d%03d%03d%03d";
}
mono_missing_or_old() {
command -v mono >/dev/null 2>&1 || return 0
command -v cert-sync >/dev/null 2>&1 || return 0
MONO_VERSION=$(mono --version | head -n1 | cut -d' ' -f5)
[ "$(make_version "${MONO_VERSION}")" -lt "$(make_version "${MINIMUM_MONO_VERSION}")" ] && return 0
return 1
}
HERE="$(dirname "$(readlink -f "${0}")")" HERE="$(dirname "$(readlink -f "${0}")")"
export PATH="${HERE}"/usr/bin/:"${PATH}"
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
# If mono is not installed, and the user has apt-cache, apt-url, # Override runtime paths
# xdg-open, and either zenity or kdialog, then we can prompt to export PATH="${HERE}/usr/bin:${PATH}"
# automatically install the mono-complete package export XDG_DATA_DIRS="${HERE}/usr/share:${XDG_DATA_DIRS}"
if prompt_apt_install_mono_complete; then export DYLD_LIBRARY_PATH="${HERE}/usr/lib:$DYLD_LIBRARY_PATH"
PROMPT_MESSAGE="{MODNAME} requires the Mono runtime.\nWould you like to install it now?" export LD_LIBRARY_PATH="${HERE}/usr/lib:$LD_LIBRARY_PATH"
if command -v zenity > /dev/null; then export MONO_PATH="${HERE}/usr/lib/mono/4.5"
zenity --no-wrap --question --title "{MODNAME}" --text "${PROMPT_MESSAGE}" 2> /dev/null && xdg-open apt://mono-complete && exit 0 export MONO_CFG_DIR="${HERE}/etc"
elif command -v kdialog > /dev/null; then export MONO_CONFIG="${HERE}/etc/mono/config"
kdialog --title "{MODNAME}" --yesno "${PROMPT_MESSAGE}" && xdg-open apt://mono-complete && exit 0
elif "${HERE}/usr/bin/gtk-dialog.py" test > /dev/null; then
"${HERE}/usr/bin/gtk-dialog.py" question --title "{MODNAME}" --text "${PROMPT_MESSAGE}" 2> /dev/null && xdg-open apt://mono-complete && exit 0
fi
fi
if mono_missing_or_old; then # Update/create the mono certificate store to enable https web queries
ERROR_MESSAGE="{MODNAME} requires Mono ${MINIMUM_MONO_VERSION} or greater and the cert-sync utility.\nPlease install Mono using your system package manager.\n\nSee http://wiki.openra.net/AppImages for more information." if [ -f "/etc/pki/tls/certs/ca-bundle.crt" ]; then
if command -v zenity > /dev/null; then mono "${HERE}/usr/lib/mono/4.5/cert-sync.exe" --quiet --user /etc/pki/tls/certs/ca-bundle.crt
zenity --no-wrap --error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null elif [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then
elif command -v kdialog > /dev/null; then mono "${HERE}/usr/lib/mono/4.5/cert-sync.exe" --quiet --user /etc/ssl/certs/ca-certificates.crt
kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}" else
elif "${HERE}/usr/bin/gtk-dialog.py" test > /dev/null; then echo "WARNING: Unable to sync system certificate store - https requests will fail"
"${HERE}/usr/bin/gtk-dialog.py" error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null
else
printf "${ERROR_MESSAGE}"
fi
exit 1
fi
# Some distros and self-compiled mono installations don't set up
# the SSL required for http web queries. If we detect that these
# are missing we can try and create a local sync as a fallback.
if [ ! -d "/usr/share/.mono/certs" ] && [ ! -d "${HOME}/.config/.mono/certs" ]; then
if [ -f "/etc/pki/tls/certs/ca-bundle.crt" ]; then
cert-sync --quiet --user /etc/pki/tls/certs/ca-bundle.crt
elif [ -f "/etc/ssl/certs/ca-certificates.crt" ]; then
cert-sync --quiet --user /etc/ssl/certs/ca-certificates.crt
fi
fi fi
# Run the game or server # Run the game or server

View File

@@ -7,7 +7,7 @@ command -v python >/dev/null 2>&1 || { echo >&2 "Linux packaging requires python
command -v tar >/dev/null 2>&1 || { echo >&2 "Linux packaging requires tar."; exit 1; } command -v tar >/dev/null 2>&1 || { echo >&2 "Linux packaging requires tar."; exit 1; }
command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Linux packaging requires curl or wget."; exit 1; } command -v curl >/dev/null 2>&1 || command -v wget > /dev/null 2>&1 || { echo >&2 "Linux packaging requires curl or wget."; exit 1; }
DEPENDENCIES_TAG="20180723" DEPENDENCIES_TAG="20190316"
if [ $# -eq "0" ]; then if [ $# -eq "0" ]; then
echo "Usage: $(basename "$0") version [outputdir]" echo "Usage: $(basename "$0") version [outputdir]"
@@ -46,6 +46,7 @@ echo "Building core files"
pushd "${SRCDIR}" > /dev/null || exit 1 pushd "${SRCDIR}" > /dev/null || exit 1
make linux-dependencies make linux-dependencies
sed "s/@LIBLUA51@/liblua5.1.so.0/" thirdparty/Eluant.dll.config.in > Eluant.dll.config
make core SDK="-sdk:4.5" make core SDK="-sdk:4.5"
make version VERSION="${TAG}" make version VERSION="${TAG}"
make install-engine prefix="usr" DESTDIR="${BUILTDIR}/" make install-engine prefix="usr" DESTDIR="${BUILTDIR}/"
@@ -66,14 +67,25 @@ fi
chmod a+x appimagetool-x86_64.AppImage chmod a+x appimagetool-x86_64.AppImage
echo "Building AppImage" echo "Building AppImage"
tar xf libs.tar.bz2 mkdir libs
install -Dm 0755 libSDL2.so "${BUILTDIR}/usr/lib/openra/" pushd libs
install -Dm 0644 SDL2-CS.dll.config "${BUILTDIR}/usr/lib/openra/" tar xf ../libs.tar.bz2
install -Dm 0755 libopenal.so "${BUILTDIR}/usr/lib/openra/"
install -Dm 0644 OpenAL-CS.dll.config "${BUILTDIR}/usr/lib/openra/" install -d "${BUILTDIR}/usr/bin"
install -Dm 0755 liblua.so "${BUILTDIR}/usr/lib/openra/" install -d "${BUILTDIR}/etc/mono/4.5"
install -Dm 0644 Eluant.dll.config "${BUILTDIR}/usr/lib/openra/" install -d "${BUILTDIR}/usr/lib/mono/4.5"
rm libs.tar.bz2 libSDL2.so SDL2-CS.dll.config libopenal.so OpenAL-CS.dll.config liblua.so Eluant.dll.config
install -Dm 0755 usr/bin/mono "${BUILTDIR}/usr/bin/"
install -Dm 0644 /etc/mono/config "${BUILTDIR}/etc/mono/"
install -Dm 0644 /etc/mono/4.5/machine.config "${BUILTDIR}/etc/mono/4.5"
for f in $(ls usr/lib/mono/4.5/*.dll usr/lib/mono/4.5/*.exe); do install -Dm 0644 "$f" "${BUILTDIR}/usr/lib/mono/4.5/"; done
for f in $(ls usr/lib/*.so usr/lib/*.so.*); do install -Dm 0755 "$f" "${BUILTDIR}/usr/lib/"; done
popd
rm -rf libs libs.tar.bz2
build_appimage() { build_appimage() {
MOD_ID=${1} MOD_ID=${1}
@@ -112,8 +124,6 @@ build_appimage() {
fi fi
done done
install -d "${APPDIR}/usr/bin"
sed "s/{MODID}/${MOD_ID}/g" openra.appimage.in | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > openra-mod.temp sed "s/{MODID}/${MOD_ID}/g" openra.appimage.in | sed "s/{TAG}/${TAG}/g" | sed "s/{MODNAME}/${DISPLAY_NAME}/g" > openra-mod.temp
install -m 0755 openra-mod.temp "${APPDIR}/usr/bin/openra-${MOD_ID}" install -m 0755 openra-mod.temp "${APPDIR}/usr/bin/openra-${MOD_ID}"

View File

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