summaryrefslogtreecommitdiff
blob: 1d5d5cef2a86b6a14aee46728465ae69d52a37b4 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit scons-utils toolchain-funcs games git-2

DESCRIPTION="3rd installment of the classic iD 3D first-person shooter"
HOMEPAGE="https://github.com/TTimo/doom3.gpl"
EGIT_REPO_URI="git://github.com/TTimo/doom3.gpl.git"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""
IUSE="alsa debug dedicated opengl"

RDEPEND="
	opengl? (
		virtual/opengl
		alsa? ( media-libs/alsa-lib )
		amd64? ( app-emulation/emul-linux-x86-xlibs[opengl] )
	)
"
DEPEND="${RDEPEND}
	sys-devel/m4
"

dir=$(games_get_libdir)/${PN}

src_configure() {
	S+="/neo"

	myesconsargs=(
		CC="$(tc-getCC)"
		CXX="$(tc-getCXX)"
	)
		# FIXME build fails with JOBS=3
		#JOBS="$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/\2/")"

	if use debug; then
		myesconsargs+=( BUILD="debug-all" )
	else
		myesconsargs+=( BUILD="release" )
	fi

	if use dedicated; then
		if use opengl; then
			myesconsargs+=( DEDICATED="2" )
		else
			myesconsargs+=( DEDICATED="1" )
		fi
	else
		# TODO use EAPI4
		use !opengl && die "Nothing to build"
		myesconsargs+=( DEDICATED="0" )
	fi

	# FIXME needs 32-bit libz.a
	myesconsargs+=( NOCURL="1" )
}

src_compile() {
	escons
}

src_install() {
	exeinto "${dir}"
	doexe gamex86-base.so || die
	doexe gamex86-d3xp.so || die

	if use dedicated; then
		doexe doomded.x86 || die
	fi

	if use opengl; then
		doexe doom.x86 || die
		doexe sys/linux/setup/image/openurl.sh || die
		games_make_wrapper ${PN} ./doom.x86 "${dir}" "${dir}"
		newicon sys/linux/setup/image/doom3.png ${PN}.png || die
		make_desktop_entry ${PN} "Doom III GPL"
	fi

	prepgamesdirs

	dodoc sys/linux/setup/image/README || die
}

pkg_postinst() {
	games_pkg_postinst

	elog "You need to copy 'base' directory"
	elog "from either your installation media or your hard drive to"
	elog "${dir}/ before running the game."
	echo
	elog "To play the game, run:"
	elog " ${PN}"
	echo
}