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

EAPI="5"

inherit games cmake-utils eutils

DESCRIPTION="Enhanced OpenGL port of the official DOOM source code that also supports Heretic, Hexen, and Strife"
HOMEPAGE="http://www.osnanet.de/c.oelckers/gzdoom/"
SRC_URI="https://github.com/coelckers/${PN}/archive/g${PV}.tar.gz"

LICENSE="BSD BUILDLIC DOOM"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="mmx gtk fluidsynth"	# TODO: fluidsynth needs testing
				# gzdoom might use timidity regardless of that useflag

RDEPEND="
	fluidsynth? ( media-sound/fluidsynth )
	!fluidsynth? ( media-sound/timidity++ )
	gtk? ( x11-libs/gtk+:2 )
	media-libs/flac
	media-libs/fmod:1
	virtual/glu
	virtual/jpeg
	virtual/opengl
	media-libs/libsdl"

DEPEND="${RDEPEND}
	mmx? ( || ( dev-lang/nasm dev-lang/yasm ) )"

S="${WORKDIR}/${PN}-g${PV}"

src_prepare() {
	# Use default game data path
	sed -i 	-e "s:/usr/local/share/:${GAMES_DATADIR}/doom-data/:" src/sdl/i_system.h

	epatch "${FILESDIR}/${PN}-respect-fluidsynth-useflag.patch"
	epatch "${FILESDIR}/${PN}-stack-noexec.patch"
}

src_configure() {
	local mycmakeargs=(
		$(cmake-utils_use_no mmx ASM)
		$(cmake-utils_use_no gtk GTK)
		$(cmake-utils_use_use fluidsynth FLUIDSYNTH)
		-DFMOD_INCLUDE_DIR=/opt/fmodex/api/inc/
		-DFMOD_LIBRARY=/opt/fmodex/api/lib/libfmodex.so
	)

	cmake-utils_src_configure
}

src_install() {
	dodoc docs/*.{txt,TXT}
	dohtml docs/console*.{css,html}

	cd "${CMAKE_BUILD_DIR}" && dogamesbin ${PN}

	insinto "${GAMES_DATADIR}/doom-data"
	doins ${PN}.pk3 brightmaps.pk3 lights.pk3

	# FIXME: convert the .ico file to a real png instead
	newicon "${S}/src/win32/icon1.ico" "${PN}.png"
	make_desktop_entry "${PN}" "GZDoom" "${PN}" "Game;ActionGame;"

	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst

	elog "Copy or link wad files into ${GAMES_DATADIR}/doom-data/"
	elog "(the files must be readable by the 'games' group)."
	elog
	elog "To play, simply run:"
	elog "   gzdoom"
	elog
	if use fluidsynth && ! has_version media-sound/fluid-soundfont; then
		ewarn "You may need to install media-sound/fluid-soundfont"
		ewarn "for fluidsynth to play music, depending on your sound card."
	fi
	elog "See /usr/share/doc/${P}/zdoom.txt.* for more info"
}