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

EAPI=6

inherit eutils scons-utils toolchain-funcs xdg

MY_P="${PN}_v${PV}-src"
DESCRIPTION="Descent Rebirth - enhanced Descent 1 & 2 engine"
HOMEPAGE="https://www.dxx-rebirth.com/"
SRC_URI="https://www.dxx-rebirth.com/download/dxx/${MY_P}.tar.gz
	opl3-musicpack? (
		descent1? ( https://www.dxx-rebirth.com/download/dxx/res/d1xr-opl3-music.dxa )
		descent2? ( https://www.dxx-rebirth.com/download/dxx/res/d2xr-opl3-music.dxa ) )
	sc55-musicpack? (
		descent1? ( https://www.dxx-rebirth.com/download/dxx/res/d1xr-sc55-music.dxa )
		descent2? ( https://www.dxx-rebirth.com/download/dxx/res/d2xr-sc55-music.dxa ) )
	l10n_de? (
		descent1? ( https://www.dxx-rebirth.com/download/dxx/res/d1xr-briefings-ger.dxa )
		descent2? ( https://www.dxx-rebirth.com/download/dxx/res/d2xr-briefings-ger.dxa ) )
	textures? (
		descent1? ( https://www.dxx-rebirth.com/download/dxx/res/d1xr-hires.dxa ) )"

LICENSE="DXX-Rebirth GPL-3 public-domain"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+data debug +descent1 +descent2 ipv6 l10n_de +music +opengl opl3-musicpack sc55-musicpack +textures"

REQUIRED_USE="|| ( descent1 descent2 )
	?? ( opl3-musicpack sc55-musicpack )
	opl3-musicpack? ( music )
	sc55-musicpack? ( music )"

DEPEND="dev-games/physfs:0=[hog,mvl,zip]
	media-libs/libsdl:0=[joystick,opengl?,sound,video]
	music? ( media-libs/sdl-mixer:0= )
	opengl? (
		virtual/opengl
		virtual/glu )"

RDEPEND="${DEPEND}
	data? (
		descent1? ( || ( games-action/descent1-data games-action/descent1-demodata ) )
		descent2? ( || ( games-action/descent2-data games-action/descent2-demodata ) ) )
	music? (
		!opl3-musicpack? ( !sc55-musicpack? ( media-libs/sdl-mixer:0=[midi] ) )
		opl3-musicpack? ( media-libs/sdl-mixer:0=[vorbis] )
		sc55-musicpack? ( media-libs/sdl-mixer:0=[vorbis] ) )
	!games-action/d1x-rebirth
	!games-action/d2x-rebirth"

S="${WORKDIR}/${MY_P}"

PATCHES=(
	"${FILESDIR}"/${P}-flags.patch # Remove hardcoded optimisation flags.
	"${FILESDIR}"/${P}-sharepath.patch # Change share path to use old d1x/d2x locations.
	"${FILESDIR}"/${P}-physfs-3-no-deprecation.patch # bug #653014
)

src_compile() {
	tc-export CXX
	escons \
		prefix="${EPREFIX}"/usr \
		d1x=$(usex descent1 1 0) \
		d2x=$(usex descent2 1 0) \
		debug=$(usex debug 1 0) \
		ipv6=$(usex ipv6 1 0) \
		opengl=$(usex opengl 1 0) \
		sdlmixer=$(usex music 1 0) \
		verbosebuild=1
}

src_install() {
	local DV PROGRAM

	for DV in 1 2; do
		use descent${DV} || continue
		PROGRAM=d${DV}x-rebirth

		docinto ${PROGRAM}
		edos2unix ${PROGRAM}/*.txt
		dodoc ${PROGRAM}/*.txt

		insinto /usr/share/games/d${DV}x
		use opl3-musicpack && doins "${DISTDIR}"/d${DV}xr-opl3-music.dxa
		use sc55-musicpack && doins "${DISTDIR}"/d${DV}xr-sc55-music.dxa
		use l10n_de && doins "${DISTDIR}"/d${DV}xr-briefings-ger.dxa

		dobin ${PROGRAM}/${PROGRAM}
		make_desktop_entry ${PROGRAM} "Descent ${DV} Rebirth" ${PROGRAM}
		doicon ${PROGRAM}/${PROGRAM}.xpm
	done

	if use textures && use descent1; then
		insinto /usr/share/games/d1x
		doins "${DISTDIR}"/d1xr-hires.dxa
	fi
}

pkg_postinst() {
	xdg_pkg_postinst

	if ! use data; then
		elog "To play the game enable USE=\"data\" or manually "
		elog "copy the files to ${EPREFIX}/usr/share/games/{d1x,d2x}."
		elog "See each game's INSTALL.txt for details."
	fi
}