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

inherit autotools eutils flag-o-matic games

DESCRIPTION="BSP nodebuilder for DooM engine games."
HOMEPAGE="http://games.moria.org.uk/doom/bsp/"
SRC_URI="http://games.moria.org.uk/doom/bsp/download/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="debug dmalloc profile"

DEPEND="dmalloc? ( dev-libs/dmalloc )"
RDEPEND=${DEPEND}

src_unpack() {
	unpack ${A}
	cd "${S}"
	# The configure script clobbers CFLAGS and doesn't handle
	# --enable-{debug,profile} correctly. Fix it.
	sed -i \
		-e '/^CFLAGS="-O2 -fomit-frame-pointer"$/d' \
		-e '/^AC_C_COMPILE_FLAGS(.*)$/d' \
		-e 's:^CFLAGS="-g"$:if test "${enableval}" = "yes"; then CFLAGS="${CFLAGS} -g"; fi:' \
		-e 's:^CFLAGS="-pg"$:if test "${enableval}" = "yes"; then CFLAGS="${CFLAGS} -pg"; fi:' \
		configure.in || die "sed configure.in failed"
	# We want documentation to be installed only through dodoc
	sed -i \
		-e '/^docdir =.*/d' \
		-e '/^doc_DATA =.*/d' \
		Makefile.am || die "sed Makefile.am failed"
	eautoreconf || die "eautoreconf failed"
}

src_compile() {
	# gcc chokes if -g and -fomit-frame-pointer are given
	use debug && filter-flags -fomit-frame-pointer
	# gcc chokes if -pg and -fomit-frame-pointer are given
	use profile && filter-flags -fomit-frame-pointer
	egamesconf \
		$(use_enable debug) \
		$(use_enable dmalloc) \
		$(use_enable profile) \
		|| die "egamesconf failed"
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	dodoc AUTHORS NEWS README visplane.txt
	prepgamesdirs
}