games-fps/unreal: New package for the original Unreal engine

The data will be in a separate package.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
This commit is contained in:
James Le Cuirot
2026-08-08 12:43:05 +01:00
parent b0e11782e4
commit eca47e759d
6 changed files with 183 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
DIST OldUnreal-UnrealPatch227k-Linux.tar.bz2 132328627 BLAKE2B 339d297cfce38f5e0c0fb35c1508724b232080e9defadeabc34694a906d786d7358c2aba8d6123a0661cfe77bfae91cf8d2d5e409d5123f8ea3f0f2bd578542f SHA512 78f119458f6cdfad812986c4714f6dd5579de401ed32e732accca49509426977f0b3e9fcd471200e4cb12d15c9e0a5364e12379c4c709e7aefc3f7aff8d242ca
DIST unreal.png 18061 BLAKE2B 36ab2991946abf53fc5a228b145d4306251251c72e58fafa1c2ff407713b1ee44faaae6c3761bc58f98ba1a67296d451bca3efb78c2a3838d3ff8c846742da62 SHA512 d5c038f030b021f993d7063a100d34687154c3d21dc6094a1932623a6219b6590e435c5c4777fffc5f07660784f4f1197179cc2a34f213338c0077f1763221a7
+6
View File
@@ -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"
+13
View File
@@ -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
}
+33
View File
@@ -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}"
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>games@gentoo.org</email>
<name>Gentoo Games Project</name>
</maintainer>
<upstream>
<remote-id type="github">OldUnreal/Unreal-testing</remote-id>
</upstream>
</pkgmetadata>
+118
View File
@@ -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
}