summaryrefslogtreecommitdiff
blob: 01e871966b255b89b6e1b95c2e21febef9a07d29 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit toolchain-funcs

DESCRIPTION="Red-blue Quake II! Play quake2 with 3D glasses!"
HOMEPAGE="https://www.jfedor.org/red-blue-quake2/"
SRC_URI="mirror://idsoftware/source/q2source-3.21.zip
	https://www.jfedor.org/red-blue-quake2/${P}.tar.gz"
S="${WORKDIR}"/quake2-3.21

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"

RDEPEND="x11-libs/libX11"
DEPEND="${RDEPEND}"
BDEPEND="app-arch/unzip"

PATCHES=(
	"${FILESDIR}"/${PV}-gentoo.patch
	"${FILESDIR}"/${P}-gcc41.patch
	"${FILESDIR}"/${P}-ldflags.patch
)

src_prepare() {
	default

	cd linux || die

	sed -i \
		-e "s:GENTOO_DIR:$(get_libdir)/${PN}:" \
		sys_linux.c || die

	sed -i \
		-e "s:/etc/quake2.conf:/etc/${PN}.conf:" \
		sys_linux.c vid_so.c || die

	sed -i \
		-e 's:-O6::' \
		-e 's:-g::' \
		Makefile || die

	echo "$(get_libdir)"/${PN} > "${T}"/${PN}.conf || die
}

src_compile() {
	cd linux || die

	mkdir -p releasei386-glibc/ref_soft || die

	emake \
		CC="$(tc-getCC)" \
		GENTOO_CFLAGS="${CFLAGS}" \
		GENTOO_DATADIR=/usr/share/quake2/baseq2/ \
		build_release
}

src_install() {
	cd linux/release* || die

	exeinto "$(get_libdir)"/${PN}
	doexe gamei386.so ref_softx.so

	exeinto "$(get_libdir)"/${PN}/ctf
	doexe ctf/gamei386.so
	newbin quake2 red-blue-quake2

	insinto /etc
	doins "${T}"/${PN}.conf
}