diff --git a/packaging/linux/AppRun.in b/packaging/linux/AppRun.in index b159a359e5..97a12312ea 100755 --- a/packaging/linux/AppRun.in +++ b/packaging/linux/AppRun.in @@ -1,71 +1,23 @@ #!/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}")")" -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, -# xdg-open, and either zenity or kdialog, then we can prompt to -# automatically install the mono-complete package -if prompt_apt_install_mono_complete; then - PROMPT_MESSAGE="{MODNAME} requires the Mono runtime.\nWould you like to install it now?" - if command -v zenity > /dev/null; then - zenity --no-wrap --question --title "{MODNAME}" --text "${PROMPT_MESSAGE}" 2> /dev/null && xdg-open apt://mono-complete && exit 0 - elif command -v kdialog > /dev/null; then - 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 +# Override runtime paths +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" -if mono_missing_or_old; then - 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 command -v zenity > /dev/null; then - zenity --no-wrap --error --title "{MODNAME}" --text "${ERROR_MESSAGE}" 2> /dev/null - elif command -v kdialog > /dev/null; then - kdialog --title "{MODNAME}" --error "${ERROR_MESSAGE}" - elif "${HERE}/usr/bin/gtk-dialog.py" test > /dev/null; then - "${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 +# 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 diff --git a/packaging/linux/buildpackage.sh b/packaging/linux/buildpackage.sh index c111e6f611..b537110e0d 100755 --- a/packaging/linux/buildpackage.sh +++ b/packaging/linux/buildpackage.sh @@ -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 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 echo "Usage: $(basename "$0") version [outputdir]" @@ -46,6 +46,7 @@ echo "Building core files" pushd "${SRCDIR}" > /dev/null || exit 1 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 version VERSION="${TAG}" make install-engine prefix="usr" DESTDIR="${BUILTDIR}/" @@ -66,14 +67,25 @@ fi chmod a+x appimagetool-x86_64.AppImage echo "Building AppImage" -tar xf libs.tar.bz2 -install -Dm 0755 libSDL2.so "${BUILTDIR}/usr/lib/openra/" -install -Dm 0644 SDL2-CS.dll.config "${BUILTDIR}/usr/lib/openra/" -install -Dm 0755 libopenal.so "${BUILTDIR}/usr/lib/openra/" -install -Dm 0644 OpenAL-CS.dll.config "${BUILTDIR}/usr/lib/openra/" -install -Dm 0755 liblua.so "${BUILTDIR}/usr/lib/openra/" -install -Dm 0644 Eluant.dll.config "${BUILTDIR}/usr/lib/openra/" -rm libs.tar.bz2 libSDL2.so SDL2-CS.dll.config libopenal.so OpenAL-CS.dll.config liblua.so Eluant.dll.config +mkdir libs +pushd libs +tar xf ../libs.tar.bz2 + +install -d "${BUILTDIR}/usr/bin" +install -d "${BUILTDIR}/etc/mono/4.5" +install -d "${BUILTDIR}/usr/lib/mono/4.5" + +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() { MOD_ID=${1} @@ -112,8 +124,6 @@ build_appimage() { fi 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 install -m 0755 openra-mod.temp "${APPDIR}/usr/bin/openra-${MOD_ID}" diff --git a/packaging/linux/openra-utility.appimage.in b/packaging/linux/openra-utility.appimage.in index c648c6b895..3c96c1bc6b 100755 --- a/packaging/linux/openra-utility.appimage.in +++ b/packaging/linux/openra-utility.appimage.in @@ -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.exe {MODID} "$@" +mono --debug "${HERE}/../lib/openra/OpenRA.Utility.exe" {MODID} "$@"