blob: 99858d7090ef88d5fd1a7f1aec1e2835b79af76d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop xdg
COMMIT="094b94dc"
DESCRIPTION="Modern build of the Unreal Tournament 2004 engine"
HOMEPAGE="https://github.com/OldUnreal/UT2004Patches"
SRC_URI="
https://github.com/OldUnreal/UT2004Patches/releases/download/${PV/_pre/-preview-}/OldUnreal-UT2004Patch${PV%_*}-Linux-${COMMIT}.tar.bz2
mirror+https://dev.gentoo.org/~chewi/distfiles/${PN}.png
"
S="${WORKDIR}"
LICENSE="Epic-TOS"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="dedicated l10n_de l10n_es l10n_fr l10n_he l10n_it l10n_ko l10n_pl l10n_ru"
RESTRICT="bindist mirror strip"
UT_DEPEND="games-fps/ut2004-data-3369"
BDEPEND="
dev-util/patchelf
"
RDEPEND="
media-libs/libglvnd
media-libs/libsdl3[opengl]
media-libs/openal
dedicated? ( acct-user/unreal )
!games-fps/ut2004-bonuspack-ece
!games-fps/ut2004-bonuspack-mega
!games-server/ut2004-ded
!<${UT_DEPEND}
"
PDEPEND="
>=${UT_DEPEND}
"
DIR="/opt/${PN}"
QA_PREBUILT="*"
declare -gA SYSTEMS=(
[amd64]=""
[arm64]="ARM64"
[ppc64]="PPC64LE"
)
src_prepare() {
declare -g System="System${SYSTEMS[${ARCH}]}"
default
# https://github.com/OldUnreal/FullGameInstallers/issues/93
ln -s ../System/{CacheRecords.ucl,Packages.md5,xaplayersl3.upl,xplayersL{1,2}.upl} SystemARM64/ || die
# https://github.com/OldUnreal/UT2004Patches/issues/508
patchelf --remove-needed libGLX.so.0 "${System}"/{Anti,OpenGL}Drv.so || die
# This shouldn't be executable.
chmod a-x System/CacheRecords.ucl || die
# 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{openal,SDL3}.so* || die
# Make it easier to generate cache files in other ebuilds.
mkdir -p Gentoo/System || die
touch Gentoo/UT2K4MOD.ini || die
patch -p0 -o - "${System}"/Default.ini "${FILESDIR}"/gentoo-mod.patch > Gentoo/System/Gentoo.ini || die
# Drop unwanted localisation files.
local dir lang
for dir in SystemLocalized/*; do
lang=${dir#*/}
lang=${lang:0:2}
[[ ${lang} == in ]] && continue
use "l10n_${lang}" || rm -rv "${dir}" || die
done
}
src_install() {
dodir "${DIR}"
cp -rP * "${ED}${DIR}" || die
sed -e "s:@EPREFIX@:${EPREFIX}:g" -e "s:@System@:${System}:g" "${FILESDIR}/wrapper.sh" | newbin - ${PN}
dosym -r "${DIR}/${System}"/UCC /usr/bin/${PN}-ucc
doicon -s 128 "${DISTDIR}/${PN}.png"
make_desktop_entry --eapi9 ${PN} -n "Unreal Tournament 2004" \
-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
}
pkg_postinst() {
xdg_pkg_postinst
# The CD key is no longer needed.
rm -f "${EROOT}${DIR}"/System/cdkey || die
}
|