summaryrefslogtreecommitdiff
blob: 08961abb23c7dcf1c678f8e8f45db7f4b4961a7a (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/prboom/prboom-2.4.7.ebuild,v 1.4 2007/02/14 01:06:08 nyhm Exp $

inherit eutils toolchain-funcs games

DESCRIPTION="Port of ID's doom to SDL and OpenGL"
HOMEPAGE="http://prboom.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
	mirror://gentoo/${PN}.png"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ~ppc sparc x86"
IUSE="opengl"

DEPEND="media-libs/libsdl
	media-libs/sdl-mixer
	media-libs/sdl-net
	!games-fps/lsdldoom
	opengl? (
		virtual/opengl
		virtual/glu
	)"

src_unpack() {
	unpack ${A}
	cd "${S}"
	ebegin "Detecting NVidia GL/prboom bug"
	$(tc-getCC) "${FILESDIR}"/${PV}-nvidia-test.c 2> /dev/null
	local ret=$?
	eend ${ret} "NVidia GL/prboom bug found ;("
	[ ${ret} -eq 0 ] || epatch "${FILESDIR}"/${PV}-nvidia.patch
	sed -i \
		-e '/^gamesdir/ s/\/games/\/bin/' \
		src/Makefile.in \
		|| die "sed failed"
	sed -i \
		-e 's/: install-docDATA/:/' \
		-e '/^SUBDIRS/ s/doc//' \
		Makefile.in \
		|| die "sed failed"
	sed -i \
		-e 's:-ffast-math $CFLAGS_OPT::' \
		configure \
		|| die "sed configure failed"
}

src_compile() {
	local myconf
	# configure.in should be fixed as
	# --enable-gl and
	# --disable-gl are treated the same
	use opengl && myconf="--enable-gl"
	# leave --disable-cpu-opt in otherwise the configure script
	# will append -march=i686 and crap ... let the user's CFLAGS
	# handle this ...
	egamesconf \
		--disable-dependency-tracking \
		${myconf} \
		$(use_enable x86 i386-asm) \
		--disable-cpu-opt \
		--with-waddir="${GAMES_DATADIR}/doom-data" \
		|| die
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	doman doc/*.{5,6}
	dodoc AUTHORS NEWS README TODO doc/README.* doc/*.txt
	doicon "${DISTDIR}"/${PN}.png
	make_desktop_entry ${PN} "PrBoom"
	prepgamesdirs
}