From eca47e759da873cbcfd5444e71b56536b4e65181 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Wed, 5 Aug 2026 22:36:08 +0100 Subject: [PATCH] games-fps/unreal: New package for the original Unreal engine The data will be in a separate package. Signed-off-by: James Le Cuirot --- games-fps/unreal/Manifest | 2 + games-fps/unreal/files/unreal-ded.confd | 6 ++ games-fps/unreal/files/unreal-ded.initd | 13 +++ games-fps/unreal/files/wrapper.sh | 33 +++++++ games-fps/unreal/metadata.xml | 11 +++ games-fps/unreal/unreal-227k_p14.ebuild | 118 ++++++++++++++++++++++++ 6 files changed, 183 insertions(+) create mode 100644 games-fps/unreal/Manifest create mode 100644 games-fps/unreal/files/unreal-ded.confd create mode 100644 games-fps/unreal/files/unreal-ded.initd create mode 100644 games-fps/unreal/files/wrapper.sh create mode 100644 games-fps/unreal/metadata.xml create mode 100644 games-fps/unreal/unreal-227k_p14.ebuild diff --git a/games-fps/unreal/Manifest b/games-fps/unreal/Manifest new file mode 100644 index 0000000000000..21a52ec092ac9 --- /dev/null +++ b/games-fps/unreal/Manifest @@ -0,0 +1,2 @@ +DIST OldUnreal-UnrealPatch227k-Linux.tar.bz2 132328627 BLAKE2B 339d297cfce38f5e0c0fb35c1508724b232080e9defadeabc34694a906d786d7358c2aba8d6123a0661cfe77bfae91cf8d2d5e409d5123f8ea3f0f2bd578542f SHA512 78f119458f6cdfad812986c4714f6dd5579de401ed32e732accca49509426977f0b3e9fcd471200e4cb12d15c9e0a5364e12379c4c709e7aefc3f7aff8d242ca +DIST unreal.png 18061 BLAKE2B 36ab2991946abf53fc5a228b145d4306251251c72e58fafa1c2ff407713b1ee44faaae6c3761bc58f98ba1a67296d451bca3efb78c2a3838d3ff8c846742da62 SHA512 d5c038f030b021f993d7063a100d34687154c3d21dc6094a1932623a6219b6590e435c5c4777fffc5f07660784f4f1197179cc2a34f213338c0077f1763221a7 diff --git a/games-fps/unreal/files/unreal-ded.confd b/games-fps/unreal/files/unreal-ded.confd new file mode 100644 index 0000000000000..9e49d61fa0658 --- /dev/null +++ b/games-fps/unreal/files/unreal-ded.confd @@ -0,0 +1,6 @@ +# User and group the server should run as. A valid HOME is required. +ut_ded_user="unreal" +ut_ded_group="unreal" + +# Any extra options you want to pass to the server. +ut_ded_opts="DmDeck16" diff --git a/games-fps/unreal/files/unreal-ded.initd b/games-fps/unreal/files/unreal-ded.initd new file mode 100644 index 0000000000000..ac8a1dabf7543 --- /dev/null +++ b/games-fps/unreal/files/unreal-ded.initd @@ -0,0 +1,13 @@ +#!/sbin/openrc-run +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +pidfile="/var/run/${RC_SVCNAME}.pid" +command_background="true" +command_user="${ut_ded_user}:${ut_ded_group}" +command="unreal-ucc" +command_args="server ${ut_ded_opts}" + +depend() { + need net +} diff --git a/games-fps/unreal/files/wrapper.sh b/games-fps/unreal/files/wrapper.sh new file mode 100644 index 0000000000000..b61632cee238c --- /dev/null +++ b/games-fps/unreal/files/wrapper.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -euo pipefail + +Unreal="@EPREFIX@/opt/unreal" +MyUnreal="${HOME}/.Unreal" +MyIni="${MyUnreal}/System/UnrealLinux.ini" +MyUserIni="${MyUnreal}/System/User.ini" +System="${Unreal}/@System@" + +mkdir -p "${MyUnreal}"/System +cp --update=none "${System}"/DefaultLinux.ini "${MyIni}" + +# XOpenGLDrv.XOpenGLRenderDevice seems broken on arm64. +# https://github.com/OldUnreal/Unreal-testing/issues/442 +[[ "@System@" == SystemARM64 ]] && + sed -i "/^\[Engine\.Engine\]/,/^\[/s:^GameRenderDevice=.*:GameRenderDevice=OpenGLDrv.OpenGLRenderDevice:" "${MyIni}" + +lang=${LC_MESSAGES:-${LC_ALL:-${LANG:-in}}} +[[ ${lang} == en* ]] && lang=in +sed -i "/^\[Engine\.Engine\]/,/^\[/s:^Language=.*:Language=${lang:0:2}t:" "${MyIni}" + +# Allow the game to be used system-wide from an unwritable location. Note that +# saves do not load unless SavePath is relative for some reason. +# https://github.com/OldUnreal/Unreal-testing/issues/455 +sed -i -e "/^;AddedByGentoo=/{N;d}" -e "/^\[Core\.System\]/,/^\[/{ + s:^\(Cache\|Save\)Path=.*:\1Path=$(realpath --relative-to="${System}" "${MyUnreal}")/\1: + s:^\(Lang\)\?Paths=\.\./\(.*\):;AddedByGentoo=\n\1Paths=${MyUnreal}/\2\n\0: +}" "${MyIni}" + +exe=${0##*/} +exe=${exe#unreal-} +exec "${System}/${exe}-bin" "${@}" -ini="${MyIni}" -userini="${MyUserIni}" diff --git a/games-fps/unreal/metadata.xml b/games-fps/unreal/metadata.xml new file mode 100644 index 0000000000000..7ddd0e834ef75 --- /dev/null +++ b/games-fps/unreal/metadata.xml @@ -0,0 +1,11 @@ + + + + + games@gentoo.org + Gentoo Games Project + + + OldUnreal/Unreal-testing + + diff --git a/games-fps/unreal/unreal-227k_p14.ebuild b/games-fps/unreal/unreal-227k_p14.ebuild new file mode 100644 index 0000000000000..d4d668fb847b5 --- /dev/null +++ b/games-fps/unreal/unreal-227k_p14.ebuild @@ -0,0 +1,118 @@ +# Copyright 2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit desktop xdg + +DESCRIPTION="Modern build of the original Unreal engine" +HOMEPAGE="https://www.oldunreal.com/downloads/unreal/oldunreal-patches/" +SRC_URI=" + https://github.com/OldUnreal/Unreal-testing/releases/download/v${PV/_p/_}/OldUnreal-UnrealPatch${PV%_p*}-Linux.tar.bz2 + mirror+https://dev.gentoo.org/~chewi/distfiles/${PN}.png +" +S="${WORKDIR}" + +LICENSE="Epic-TOS Apache-2.0 BSD BSD-2 HappyBunny libpng2 MIT OFL-1.1 ZLIB" # See LICENSE.md +SLOT="0" +KEYWORDS="-* ~amd64 ~arm64 ~x86" +IUSE="dedicated l10n_ca l10n_de l10n_el l10n_es l10n_fr l10n_it l10n_nl l10n_pl l10n_pt l10n_ru opengl" +RESTRICT="bindist mirror strip" + +UT_DEPEND="games-fps/unreal-gold-data-226" + +BDEPEND=" + dev-util/patchelf +" +RDEPEND=" + media-libs/libglvnd + media-libs/libsdl3[opengl] + media-libs/libsndfile + media-libs/libxmp + media-libs/openal + media-sound/mpg123-base + dedicated? ( acct-user/unreal ) +" +PDEPEND=" + >=${UT_DEPEND} +" + +DIR="/opt/${PN}" +QA_PREBUILT="*" + +declare -gA SYSTEMS=( + [amd64]="64" + [arm64]="ARM64" + [x86]="" +) + +src_prepare() { + declare -g System="System${SYSTEMS[${ARCH}]}" + default + + # Fix NEEDED entry for libmpg123. + # https://github.com/OldUnreal/UnrealTournamentPatches/issues/2053 + patchelf --replace-needed libmpg123.so{,.0} "${System}"/ALAudio.so || die + + # These shouldn't be executable. + chmod a-x System/*.u || die + + if use arm64; then + # The .ini files are missing for arm64. + # https://github.com/OldUnreal/Unreal-testing/issues/451 + sed "s:System64:SystemARM64:g" System64/DefaultLinux.ini > SystemARM64/DefaultLinux.ini || die + mv -v System64/DefUser.ini SystemARM64/ || die + fi + + # Remove the non-native files. The main System directory is shared, it's not + # just for amd64, so we cannot delete it entirely. + local system + for system in "${!SYSTEMS[@]}"; do + if [[ ${system} != ${ARCH} ]]; then + if [[ -n ${SYSTEMS[${system}]} ]]; then + rm -rv "System${SYSTEMS[${system}]}/" || die + else + find System/ ! -type d \( -type l -o -executable -o -name "*.ini" -o -name "*.so*" \) | xargs rm -v -- || die + fi + fi + done + + # Remove bundled libraries. + rm -v "${System}"/lib{mpg123,openal,SDL3*,sndfile,xmp}.so* || die + + # Drop unwanted localisation files. + local dir lang + for dir in SystemLocalized/*; do + lang=${dir#*/} + lang=${lang:0:2} + [[ ${lang} == in ]] && continue + [[ ${lang} == ct ]] && lang=ca # Catalan + use "l10n_${lang}" || rm -rv "${dir}" || die + done +} + +src_install() { + insinto "${DIR}" + doins -r */ + + local exes=( "${System}"/{*-bin-*,*.so*} ) + fperms a+x "${exes[@]/#/${DIR}/}" + + sed \ + -e "s:@EPREFIX@:${EPREFIX}:g" \ + -e "s:@System@:${System}:g" \ + "${FILESDIR}/wrapper.sh" | newbin - ${PN} + + dosym ${PN} /usr/bin/${PN}-ucc + dosym ${PN}-bin-${ARCH} "${DIR}/${System}/${PN}-bin" + dosym ucc-bin-${ARCH} "${DIR}/${System}/ucc-bin" + + doicon -s 128 "${DISTDIR}/${PN}.png" + make_desktop_entry --eapi9 ${PN} -n "Unreal" \ + -C "Epic's popular first-person shooter" + + if use dedicated; then + newconfd "${FILESDIR}"/${PN}-ded.confd ${PN}-ded + newinitd "${FILESDIR}"/${PN}-ded.initd ${PN}-ded + fi +}