summaryrefslogtreecommitdiff
blob: 9857961303a79ac387fafcde6511e77db802d408 (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-action/d2x/d2x-0.2.5.ebuild,v 1.5 2004/06/03 07:50:38 mr_bones_ Exp $

inherit flag-o-matic eutils games

DATAFILE="d2shar10"
DESCRIPTION="Descent 2"
HOMEPAGE="http://icculus.org/d2x/"
SRC_URI="http://icculus.org/d2x/src/${P}.tar.gz
	http://icculus.org/d2x/data/${DATAFILE}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc"
IUSE="debug opengl ggi svga"

RDEPEND="media-libs/libsdl
	media-libs/sdl-image
	opengl? ( virtual/opengl )
	ggi? ( media-libs/libggi )
	svga? ( media-libs/svgalib )"
DEPEND="${RDEPEND}
	x86? ( dev-lang/nasm )"

src_unpack() {
	unpack ${A}
	cd ${DATAFILE}
	rm *.{exe,bat}
	cd ${S}
	epatch ${FILESDIR}/${PV}-shellscripts.patch
}

src_compile() {
	# --disable-network --enable-console
	local myconf="$(use_enable x86 assembler)"
	use debug \
		&& debugconf="${myconf} --enable-debug --disable-release" \
		|| debugconf="${myconf} --disable-debug --enable-release"
	# we do this because each of the optional guys define the same functions
	# in gr, thus when they go to link they cause redefine errors ...
	# we build each by it self, save the binary file, clean up, and start over
	mkdir my-bins
	for ren in sdl $(use opengl) $(use svga) $(use ggi) ; do
		[ "${ren}" == "sdl" ] \
			&& renconf="" \
			|| renconf="--with-${ren}"
		[ "${ren}" == "svga" ] \
			&& defflags="-DSVGALIB_INPUT" \
			|| defflags=""
		make distclean
		egamesconf \
			${myconf} \
			${renconf} \
			--datadir=${GAMES_DATADIR_BASE} \
			|| die "conf ${ren}"
		emake CXXFLAGS="${CXXFLAGS} ${defflags}" || die "build ${ren}"
		mv d2x* my-bins/
	done
}

src_install() {
	make install DESTDIR=${D} || die
	dogamesbin my-bins/*
	dodir ${GAMES_DATADIR}/${PN}
	cp -r ${WORKDIR}/${DATAFILE}/* ${D}/${GAMES_DATADIR}/${PN}/
	dodoc AUTHORS ChangeLog NEWS README* TODO readme.txt
	prepgamesdirs
}