Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-fps/darkplaces/
Date: Sun, 29 Apr 2018 17:13:26
Message-Id: 1525021987.04cc0b1d9dbb62f88fa09761be0d61aac9857169.pacho@gentoo
1 commit: 04cc0b1d9dbb62f88fa09761be0d61aac9857169
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 29 16:45:30 2018 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 29 17:13:07 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04cc0b1d
7
8 games-fps/darkplaces: Stop using games.eclass
9
10 Package-Manager: Portage-2.3.31, Repoman-2.3.9
11
12 games-fps/darkplaces/darkplaces-20140513-r1.ebuild | 192 +++++++++++++++++++++
13 1 file changed, 192 insertions(+)
14
15 diff --git a/games-fps/darkplaces/darkplaces-20140513-r1.ebuild b/games-fps/darkplaces/darkplaces-20140513-r1.ebuild
16 new file mode 100644
17 index 00000000000..dc66236c626
18 --- /dev/null
19 +++ b/games-fps/darkplaces/darkplaces-20140513-r1.ebuild
20 @@ -0,0 +1,192 @@
21 +# Copyright 1999-2018 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=6
25 +inherit eutils flag-o-matic unpacker
26 +
27 +# Latest versions are in http://icculus.org/twilight/darkplaces/files/
28 +MY_PV="${PV/_beta/beta}"
29 +MY_ENGINE="${PN}engine${MY_PV}.zip"
30 +
31 +# Different Quake 1 engines expect the lights in different directories
32 +# http://www.fuhquake.net/download.html and http://www.kgbsyndicate.com/romi/
33 +MY_LIGHTS="fuhquake-lits.rar"
34 +
35 +DESCRIPTION="Enhanced engine for iD Software's Quake 1"
36 +HOMEPAGE="http://icculus.org/twilight/darkplaces/"
37 +SRC_URI="http://icculus.org/twilight/${PN}/files/${MY_ENGINE}
38 + lights? (
39 + http://www.fuhquake.net/files/extras/${MY_LIGHTS}
40 + http://www.kgbsyndicate.com/romi/id1.pk3 )"
41 +
42 +LICENSE="GPL-2"
43 +SLOT="0"
44 +KEYWORDS="~amd64 ~x86"
45 +IUSE="alsa cdinstall cdsound debug dedicated demo lights opengl oss sdl textures"
46 +
47 +UIRDEPEND="
48 + virtual/jpeg:0
49 + media-libs/libogg
50 + media-libs/libvorbis
51 + virtual/opengl
52 + alsa? ( media-libs/alsa-lib )
53 + sdl? ( media-libs/libsdl )
54 + x11-libs/libX11
55 + x11-libs/libXpm
56 + x11-libs/libXxf86dga
57 + x11-libs/libXxf86vm
58 +"
59 +UIDEPEND="
60 + x11-proto/xextproto
61 + x11-proto/xf86dgaproto
62 + x11-proto/xf86vidmodeproto
63 + x11-proto/xproto
64 +"
65 +RDEPEND="
66 + net-misc/curl
67 + cdinstall? ( games-fps/quake1-data )
68 + demo? ( games-fps/quake1-demodata )
69 + textures? ( >=games-fps/quake1-textures-20050820 )
70 + opengl? ( ${UIRDEPEND} )
71 + !opengl? ( sdl? ( ${UIRDEPEND} ) )
72 + !opengl? ( !sdl? ( !dedicated? ( ${UIRDEPEND} ) ) )
73 +"
74 +DEPEND="lights? ( || (
75 + app-arch/unrar
76 + app-arch/rar ) )
77 + opengl? (
78 + ${UIRDEPEND}
79 + ${UIDEPEND} )
80 + !opengl? ( sdl? (
81 + ${UIRDEPEND}
82 + ${UIDEPEND} ) )
83 + !opengl? ( !sdl? ( !dedicated? (
84 + ${UIRDEPEND}
85 + ${UIDEPEND} ) ) )
86 + virtual/pkgconfig
87 + app-arch/unzip
88 +"
89 +
90 +S="${WORKDIR}/${PN}"
91 +dir="/usr/share/quake1"
92 +
93 +opengl_client() { use opengl || ( ! use dedicated && ! use sdl ) }
94 +
95 +src_unpack() {
96 + if use lights ; then
97 + unpack "${MY_LIGHTS}"
98 + unpack_zip "${DISTDIR}"/id1.pk3
99 + mv *.lit maps/ || die
100 + mv ReadMe.txt rtlights.txt
101 + fi
102 + unpack "${MY_ENGINE}"
103 + unpack ./${PN}*.zip
104 +}
105 +
106 +src_prepare() {
107 + default
108 +
109 + rm "${WORKDIR}"/README-SDL.txt
110 + cd "${S}"
111 + rm mingw_note.txt
112 +
113 + strip-flags
114 +
115 + # Only additional CFLAGS optimization is the -march flag
116 + local march=$(get-flag -march)
117 + sed -i \
118 + -e "s:-lasound:$(pkg-config --libs alsa):" \
119 + -e "/^CPUOPTIMIZATIONS/d" \
120 + -e '/^OPTIM_RELEASE/s/=.*/=$(CFLAGS)/' \
121 + -e '/^OPTIM_DEBUG/s/=.*/=$(CFLAGS)/' \
122 + -e '/^LDFLAGS_DEBUG/s/$/ $(LDFLAGS)/' \
123 + -e '/^LDFLAGS_RELEASE/s/$/ $(LDFLAGS)/' \
124 + -e "s:strip:true:" \
125 + makefile.inc || die
126 +
127 + if ! use cdsound ; then
128 + # Turn the CD accesses off
129 + sed -i \
130 + -e "s:/dev/cdrom:/dev/null:" \
131 + cd_linux.c || die
132 + sed -i \
133 + -e 's:COM_CheckParm("-nocdaudio"):1:' \
134 + cd_shared.c || die
135 + fi
136 +}
137 +
138 +src_compile() {
139 + local opts="DP_FS_BASEDIR=\"${dir}\" DP_LINK_TO_LIBJPEG=1"
140 +
141 + # Preferred sound is alsa
142 + local sound_api="NULL"
143 + use oss && sound_api="OSS"
144 + use alsa && sound_api="ALSA"
145 + opts="${opts} DP_SOUND_API=${sound_api}"
146 +
147 + local type="release"
148 + use debug && type="debug"
149 +
150 + # Only compile a maximum of 1 client
151 + if use sdl ; then
152 + emake ${opts} "sdl-${type}"
153 + elif opengl_client ; then
154 + emake ${opts} "cl-${type}"
155 + fi
156 +
157 + if use dedicated ; then
158 + emake ${opts} "sv-${type}"
159 + fi
160 +}
161 +
162 +src_install() {
163 + if opengl_client || use sdl ; then
164 + local type=glx
165 +
166 + use sdl && type=sdl
167 +
168 + # darkplaces executable is needed, even just for demo
169 + newbin "${PN}-${type}" ${PN}
170 + newicon darkplaces72x72.png ${PN}.png
171 +
172 + if use demo ; then
173 + # Install command-line for demo, even if not desktop entry
174 + make_wrapper ${PN}-demo "${PN} -game demo"
175 + fi
176 +
177 + if use demo && ! use cdinstall ; then
178 + make_desktop_entry ${PN}-demo "Dark Places (Demo)"
179 + else
180 + # Full version takes precedence over demo
181 + make_desktop_entry ${PN} "Dark Places"
182 + fi
183 + fi
184 +
185 + if use dedicated ; then
186 + newbin ${PN}-dedicated ${PN}-ded
187 + fi
188 +
189 + dodoc *.txt ChangeLog todo "${WORKDIR}"/*.txt
190 +
191 + if use lights ; then
192 + insinto "${dir}"/id1
193 + doins -r "${WORKDIR}"/{cubemaps,maps}
194 + if use demo ; then
195 + # Set up symlinks, for the demo levels to include the lights
196 + local d
197 + for d in cubemaps maps ; do
198 + dosym "${dir}/id1/${d}" "${dir}/demo/${d}"
199 + done
200 + fi
201 + fi
202 +}
203 +
204 +pkg_postinst() {
205 + if ! use cdinstall && ! use demo ; then
206 + elog "Place pak0.pak and pak1.pak in ${dir}/id1"
207 + fi
208 +
209 + if use sdl $$ ! use alsa ; then
210 + ewarn "Select opengl with alsa, instead of sdl USE flag, for better audio latency."
211 + fi
212 +}