summaryrefslogtreecommitdiff
blob: d0de4c73bf6f9cdf0cf698abbf310918690ed75b (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit desktop eapi7-ver gnome2-utils toolchain-funcs

MY_BUILD="$(ver_cut 2)"
MY_DATE="$(ver_cut 1)"

MY_PN_HRP="duke3d_hrp"
MY_PN_OPL="duke3d_musopl"
MY_PN_PSX="duke3d_psx"
MY_PN_SC55="duke3d_music-sc55"
MY_PN_XXX="duke3d_xxx"

MY_PV_HRP="5.4"
MY_PV_OPL="2.01"
MY_PV_PSX="1.11"
MY_PV_SC55="4.02"
MY_PV_XXX="1.33"

DESCRIPTION="An open source engine port of the classic PC first person shooter Duke Nukem 3D"
HOMEPAGE="http://www.eduke32.com/"
SRC_URI="http://dukeworld.com/eduke32/synthesis/${MY_DATE}-${MY_BUILD}/${PN}_src_${MY_DATE}-${MY_BUILD}.tar.xz
	http://www.eduke32.com/images/eduke32_classic.png
	hrp? ( http://www.duke4.org/files/nightfright/hrp/duke3d_hrp.zip -> ${MY_PN_HRP}-${MY_PV_HRP}.zip )
	offensive? ( http://www.duke4.org/files/nightfright/related/${MY_PN_XXX}.zip -> ${MY_PN_XXX}-${MY_PV_XXX}.zip )
	opl? ( http://www.moddb.com/downloads/mirror/95750/102/ce9e8f422c6cccdb297852426e96740a -> ${MY_PN_OPL}-${MY_PV_OPL}.zip )
	psx? ( http://www.duke4.org/files/nightfright/related/duke3d_psx.zip -> ${MY_PN_PSX}-${MY_PV_PSX}.zip )
	sc-55? ( http://www.duke4.org/files/nightfright/music/${MY_PN_SC55}.zip -> ${MY_PN_SC55}-${MY_PV_SC55}.zip )"

KEYWORDS="~amd64 ~hppa ~x86"
LICENSE="BUILDLIC GPL-2 HRP"
SLOT="0"
IUSE="cdinstall demo flac fluidsynth gtk hrp offensive opengl opl png psx sc-55 server sdk timidity tools vorbis vpx xmp"
REQUIRED_USE="cdinstall? ( !demo )
	demo? ( !cdinstall )
	hrp? ( ^^ ( demo cdinstall ) )
	offensive? ( ^^ ( demo cdinstall ) )
	opl? ( ^^ ( demo cdinstall )
		!sc-55 )
	psx? ( ^^ ( demo cdinstall ) )
	sc-55? ( ^^ ( demo cdinstall )
		!opl )
	vpx? ( opengl )"

S="${WORKDIR}/${PN}_${MY_DATE}-${MY_BUILD}"

MY_DEPEND_RDEPEND="media-libs/libsdl2[joystick,opengl?,sound,video,X]
	media-libs/sdl2-mixer[flac?,fluidsynth?,midi,timidity?,vorbis?]
	sys-libs/zlib:=
	flac? ( media-libs/flac )
		gtk? ( x11-libs/gtk+:2 )
	opengl? ( virtual/glu
		virtual/opengl )
	png? ( media-libs/libpng:0= )
	timidity? ( media-sound/timidity-freepats )
	vpx? ( media-libs/libvpx:= )
	vorbis? ( media-libs/libogg
		media-libs/libvorbis )
	xmp? ( media-libs/exempi:= )"

RDEPEND="${MY_DEPEND_RDEPEND}
	cdinstall? ( games-fps/duke3d-data )
	demo? ( games-fps/duke3d-demodata )"

DEPEND="${MY_DEPEND_RDEPEND}
	app-arch/unzip
	x86? ( dev-lang/nasm )"

PATCHES=( "${FILESDIR}/fix-build-transpal.patch" "${FILESDIR}/log-to-tmpdir.patch" "${FILESDIR}/search-duke3d-path.patch" )

src_unpack() {
	# Extract only the eduke32 archive
	unpack ${PN}_src_${MY_DATE}-${MY_BUILD}.tar.xz

	# Unpack only the documentation
	if use hrp; then
		unzip -q "${DISTDIR}"/${MY_PN_HRP}-${MY_PV_HRP}.zip hrp_readme.txt hrp_todo.txt || die
	fi
	if use offensive; then
		unzip -q "${DISTDIR}"/${MY_PN_XXX}-${MY_PV_XXX}.zip xxx_readme.txt || die
	fi
	if use opl; then
		unzip -q "${DISTDIR}"/${MY_PN_OPL}-${MY_PV_OPL}.zip readme.txt || die
	fi
	if use sc-55; then
		unzip -q "${DISTDIR}"/${MY_PN_SC55}-${MY_PV_SC55}.zip readme/music_readme.txt || die
	fi
}

src_compile() {
	local myemakeopts=(
		ALLOCACHE_AS_MALLOC=0
		AS=$(tc-getAS)
		CC=$(tc-getCC)
		CXX=$(tc-getCXX)
		CLANG=0
		CPLUSPLUS=1
		CUSTOMOPT=""
		DEBUGANYWAY=0
		F_JUMP_TABLES=""
		FORCEDEBUG=0
		HAVE_FLAC=$(usex flac 1 0)
		HAVE_GTK2=$(usex gtk 1 0)
		HAVE_VORBIS=$(usex vorbis 1 0)
		HAVE_XMP=$(usex xmp 1 0)
		LINKED_GTK=$(usex gtk 1 0)
		LTO=1
		LUNATIC=0
		KRANDDEBUG=0
		MEMMAP=0
		MIXERTYPE=SDL
		NETCODE=$(usex server 1 0)
		NOASM=0
		OPTLEVEL=0
		OPTOPT=""
		PACKAGE_REPOSITORY=1
		POLYMER=$(usex opengl 1 0)
		PRETTY_OUTPUT=0
		PROFILER=0
		RELEASE=1
		RENDERTYPE=SDL
		SDL_TARGET=2
		SIMPLE_MENU=0
		STRIP=""
		TANDALONE=0
		STARTUP_WINDOW=$(usex gtk 1 0)
		USE_OPENGL=$(usex opengl 1 0)
		USE_LIBVPX=$(usex vpx 1 0)
		USE_LIBPNG=$(usex png 1 0)
		USE_LUAJIT_2_1=0
		WITHOUT_GTK=$(usex gtk 0 1)
	)

	emake "${myemakeopts[@]}"

	if use tools; then
		emake utils "${myemakeopts[@]}"
	fi
}

src_install() {
	local binary
	local binaries=(
		eduke32
		mapster32
		"${FILESDIR}"/eduke32-bin
	)
	for binary in "${binaries[@]}"; do
		dobin "${binary}"
	done

	if use tools; then
		local tool
		local tools=(
			arttool
			bsuite
			cacheinfo
			generateicon
			givedepth
			ivfrate
			kextract
			kgroup
			kmd2tool
			makesdlkeytrans
			map2stl
			md2tool
			mkpalette
			transpal
			unpackssi
			wad2art
			wad2map
		)
		for tool in "${tools[@]}"; do
			dobin ${tool}
		done
	fi

	keepdir /usr/share/games/eduke32
	insinto /usr/share/games/eduke32
	if use hrp; then
		doins "${DISTDIR}"/${MY_PN_HRP}-${MY_PV_HRP}.zip
	fi
	if use offensive; then
		doins "${DISTDIR}"/${MY_PN_XXX}-${MY_PV_XXX}.zip
	fi
	if use opl; then
		doins "${DISTDIR}"/${MY_PN_OPL}-${MY_PV_OPL}.zip
	fi
	if use psx; then
		doins "${DISTDIR}"/${MY_PN_PSX}-${MY_PV_PSX}.zip
	fi
	if use sc-55; then
		doins "${DISTDIR}"/${MY_PN_SC55}-${MY_PV_SC55}.zip
	fi
	if use sdk; then
		doins -r package/sdk
	fi

	newicon "${DISTDIR}"/eduke32_classic.png eduke32.png

	make_desktop_entry eduke32-bin EDuke32 eduke32 Game
	make_desktop_entry mapster32 Mapster32 eduke32 Game

	local DOCS=( package/sdk/samples/*.txt source/build/doc/*.txt source/duke3d/src/lunatic/doc/*.txt )
	if use hrp; then
		DOCS+=( "${WORKDIR}"/hrp_readme.txt "${WORKDIR}"/hrp_todo.txt )
	fi
	if use offensive; then
		DOCS+=( "${WORKDIR}"/xxx_readme.txt )
	fi
	if use opl; then
		DOCS+=( "${WORKDIR}"/readme.txt )
	fi
	if use sc-55; then
		DOCS+=( "${WORKDIR}"/readme/music_readme.txt )
	fi
	einstalldocs
}

pkg_preinst() {
	gnome2_icon_savelist
}

pkg_postinst() {
	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}