1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/games-fps/duke3d/duke3d-20040817-r2.ebuild,v 1.5 2008/02/28 03:24:23 mr_bones_ Exp $
7 if [[ ${fromcvs} -eq 1 ]] ; then
9 ECVS_SERVER
="icculus.org:/cvs/cvsroot"
10 inherit cvs eutils flag-o-matic games
12 inherit eutils flag-o-matic games
17 DESCRIPTION
="Port of the original Duke Nukem 3D"
18 HOMEPAGE
="http://icculus.org/projects/duke3d/"
19 SRC_URI
="mirror://gentoo/${P}.tar.bz2
21 ftp://ftp.3drealms.com/share/${DEMO}
22 ftp://ftp.planetmirror.com/pub/gameworld/downloads/${DEMO}
27 KEYWORDS
="~hppa ~ppc ~x86 ~amd64"
28 IUSE
="demo pic perl opengl"
30 RDEPEND
="media-libs/libsdl
32 media-sound/timidity++
33 media-sound/timidity-eawpatches
34 perl? ( dev-lang/perl )
35 opengl? ( virtual/opengl )
37 app-emulation/emul-linux-x86-sdl
38 app-emulation/emul-linux-x86-soundlibs
41 demo? ( app-arch/unzip )
42 !pic? ( x86? ( dev-lang/nasm ) )"
46 use_tf
() { use
${1} && echo "true" ||
echo "false"; }
49 if built_with_use dev-lang
/perl ithreads
; then
50 eerror
"${PN} needs perl compiled with ithreads use-flag disabled!"
51 die
"perl with ithreads detected"
57 if [[ ${fromcvs} -eq 1 ]] ; then
60 ECVS_MODULE
="buildengine"
67 unzip -qo DN3DSW13.SHR || die
"unzip DN3DSW13.SHR failed"
71 epatch
"${FILESDIR}"/${P}-amd64.
patch
73 # configure buildengine
74 cd "${S}/source/buildengine"
76 -e "/^useperl := / s:=.*:= $(use_tf perl):" \
77 -e "/^useopengl := / s:=.*:= $(use_tf opengl):" \
78 -e "/^linux64 := / s:=.*:= $(use_tf amd64):" \
79 -e "/^usephysfs := / s:=.*:= false:" \
80 -e 's:-O3::' -e 's: -g : :' \
81 -e 's:/usr/lib/perl5/i386-linux/CORE/libperl.a::' \
83 || die
"sed build Makefile failed"
84 epatch
"${FILESDIR}/${PV}-endian.patch"
88 # need to sync features with build engine
90 "${FILESDIR}/${PV}-credits.patch" \
91 "${FILESDIR}/${PV}-duke3d-makefile-opts.patch" \
92 "${FILESDIR}/${PV}-gcc34.patch" \
93 "${FILESDIR}"/${P}-gcc4.
patch \
94 "${FILESDIR}"/${P}-as-needed.
patch
96 -e "/^use_opengl := / s:=.*:= $(use_tf opengl):" \
97 -e "/^linux64 := / s:=.*:= $(use_tf amd64):" \
98 -e "/^use_physfs := / s:=.*:= false:" \
100 || die
"sed duke3d Makefile failed"
101 if ! use pic
&& use x86
; then
103 -e 's:^#USE_ASM:USE_ASM:' buildengine
/Makefile \
106 -e '/^#use_asm := /s:#::' Makefile \
110 # causes crazy redefine errors with gcc-3.[2-4].x
111 replace-flags
-O3 -O2
116 emake
-C source
/buildengine OPTFLAGS
="${CFLAGS}" || die
"buildengine failed"
117 emake
-C source OPTIMIZE
="${CFLAGS}" || die
"duke3d failed"
121 games_make_wrapper duke3d
"${GAMES_BINDIR}/duke3d.bin" "${GAMES_DATADIR}/${PN}"
122 newgamesbin source
/duke3d duke3d.bin || die
"newgamesbin failed"
127 insinto
"${GAMES_DATADIR}/${PN}"
128 newins defs.con DEFS.CON
129 newins game.con GAME.CON
130 newins user.con USER.CON
131 newins
"${FILESDIR}/network.cfg" network.cfg.template
133 doins
"${WORKDIR}/DUKE3D.GRP" || die
"doins DUKE3D.GRP failed"
136 insinto
"${GAMES_SYSCONFDIR}"
137 doins
"${FILESDIR}/duke3d.cfg"
138 dosym
"${GAMES_SYSCONFDIR}/duke3d.cfg" "${GAMES_DATADIR}/${PN}/DUKE3D.CFG"
145 use demo || elog
"Put the data files in ${GAMES_DATADIR}/${PN} before playing"