app-misc/anomen-toolset - misc shell scripts
[anomen-overlay.git] / games-fps / duke3d / duke3d-20040817-r3.ebuild
blob90c015971ff4c0cc3d7105d8a1bf41e1c12e02f2
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 $
5 fromcvs=0
6 ECVS_MODULE="duke3d"
7 if [[ ${fromcvs} -eq 1 ]] ; then
8 ECVS_PASS="anonymous"
9 ECVS_SERVER="icculus.org:/cvs/cvsroot"
10 inherit cvs eutils flag-o-matic games
11 else
12 inherit eutils flag-o-matic games
15 DEMO="3dduke13.zip"
17 DESCRIPTION="Port of the original Duke Nukem 3D"
18 HOMEPAGE="http://icculus.org/projects/duke3d/"
19 SRC_URI="mirror://gentoo/${P}.tar.bz2
20 demo? (
21 ftp://ftp.3drealms.com/share/${DEMO}
22 ftp://ftp.planetmirror.com/pub/gameworld/downloads/${DEMO}
25 LICENSE="GPL-2"
26 SLOT="0"
27 KEYWORDS="~hppa ~ppc ~x86 ~amd64"
28 IUSE="demo pic perl opengl"
30 RDEPEND="media-libs/libsdl
31 media-libs/sdl-mixer
32 media-sound/timidity++
33 media-sound/timidity-eawpatches
34 perl? ( dev-lang/perl )
35 opengl? ( virtual/opengl )
36 amd64? (
37 app-emulation/emul-linux-x86-sdl
38 app-emulation/emul-linux-x86-soundlibs
40 DEPEND="${RDEPEND}
41 demo? ( app-arch/unzip )
42 !pic? ( x86? ( dev-lang/nasm ) )"
44 S="${WORKDIR}/${PN}"
46 use_tf() { use ${1} && echo "true" || echo "false"; }
48 pkg_setup() {
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"
53 games_pkg_setup
56 src_unpack() {
57 if [[ ${fromcvs} -eq 1 ]] ; then
58 cvs_src_unpack
59 cd duke3d/source
60 ECVS_MODULE="buildengine"
61 cvs_src_unpack
62 else
63 unpack ${A}
66 if use demo ; then
67 unzip -qo DN3DSW13.SHR || die "unzip DN3DSW13.SHR failed"
70 cd "${S}"
71 epatch "${FILESDIR}"/${P}-amd64.patch
73 # configure buildengine
74 cd "${S}/source/buildengine"
75 sed -i \
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::' \
82 Makefile \
83 || die "sed build Makefile failed"
84 epatch "${FILESDIR}/${PV}-endian.patch"
86 # configure duke3d
87 cd "${S}/source"
88 # need to sync features with build engine
89 epatch \
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
95 sed -i \
96 -e "/^use_opengl := / s:=.*:= $(use_tf opengl):" \
97 -e "/^linux64 := / s:=.*:= $(use_tf amd64):" \
98 -e "/^use_physfs := / s:=.*:= false:" \
99 Makefile \
100 || die "sed duke3d Makefile failed"
101 if ! use pic && use x86 ; then
102 sed -i \
103 -e 's:^#USE_ASM:USE_ASM:' buildengine/Makefile \
104 || die "sed failed"
105 sed -i \
106 -e '/^#use_asm := /s:#::' Makefile \
107 || die "sed failed"
110 # causes crazy redefine errors with gcc-3.[2-4].x
111 replace-flags -O3 -O2
112 strip-flags #203969
115 src_compile() {
116 emake -C source/buildengine OPTFLAGS="${CFLAGS}" || die "buildengine failed"
117 emake -C source OPTIMIZE="${CFLAGS}" || die "duke3d failed"
120 src_install() {
121 games_make_wrapper duke3d "${GAMES_BINDIR}/duke3d.bin" "${GAMES_DATADIR}/${PN}"
122 newgamesbin source/duke3d duke3d.bin || die "newgamesbin failed"
124 dodoc readme.txt
126 cd testdata
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
132 if use demo ; then
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"
140 prepgamesdirs
143 pkg_postinst() {
144 games_pkg_postinst
145 use demo || elog "Put the data files in ${GAMES_DATADIR}/${PN} before playing"