1 |
nyhm 09/10/02 04:56:24 |
2 |
|
3 |
Modified: games-mods.eclass |
4 |
Log: |
5 |
drop pkg_setup; USE deps to replace built_with_use tests; allow for mods with no server |
6 |
|
7 |
Revision Changes Path |
8 |
1.30 eclass/games-mods.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/games-mods.eclass?rev=1.30&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/games-mods.eclass?rev=1.30&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/games-mods.eclass?r1=1.29&r2=1.30 |
13 |
|
14 |
Index: games-mods.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v |
17 |
retrieving revision 1.29 |
18 |
retrieving revision 1.30 |
19 |
diff -u -r1.29 -r1.30 |
20 |
--- games-mods.eclass 1 Oct 2009 22:36:24 -0000 1.29 |
21 |
+++ games-mods.eclass 2 Oct 2009 04:56:24 -0000 1.30 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2009 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.29 2009/10/01 22:36:24 nyhm Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/games-mods.eclass,v 1.30 2009/10/02 04:56:24 nyhm 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 |
@@ -10,17 +10,18 @@ |
31 |
# MOD_ICON - Custom icon for the mod, instead of the default |
32 |
# MOD_NAME - Creates a command-line wrapper and desktop icon for the mod |
33 |
# MOD_TBZ2 - File to extract within the Makeself archive |
34 |
+# MOD_NO_DED - Set this non-empty if the mod doesn't have a server |
35 |
|
36 |
inherit eutils games |
37 |
|
38 |
-EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst |
39 |
+EXPORT_FUNCTIONS src_unpack src_install pkg_postinst |
40 |
|
41 |
[[ -z ${GAME} ]] && GAME=${PN%%-*} |
42 |
|
43 |
# Set our default title, icon, and cli options |
44 |
-case "${GAME}" in |
45 |
- "doom3") |
46 |
- RDEPEND="games-fps/doom3" |
47 |
+case ${GAME} in |
48 |
+ doom3) |
49 |
+ GAME_PKGS="games-fps/doom3" |
50 |
GAME_TITLE="Doom 3" |
51 |
DEFAULT_MOD_ICON="doom3" |
52 |
SELECT_MOD="+set fs_game " |
53 |
@@ -29,8 +30,8 @@ |
54 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
55 |
DED_CFG_DIR=".doom3" |
56 |
;; |
57 |
- "enemy-territory") |
58 |
- RDEPEND="games-fps/enemy-territory" |
59 |
+ enemy-territory) |
60 |
+ GAME_PKGS="games-fps/enemy-territory" |
61 |
GAME_TITLE="Enemy Territory" |
62 |
DEFAULT_MOD_ICON="ET" |
63 |
SELECT_MOD="+set fs_game " |
64 |
@@ -39,8 +40,8 @@ |
65 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
66 |
DED_CFG_DIR=".etwolf" |
67 |
;; |
68 |
- "quake3") |
69 |
- RDEPEND="|| ( games-fps/quake3 games-fps/quake3-bin )" |
70 |
+ quake3) |
71 |
+ GAME_PKGS="games-fps/quake3 games-fps/quake3-bin" |
72 |
GAME_TITLE="Quake III" |
73 |
DEFAULT_MOD_ICON="quake3" |
74 |
SELECT_MOD="+set fs_game " |
75 |
@@ -49,8 +50,8 @@ |
76 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
77 |
DED_CFG_DIR=".q3a" |
78 |
;; |
79 |
- "quake4") |
80 |
- RDEPEND="games-fps/quake4-bin" |
81 |
+ quake4) |
82 |
+ GAME_PKGS="games-fps/quake4-bin" |
83 |
GAME_TITLE="Quake 4" |
84 |
DEFAULT_MOD_ICON="/usr/share/pixmaps/quake4.bmp" |
85 |
SELECT_MOD="+set fs_game " |
86 |
@@ -59,8 +60,8 @@ |
87 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
88 |
DED_CFG_DIR=".quake4" |
89 |
;; |
90 |
- "ut2003") |
91 |
- RDEPEND="games-fps/ut2003" |
92 |
+ ut2003) |
93 |
+ GAME_PKGS="games-fps/ut2003" |
94 |
GAME_TITLE="UT2003" |
95 |
DEFAULT_MOD_ICON="ut2003" |
96 |
SELECT_MOD="-mod=" |
97 |
@@ -69,8 +70,8 @@ |
98 |
DED_OPTIONS="" |
99 |
DED_CFG_DIR="" |
100 |
;; |
101 |
- "ut2004") |
102 |
- RDEPEND="games-fps/ut2004" |
103 |
+ ut2004) |
104 |
+ GAME_PKGS="games-fps/ut2004" |
105 |
GAME_TITLE="UT2004" |
106 |
DEFAULT_MOD_ICON="ut2004" |
107 |
SELECT_MOD="-mod=" |
108 |
@@ -86,45 +87,54 @@ |
109 |
;; |
110 |
esac |
111 |
|
112 |
+games-mods_get_rdepend() { |
113 |
+ [[ $# -lt 1 ]] && die "${FUNCNAME}: need args" |
114 |
+ [[ $# -gt 1 ]] && echo -n "|| ( " |
115 |
+ |
116 |
+ case ${EAPI:-0} in |
117 |
+ 0|1) echo -n $@ ;; |
118 |
+ 2) |
119 |
+ local pkg |
120 |
+ for pkg in $@ ; do |
121 |
+ if [[ -z ${MOD_NO_DED} ]] ; then |
122 |
+ echo -n " ${pkg}[dedicated=,opengl=]" |
123 |
+ else |
124 |
+ echo -n " ${pkg}[opengl]" |
125 |
+ fi |
126 |
+ done |
127 |
+ ;; |
128 |
+ esac |
129 |
+ |
130 |
+ [[ $# -gt 1 ]] && echo -n " )" |
131 |
+} |
132 |
+ |
133 |
DESCRIPTION="${GAME_TITLE} ${MOD_NAME} - ${MOD_DESC}" |
134 |
|
135 |
SLOT="0" |
136 |
RESTRICT="mirror strip" |
137 |
|
138 |
DEPEND="app-arch/unzip" |
139 |
+RDEPEND="$(games-mods_get_rdepend ${GAME_PKGS})" |
140 |
|
141 |
S=${WORKDIR} |
142 |
|
143 |
dir=${GAMES_DATADIR}/${GAME} |
144 |
|
145 |
-default_client() { |
146 |
+games-mods_use_opengl() { |
147 |
+ [[ -n ${MOD_NO_DED} ]] && return 0 |
148 |
+ |
149 |
if use opengl || ! use dedicated ; then |
150 |
# Use opengl by default |
151 |
return 0 |
152 |
fi |
153 |
+ |
154 |
return 1 |
155 |
} |
156 |
|
157 |
-games-mods_pkg_setup() { |
158 |
- [[ -z "${MOD_NAME}" ]] && die "what is the name of this mod?" |
159 |
- |
160 |
- games_pkg_setup |
161 |
+games-mods_use_dedicated() { |
162 |
+ [[ -n ${MOD_NO_DED} ]] && return 1 |
163 |
|
164 |
- if has_version ${CATEGORY}/${GAME} ; then |
165 |
- if use dedicated && ! built_with_use ${CATEGORY}/${GAME} dedicated ; then |
166 |
- die "You must merge ${CATEGORY}/${GAME} with USE=dedicated!" |
167 |
- fi |
168 |
- if has_version ${CATEGORY}/${GAME}-bin ; then |
169 |
- if use dedicated && \ |
170 |
- ! built_with_use ${CATEGORY}/${GAME}-bin dedicated ; then |
171 |
- die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
172 |
- fi |
173 |
- fi |
174 |
- elif has_version ${CATEGORY}/${GAME}-bin ; then |
175 |
- if use dedicated && ! built_with_use ${CATEGORY}/${GAME}-bin dedicated ; then |
176 |
- die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
177 |
- fi |
178 |
- fi |
179 |
+ use dedicated && return 0 || return 1 |
180 |
} |
181 |
|
182 |
games-mods_src_unpack() { |
183 |
@@ -188,7 +198,7 @@ |
184 |
fi |
185 |
done |
186 |
|
187 |
- if default_client ; then |
188 |
+ if games-mods_use_opengl ; then |
189 |
if [[ -n "${MOD_ICON}" ]] ; then |
190 |
# Install custom icon |
191 |
MOD_ICON_EXT=${MOD_ICON##*.} |
192 |
@@ -340,7 +350,7 @@ |
193 |
fi |
194 |
fi |
195 |
|
196 |
- if use dedicated ; then |
197 |
+ if games-mods_use_dedicated ; then |
198 |
if [[ -f ${FILESDIR}/server.cfg ]] ; then |
199 |
insinto "${GAMES_SYSCONFDIR}"/${GAME}/${MOD_DIR} |
200 |
doins "${FILESDIR}"/server.cfg || die "Copying server config" |
201 |
@@ -360,7 +370,7 @@ |
202 |
|
203 |
games-mods_pkg_postinst() { |
204 |
games_pkg_postinst |
205 |
- if default_client ; then |
206 |
+ if games-mods_use_opengl ; then |
207 |
if [[ -n "${MOD_BINS}" ]] ; then |
208 |
for binary in ${MOD_BINS} ; do |
209 |
elog "To play this mod run:" |
210 |
@@ -373,7 +383,7 @@ |
211 |
echo |
212 |
fi |
213 |
fi |
214 |
- if use dedicated ; then |
215 |
+ if games-mods_use_dedicated ; then |
216 |
elog "To launch a dedicated server run:" |
217 |
elog " ${GAME_EXE}-${MOD_DIR}-ded" |
218 |
echo |