1 |
mr_bones_ 09/08/02 07:29:50 |
2 |
|
3 |
Modified: games-mods.eclass |
4 |
Log: |
5 |
format like the other games eclasses |
6 |
|
7 |
Revision Changes Path |
8 |
1.18 eclass/games-mods.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/games-mods.eclass?rev=1.18&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/games-mods.eclass?rev=1.18&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/games-mods.eclass?r1=1.17&r2=1.18 |
13 |
|
14 |
Index: games-mods.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v |
17 |
retrieving revision 1.17 |
18 |
retrieving revision 1.18 |
19 |
diff -u -r1.17 -r1.18 |
20 |
--- games-mods.eclass 13 Feb 2008 19:54:33 -0000 1.17 |
21 |
+++ games-mods.eclass 2 Aug 2009 07:29:50 -0000 1.18 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2006 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v 1.17 2008/02/13 19:54:33 mr_bones_ Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v 1.18 2009/08/02 07:29:50 mr_bones_ Exp $ |
27 |
|
28 |
# Variables to specify in an ebuild which uses this eclass: |
29 |
# GAME - (doom3, quake4 or ut2004, etc), unless ${PN} starts with e.g. "doom3-" |
30 |
@@ -91,13 +91,11 @@ |
31 |
Ddir=${D}/${dir} |
32 |
|
33 |
default_client() { |
34 |
- if use opengl || ! use dedicated |
35 |
- then |
36 |
+ if use opengl || ! use dedicated ; then |
37 |
# Use opengl by default |
38 |
return 0 |
39 |
- else |
40 |
- return 1 |
41 |
fi |
42 |
+ return 1 |
43 |
} |
44 |
|
45 |
games-mods_pkg_setup() { |
46 |
@@ -105,28 +103,20 @@ |
47 |
|
48 |
games_pkg_setup |
49 |
|
50 |
- if has_version ${CATEGORY}/${GAME} |
51 |
- then |
52 |
- if use dedicated && ! built_with_use ${CATEGORY}/${GAME} dedicated |
53 |
- then |
54 |
+ if has_version ${CATEGORY}/${GAME} ; then |
55 |
+ if use dedicated && ! built_with_use ${CATEGORY}/${GAME} dedicated ; then |
56 |
die "You must merge ${CATEGORY}/${GAME} with USE=dedicated!" |
57 |
fi |
58 |
- if has_version ${CATEGORY}/${GAME}-bin |
59 |
- then |
60 |
+ if has_version ${CATEGORY}/${GAME}-bin ; then |
61 |
if use dedicated && \ |
62 |
- ! built_with_use ${CATEGORY}/${GAME}-bin dedicated |
63 |
- then |
64 |
+ ! built_with_use ${CATEGORY}/${GAME}-bin dedicated ; then |
65 |
die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
66 |
fi |
67 |
fi |
68 |
- elif has_version ${CATEGORY}/${GAME}-bin |
69 |
- then |
70 |
- if use dedicated && ! built_with_use ${CATEGORY}/${GAME}-bin dedicated |
71 |
- then |
72 |
+ elif has_version ${CATEGORY}/${GAME}-bin ; then |
73 |
+ if use dedicated && ! built_with_use ${CATEGORY}/${GAME}-bin dedicated ; then |
74 |
die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
75 |
fi |
76 |
-# else |
77 |
-# die "${CATEGORY}/${GAME} not installed!" |
78 |
fi |
79 |
} |
80 |
|
81 |
@@ -158,8 +148,7 @@ |
82 |
do |
83 |
for ext in tar.bz2 tar.gz tbz2 tgz |
84 |
do |
85 |
- if [[ -e "${name}.${ext}" ]] |
86 |
- then |
87 |
+ if [[ -e "${name}.${ext}" ]] ; then |
88 |
tar xf "${name}.${ext}" -C "${S}"/unpack \ |
89 |
|| die "uncompressing tarball" |
90 |
# Remove the tarball after we unpack it |
91 |
@@ -177,14 +166,11 @@ |
92 |
INS_DIR=${dir} |
93 |
|
94 |
# We check if we have a specific MOD_DIR listed |
95 |
- if [[ -n "${MOD_DIR}" ]] |
96 |
- then |
97 |
+ if [[ -n "${MOD_DIR}" ]] ; then |
98 |
# Am installing into a new subdirectory of the game |
99 |
- if [[ -d "${S}"/unpack/"${MOD_DIR}" ]] |
100 |
- then |
101 |
+ if [[ -d "${S}"/unpack/"${MOD_DIR}" ]] ; then |
102 |
INS_DIR=${dir} |
103 |
- elif [[ -d "${S}"/"${MOD_DIR}" ]] |
104 |
- then |
105 |
+ elif [[ -d "${S}"/"${MOD_DIR}" ]] ; then |
106 |
S=${WORKDIR}/${MOD_DIR} |
107 |
INS_DIR=${dir}/${MOD_DIR} |
108 |
fi |
109 |
@@ -195,16 +181,13 @@ |
110 |
# If we have a README, install it |
111 |
for readme in README* |
112 |
do |
113 |
- if [[ -e "${readme}" ]] |
114 |
- then |
115 |
+ if [[ -s "${readme}" ]] ; then |
116 |
dodoc "${readme}" || die "dodoc failed" |
117 |
fi |
118 |
done |
119 |
|
120 |
- if default_client |
121 |
- then |
122 |
- if [[ -n "${MOD_ICON}" ]] |
123 |
- then |
124 |
+ if default_client ; then |
125 |
+ if [[ -n "${MOD_ICON}" ]] ; then |
126 |
# Install custom icon |
127 |
MOD_ICON_EXT=${MOD_ICON##*.} |
128 |
newicon "${MOD_ICON}" "${PN}.${MOD_ICON_EXT}" |
129 |
@@ -222,18 +205,15 @@ |
130 |
fi |
131 |
|
132 |
# Set up command-line and desktop menu entries |
133 |
- if [[ -n "${MOD_BINS}" ]] |
134 |
- then |
135 |
+ if [[ -n "${MOD_BINS}" ]] ; then |
136 |
for binary in ${MOD_BINS} |
137 |
do |
138 |
- if [[ -n "${MOD_DIR}" ]] |
139 |
- then |
140 |
+ if [[ -n "${MOD_DIR}" ]] ; then |
141 |
games_make_wrapper "${GAME_EXE}-${MOD_BINS}" \ |
142 |
"${GAME_EXE} ${SELECT_MOD}${MOD_DIR}" "${dir}" "${dir}" |
143 |
make_desktop_entry "${GAME_EXE}-${MOD_BINS}" \ |
144 |
"${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" |
145 |
- elif [[ -e "${S}"/bin/"${binary}" ]] |
146 |
- then |
147 |
+ elif [[ -e "${S}"/bin/"${binary}" ]] ; then |
148 |
exeinto "${dir}" |
149 |
newexe bin/${binary} ${GAME_EXE}-${binary} \ |
150 |
|| die "newexe failed" |
151 |
@@ -242,16 +222,14 @@ |
152 |
# We want our wrapper to use the libraries/starting |
153 |
# directory of our game. If the game is in |
154 |
# GAMES_PREFIX_OPT, then we want to start there. |
155 |
- if [[ -d "${GAMES_PREFIX_OPT}"/${GAME} ]] |
156 |
- then |
157 |
+ if [[ -d "${GAMES_PREFIX_OPT}"/${GAME} ]] ; then |
158 |
GAME_DIR="${GAMES_PREFIX_OPT}/${GAME}" |
159 |
else |
160 |
GAME_DIR="${dir}" |
161 |
fi |
162 |
games_make_wrapper "${GAME_EXE}-${binary}" \ |
163 |
./"${GAME_EXE}-${binary}" "${GAME_DIR}" "${GAME_DIR}" |
164 |
- if [[ "${bin_name}" == "${binary}" ]] |
165 |
- then |
166 |
+ if [[ "${bin_name}" == "${binary}" ]] ; then |
167 |
bin_name=${MOD_NAME} |
168 |
else |
169 |
for tmp1 in ${bin_name} |
170 |
@@ -270,10 +248,9 @@ |
171 |
rm -f bin/${binary} |
172 |
fi |
173 |
done |
174 |
- # We don't want to leave the binary directory around |
175 |
- rm -rf bin |
176 |
- elif [[ -n "${MOD_DIR}" ]] |
177 |
- then |
178 |
+ # We don't want to leave the binary directory around |
179 |
+ rm -rf bin |
180 |
+ elif [[ -n "${MOD_DIR}" ]] ; then |
181 |
games_make_wrapper "${GAME_EXE}-${MOD_DIR}" \ |
182 |
"${GAME_EXE} ${SELECT_MOD}${MOD_DIR}" "${dir}" "${dir}" |
183 |
make_desktop_entry "${GAME_EXE}-${MOD_DIR}" \ |
184 |
@@ -282,8 +259,7 @@ |
185 |
# we only look for quake3 here. |
186 |
case "${GAME_EXE}" in |
187 |
"quake3") |
188 |
- if has_version games-fps/quake3-bin |
189 |
- then |
190 |
+ if has_version games-fps/quake3-bin ; then |
191 |
games_make_wrapper "${GAME_EXE}-bin-${MOD_DIR}" \ |
192 |
"${GAME_EXE}-bin ${SELECT_MOD}${MOD_DIR}" \ |
193 |
"${dir}" "${dir}" |
194 |
@@ -297,16 +273,14 @@ |
195 |
fi |
196 |
|
197 |
# Copy our unpacked files, if it exists |
198 |
- if [[ -d "${S}"/unpack ]] |
199 |
- then |
200 |
+ if [[ -d "${S}"/unpack ]] ; then |
201 |
insinto "${INS_DIR}" |
202 |
doins -r "${S}"/unpack/* || die "copying files" |
203 |
rm -rf "${S}"/unpack |
204 |
fi |
205 |
|
206 |
# We expect anything not wanted to have been deleted by the ebuild |
207 |
- if [[ ! -z $(ls "${S}"/* 2> /dev/null) ]] |
208 |
- then |
209 |
+ if [[ ! -z $(ls "${S}"/* 2> /dev/null) ]] ; then |
210 |
insinto "${INS_DIR}" |
211 |
doins -r * || die "doins -r failed" |
212 |
fi |
213 |
@@ -316,37 +290,31 @@ |
214 |
# into ${GAMES_PREFIX_OPT}/${GAME}/${MOD_DIR} for each game. This should |
215 |
# allow us to support both binary and source-based games easily. |
216 |
if [[ -d "${GAMES_PREFIX_OPT}"/"${GAME}" ]] && \ |
217 |
- [[ "${GAMES_PREFIX_OPT}" != "${GAMES_DATADIR}" ]] |
218 |
- then |
219 |
+ [[ "${GAMES_PREFIX_OPT}" != "${GAMES_DATADIR}" ]] ; then |
220 |
dodir "${GAMES_PREFIX_OPT}"/"${GAME}" |
221 |
mod=$(echo "${INS_DIR}" | sed -e "s:${GAMES_DATADIR}/${GAME}::" -e "s:^/::" ) |
222 |
- if [[ -z "${mod}" ]] |
223 |
- then |
224 |
+ if [[ -z "${mod}" ]] ; then |
225 |
# Our mod doesn't have its own directory. We now traverse the |
226 |
# directory structure and try to symlink everything to |
227 |
# GAMES_PREFIX_OPT/GAME so it'll work. |
228 |
directories=$(cd "${D}"/"${INS_DIR}";find . -maxdepth 1 -type d -printf '%P ') |
229 |
for i in ${directories} |
230 |
do |
231 |
- if [[ -h "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] |
232 |
- then |
233 |
+ if [[ -h "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] ; then |
234 |
# Skip this directory, and just run a symlink |
235 |
dosym "${INS_DIR}"/${i} \ |
236 |
"${GAMES_PREFIX_OPT}"/"${GAME}"/${i} || die |
237 |
- elif [[ -d "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] |
238 |
- then |
239 |
+ elif [[ -d "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] ; then |
240 |
dodir "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} |
241 |
cd "${D}"/"${INS_DIR}"/${i} |
242 |
files="$(find . -type f -printf '%P ')" |
243 |
for j in ${files} |
244 |
do |
245 |
- if has_version ${CATEGORY}/${PN} |
246 |
- then |
247 |
+ if has_version ${CATEGORY}/${PN} ; then |
248 |
dosym "${INS_DIR}"/${i}/${j} \ |
249 |
"${GAMES_PREFIX_OPT}"/"${GAME}"/${i}/${j} \ |
250 |
|| die |
251 |
- elif [[ ! -e "${GAMES_PREFIX_OPT}"/"${GAME}"/${i}/${j} ]] |
252 |
- then |
253 |
+ elif [[ ! -e "${GAMES_PREFIX_OPT}"/"${GAME}"/${i}/${j} ]] ; then |
254 |
dosym "${INS_DIR}"/${i}/${j} \ |
255 |
"${GAMES_PREFIX_OPT}"/"${GAME}"/${i}/${j} \ |
256 |
|| die |
257 |
@@ -369,18 +337,15 @@ |
258 |
cp -a "${D}"/"${INS_DIR}"/${i} \ |
259 |
${D}/"${GAMES_PREFIX_OPT}"/"${GAME}"/${i} || die |
260 |
done |
261 |
- elif [[ ! -f "${GAMES_PREFIX_OPT}"/"${GAME}"/${mod} ]] |
262 |
- then |
263 |
+ elif [[ ! -f "${GAMES_PREFIX_OPT}"/"${GAME}"/${mod} ]] ; then |
264 |
elog "Creating symlink for ${mod}" |
265 |
dosym "${INS_DIR}" "${GAMES_PREFIX_OPT}"/"${GAME}" || die |
266 |
fi |
267 |
fi |
268 |
|
269 |
- if use dedicated |
270 |
- then |
271 |
+ if use dedicated ; then |
272 |
dodir "${GAMES_STATEDIR}" |
273 |
- if [[ -e ${FILESDIR}/server.cfg ]] |
274 |
- then |
275 |
+ if [[ -e ${FILESDIR}/server.cfg ]] ; then |
276 |
insinto "${GAMES_SYSCONFDIR}"/${GAME}/${MOD_DIR} |
277 |
doins "${FILESDIR}"/server.cfg || die "Copying server config" |
278 |
case ${GAME} in |
279 |
@@ -422,25 +387,21 @@ |
280 |
|
281 |
games-mods_pkg_postinst() { |
282 |
games_pkg_postinst |
283 |
- if default_client |
284 |
- then |
285 |
- if [[ -n "${MOD_BINS}" ]] |
286 |
- then |
287 |
+ if default_client ; then |
288 |
+ if [[ -n "${MOD_BINS}" ]] ; then |
289 |
for binary in ${MOD_BINS} |
290 |
do |
291 |
elog "To play this mod run:" |
292 |
elog " ${GAME_EXE}-${binary}" |
293 |
echo |
294 |
done |
295 |
- elif [[ -n "${MOD_DIR}" ]] |
296 |
- then |
297 |
+ elif [[ -n "${MOD_DIR}" ]] ; then |
298 |
elog "To play this mod run:" |
299 |
elog " ${GAME_EXE}-${MOD_DIR}" |
300 |
echo |
301 |
fi |
302 |
fi |
303 |
- if use dedicated |
304 |
- then |
305 |
+ if use dedicated ; then |
306 |
elog "To launch a dedicated server run:" |
307 |
elog " ${GAME_EXE}-${MOD_DIR}-ded" |
308 |
echo |
309 |
@@ -485,8 +446,7 @@ |
310 |
} |
311 |
|
312 |
games-mods_make_conf.d() { |
313 |
- if [[ -e ${FILESDIR}/${GAME_EXE}-${MOD_DIR}.conf.d ]] |
314 |
- then |
315 |
+ if [[ -e ${FILESDIR}/${GAME_EXE}-${MOD_DIR}.conf.d ]] ; then |
316 |
cp "${FILESDIR}"/${GAME_EXE}-${MOD_DIR}.conf.d \ |
317 |
"${T}"/${GAME_EXE}-${MOD_DIR}-ded.conf.d |
318 |
return 0 |