blob: eb7f0a389643c251abe09d1a737226298bdf6a13 (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/quake2-icculus/quake2-icculus-0.15-r2.ebuild,v 1.1 2004/11/27 15:46:27 wolf31o2 Exp $
inherit eutils gcc games
MY_P="quake2-r${PV}"
DESCRIPTION="The icculus.org linux port of iD's quake2 engine"
HOMEPAGE="http://icculus.org/quake2/"
SRC_URI="http://icculus.org/quake2/files/${MY_P}.tar.gz
!noqmax? ( http://icculus.org/quake2/files/maxpak.pak )
rogue? ( ftp://ftp.idsoftware.com/idstuff/quake2/source/roguesrc320.shar.Z )
xatrix? ( ftp://ftp.idsoftware.com/idstuff/quake2/source/xatrixsrc320.shar.Z )"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc sparc alpha amd64"
IUSE="arts svga sdl aalib dedicated opengl noqmax rogue xatrix"
# default to X11 if svga/opengl/sdl/aalib/dedicated are not in USE
RDEPEND="virtual/libc
opengl? ( virtual/opengl )
svga? ( media-libs/svgalib )
sdl? ( media-libs/libsdl )
aalib? ( media-libs/aalib )
!svga? ( !opengl? ( !sdl? ( !aalib? ( !dedicated? ( virtual/x11 ) ) ) ) )
arts? ( kde-base/arts )"
DEPEND="${RDEPEND}
>=sys-apps/sed-4
app-arch/sharutils"
S="${WORKDIR}/${MY_P}"
pkg_setup() {
if [ -e /etc/env.d/09opengl ]
then
# Set up X11 implementation
X11_IMPLEM_P="$(portageq best_version "${ROOT}" virtual/x11)"
X11_IMPLEM="${X11_IMPLEM_P%-[0-9]*}"
X11_IMPLEM="${X11_IMPLEM##*\/}"
einfo "X11 implementation is ${X11_IMPLEM}."
VOID=$(cat /etc/env.d/09opengl | grep ${X11_IMPLEM})
USING_X11=$?
if [ "${USING_X11}" -eq "1" ]
then
GL_IMPLEM=$(cat /etc/env.d/09opengl | cut -f5 -d/)
opengl-update ${X11_IMPLEM}
fi
else
die "Could not find /etc/env.d/09opengl. Please run opengl-update."
fi
}
src_unpack() {
unpack ${MY_P}.tar.gz
cd ${S}
epatch "${FILESDIR}/${PV}-Makefile-noopts.patch"
epatch "${FILESDIR}/${PV}-Makefile-optflags.patch"
epatch "${FILESDIR}/${PV}-Makefile-amd64.patch"
epatch "${FILESDIR}/${PV}-gentoo-path.patch"
epatch "${FILESDIR}/${PV}-amd64.patch"
sed -i \
-e "s:GENTOO_DATADIR:${GAMES_DATADIR}/quake2-data:" \
-e "s:GENTOO_LIBDIR:${GAMES_LIBDIR}/quake2-icculus:" \
src/qcommon/files.c \
|| die "sed src/qcommon/files.c failed"
sed -i \
-e "s:GENTOO_LIBDIR:${GAMES_LIBDIR}/quake2-icculus:" \
src/linux/vid_so.c \
|| die "sed src/linux/vid_so.c failed"
ln -s $(which echo) ${T}/more
for g in $(useq rogue && echo rogue) $(useq xatrix && echo xatrix); do
mkdir -p ${S}/src/${g}
cd ${S}/src/${g}
unpack ${g}src320.shar.Z
sed -i \
-e 's:^read ans:ans=yes :' ${g}src320.shar \
|| die "sed ${g}src320.shar failed"
env PATH="${T}:${PATH}" unshar ${g}src320.shar
rm ${g}src320.shar
done
if use rogue ; then
sed -i \
-e 's:<nan\.h>:<bits/nan.h>:' ${S}/src/rogue/g_local.h \
|| die "sed g_local.h failed"
fi
}
yesno() {
for f in $@ ; do
if ! useq $f ; then
echo NO
return 1
fi
done
echo YES
return 0
}
src_compile() {
BUILD_X11=$(yesno X)
use sdl || use opengl || use svga || use aalib || BUILD_X11=YES
# xatrix fails to build
# rogue fails to build
for BUILD_QMAX in YES NO ; do
use noqmax && [ "${BUILD_QMAX}" == "YES" ] && continue
[ "${BUILD_QMAX}" == "YES" ] \
&& echo "#define GENTOO_LIBDIR \"${GAMES_LIBDIR}/${PN}-qmax\"" > src/linux/gentoo-libdir.h \
|| echo "#define GENTOO_LIBDIR \"${GAMES_LIBDIR}/${PN}\"" > src/linux/gentoo-libdir.h
make clean || die "cleaning failed"
make build_release \
BUILD_SDLQUAKE2=$(yesno sdl) \
BUILD_SVGA=$(yesno svga) \
BUILD_X11=${BUILD_X11} \
BUILD_GLX=$(yesno opengl) \
BUILD_SDL=$(yesno sdl) \
BUILD_SDLGL=$(yesno sdl opengl) \
BUILD_CTFDLL=YES \
BUILD_XATRIX=$(yesno xatrix) \
BUILD_ROGUE=$(yesno rogue) \
BUILD_JOYSTICK=$(yesno joystick) \
BUILD_DEDICATED=YES \
BUILD_AA=$(yesno aalib) \
BUILD_QMAX=${BUILD_QMAX} \
HAVE_IPV6=NO \
BUILD_ARTS=NO \
SDLDIR=/usr/lib \
BUILD_ARTS=$(yesno arts) \
OPTCFLAGS="${CFLAGS}" \
|| die "make failed"
#HAVE_IPV6=$(yesno ipv6) \
# now we save the build dir ... except for the object files ...
rm release*/*/*.o
mv release* my-rel-${BUILD_QMAX}
cd my-rel-${BUILD_QMAX}
rm -rf ref_{gl,soft} ded game client ctf/*.o
mkdir baseq2
mv game*.so baseq2/
cd ..
done
}
src_install() {
local q2dir=${GAMES_LIBDIR}/${PN}
local q2maxdir=${GAMES_LIBDIR}/${PN}-qmax
dodoc readme.txt README TODO ${FILESDIR}/README-postinstall
# regular q2 files
dodir ${q2dir}
cp -rf my-rel-NO/* ${D}/${q2dir}/
dogamesbin ${D}/${q2dir}/{quake2,q2ded}
rm ${D}/${q2dir}/{quake2,q2ded}
use sdl && dogamesbin ${D}/${q2dir}/sdlquake2 && rm ${D}/${q2dir}/sdlquake2
# q2max files
if ! use noqmax ; then
dodir ${q2maxdir}
cp -rf my-rel-YES/* ${D}/${q2maxdir}/
newgamesbin ${D}/${q2maxdir}/quake2 quake2-qmax
newgamesbin ${D}/${q2maxdir}/q2ded q2ded-qmax
rm ${D}/${q2maxdir}/{quake2,q2ded}
use sdl && newgamesbin ${D}/${q2maxdir}/sdlquake2 sdlquake2-qmax && rm ${D}/${q2maxdir}/sdlquake2
insinto ${q2maxdir}/baseq2
doins ${DISTDIR}/maxpak.pak
fi
prepgamesdirs
}
pkg_postinst() {
if [ "${USING_X11}" -eq "1" ]
then
opengl-update ${GL_IMPLEM}
fi
games_pkg_postinst
einfo "Go read /usr/share/doc/${PF}/README-postinstall.gz right now!"
einfo "It's important- This install is just the engine, you still need"
einfo "the data paks. Go read."
}
|