Lines 6-13
Link Here
|
6 |
# GAME - (doom3, quake4 or ut2004, etc), unless ${PN} starts with e.g. "doom3-" |
6 |
# GAME - (doom3, quake4 or ut2004, etc), unless ${PN} starts with e.g. "doom3-" |
7 |
# MOD_BINS - Name of the binary to run |
7 |
# MOD_BINS - Name of the binary to run |
8 |
# MOD_DESC - Description for the mod |
8 |
# MOD_DESC - Description for the mod |
9 |
# MOD_DIR - Subdirectory name for the mod, if applicable |
9 |
# MOD_DIR - Subdirectory name for the mod, if applicable |
10 |
# MOD_ICON - Custom icon for the mod, instead of the default |
10 |
# MOD_ICON - Custom icon for the mod, instead of the default |
|
|
11 |
# MOD_MAP - Name of map to load at start, if applicable |
11 |
# MOD_NAME - Creates a command-line wrapper and desktop icon for the mod |
12 |
# MOD_NAME - Creates a command-line wrapper and desktop icon for the mod |
12 |
# MOD_TBZ2 - File to extract within the Makeself archive |
13 |
# MOD_TBZ2 - File to extract within the Makeself archive |
13 |
|
14 |
|
Lines 15-71
Link Here
|
15 |
|
16 |
|
16 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst |
17 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst |
17 |
|
18 |
|
18 |
[[ -z ${GAME} ]] && GAME=${PN%%-*} |
19 |
[[ -z "${GAME}" ]] && GAME=${PN%%-*} |
|
|
20 |
GAME_EXE=${GAME} |
21 |
DED_EXE=${GAME_EXE}-ded |
22 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
23 |
SELECT_MOD="+set fs_game " |
24 |
SELECT_MAP="+map " |
19 |
|
25 |
|
20 |
# Set our default title, icon, and cli options |
26 |
# Set our default title, icon, and cli options |
21 |
case "${GAME}" in |
27 |
case "${GAME}" in |
22 |
"doom3") |
28 |
"doom3") |
23 |
GAME_TITLE="Doom III" |
29 |
GAME_TITLE="Doom III" |
24 |
DEFAULT_MOD_ICON="doom3.png" |
30 |
DEFAULT_MOD_ICON="doom3.png" |
25 |
SELECT_MOD="+set fs_game " |
|
|
26 |
GAME_EXE="doom3" |
27 |
DED_EXE="doom3-ded" |
28 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
29 |
;; |
31 |
;; |
30 |
"enemy-territory") |
32 |
"enemy-territory") |
31 |
GAME_TITLE="Enemy Territory" |
33 |
GAME_TITLE="Enemy Territory" |
32 |
DEFAULT_MOD_ICON="ET.xpm" |
34 |
DEFAULT_MOD_ICON="ET.xpm" |
33 |
SELECT_MOD="+set fs_game " |
|
|
34 |
GAME_EXE="et" |
35 |
GAME_EXE="et" |
35 |
DED_EXE="et-ded" |
36 |
DED_EXE="et-ded" |
36 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
|
|
37 |
;; |
37 |
;; |
38 |
"quake3") |
38 |
"quake3") |
39 |
GAME_TITLE="Quake III" |
39 |
GAME_TITLE="Quake III" |
40 |
DEFAULT_MOD_ICON="quake3.xpm" |
40 |
DEFAULT_MOD_ICON="quake3.xpm" |
41 |
SELECT_MOD="+set fs_game " |
|
|
42 |
GAME_EXE="quake3" |
43 |
DED_EXE="quake3-ded" |
44 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
45 |
;; |
41 |
;; |
46 |
"quake4") |
42 |
"quake4") |
47 |
GAME_TITLE="Quake IV" |
43 |
GAME_TITLE="Quake IV" |
48 |
DEFAULT_MOD_ICON="quake4.bmp" |
44 |
DEFAULT_MOD_ICON="quake4.bmp" |
49 |
SELECT_MOD="+set fs_game " |
|
|
50 |
GAME_EXE="q4" |
51 |
DED_EXE="q4-ded" |
52 |
DED_OPTIONS="+set dedicated 1 +exec server.cfg" |
53 |
;; |
45 |
;; |
54 |
"ut2003") |
46 |
"ut2003") |
55 |
GAME_TITLE="UT2003" |
47 |
GAME_TITLE="UT2003" |
56 |
DEFAULT_MOD_ICON="ut2003.xpm" |
48 |
DEFAULT_MOD_ICON="ut2003.xpm" |
57 |
SELECT_MOD="-mod=" |
49 |
SELECT_MOD="-mod=" |
58 |
GAME_EXE="ut2003" |
|
|
59 |
DED_EXE="ucc" |
50 |
DED_EXE="ucc" |
60 |
DED_OPTIONS="" |
51 |
DED_OPTIONS="" |
|
|
52 |
SELECT_MAP="" |
61 |
;; |
53 |
;; |
62 |
"ut2004") |
54 |
"ut2004") |
63 |
GAME_TITLE="UT2004" |
55 |
GAME_TITLE="UT2004" |
64 |
DEFAULT_MOD_ICON="ut2004.xpm" |
56 |
DEFAULT_MOD_ICON="ut2004.xpm" |
65 |
SELECT_MOD="-mod=" |
57 |
SELECT_MOD="-mod=" |
66 |
GAME_EXE="ut2004" |
|
|
67 |
DED_EXE="ucc" |
58 |
DED_EXE="ucc" |
68 |
DED_OPTIONS="" |
59 |
DED_OPTIONS="" |
|
|
60 |
SELECT_MAP="" |
69 |
;; |
61 |
;; |
70 |
*) |
62 |
*) |
71 |
eerror "This game is either not supported or you must set the GAME" |
63 |
eerror "This game is either not supported or you must set the GAME" |
Lines 105-127
Link Here
|
105 |
|
97 |
|
106 |
games_pkg_setup |
98 |
games_pkg_setup |
107 |
|
99 |
|
108 |
if has_version ${CATEGORY}/${GAME} |
100 |
if has_version "${CATEGORY}/${GAME}" |
109 |
then |
101 |
then |
110 |
if use dedicated && ! built_with_use ${CATEGORY}/${GAME} dedicated |
102 |
if use dedicated && ! built_with_use "${CATEGORY}/${GAME}" dedicated |
111 |
then |
103 |
then |
112 |
die "You must merge ${CATEGORY}/${GAME} with USE=dedicated!" |
104 |
die "You must merge ${CATEGORY}/${GAME} with USE=dedicated!" |
113 |
fi |
105 |
fi |
114 |
if has_version ${CATEGORY}/${GAME}-bin |
106 |
if has_version "${CATEGORY}/${GAME}-bin" |
115 |
then |
107 |
then |
116 |
if use dedicated && \ |
108 |
if use dedicated && \ |
117 |
! built_with_use ${CATEGORY}/${GAME}-bin dedicated |
109 |
! built_with_use "${CATEGORY}/${GAME}-bin" dedicated |
118 |
then |
110 |
then |
119 |
die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
111 |
die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
120 |
fi |
112 |
fi |
121 |
fi |
113 |
fi |
122 |
elif has_version ${CATEGORY}/${GAME}-bin |
114 |
elif has_version "${CATEGORY}/${GAME}-bin" |
123 |
then |
115 |
then |
124 |
if use dedicated && ! built_with_use ${CATEGORY}/${GAME}-bin dedicated |
116 |
if use dedicated && ! built_with_use "${CATEGORY}/${GAME}-bin" dedicated |
125 |
then |
117 |
then |
126 |
die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
118 |
die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" |
127 |
fi |
119 |
fi |
Lines 135-141
Link Here
|
135 |
for src_uri in ${A} |
127 |
for src_uri in ${A} |
136 |
do |
128 |
do |
137 |
URI_SUFFIX="${src_uri##*.}" |
129 |
URI_SUFFIX="${src_uri##*.}" |
138 |
case ${URI_SUFFIX##*.} in |
130 |
case "${URI_SUFFIX##*.}" in |
139 |
bin|run) |
131 |
bin|run) |
140 |
# We have a Makeself archive, use unpack_makeself |
132 |
# We have a Makeself archive, use unpack_makeself |
141 |
unpack_makeself "${src_uri}" |
133 |
unpack_makeself "${src_uri}" |
Lines 169-178
Link Here
|
169 |
done |
161 |
done |
170 |
done |
162 |
done |
171 |
# Since we remove all of these anyway, let's move it to the eclass |
163 |
# Since we remove all of these anyway, let's move it to the eclass |
172 |
rm -f 3355_patch |
164 |
[[ -e 3355_patch ]] && rm -f 3355_patch |
173 |
} |
165 |
} |
174 |
|
166 |
|
175 |
games-mods_src_install() { |
167 |
games-mods_src_install() { |
|
|
168 |
local binary |
176 |
local readme MOD_ICON_EXT new_bin_name bin_name mod files directories i j |
169 |
local readme MOD_ICON_EXT new_bin_name bin_name mod files directories i j |
177 |
INS_DIR=${dir} |
170 |
INS_DIR=${dir} |
178 |
|
171 |
|
Lines 208-214
Link Here
|
208 |
# Install custom icon |
201 |
# Install custom icon |
209 |
MOD_ICON_EXT=${MOD_ICON##*.} |
202 |
MOD_ICON_EXT=${MOD_ICON##*.} |
210 |
newicon "${MOD_ICON}" "${PN}.${MOD_ICON_EXT}" |
203 |
newicon "${MOD_ICON}" "${PN}.${MOD_ICON_EXT}" |
211 |
case ${MOD_ICON_EXT} in |
204 |
case "${MOD_ICON_EXT}" in |
212 |
bmp|ico) |
205 |
bmp|ico) |
213 |
MOD_ICON=/usr/share/pixmaps/${PN}.${MOD_ICON_EXT} |
206 |
MOD_ICON=/usr/share/pixmaps/${PN}.${MOD_ICON_EXT} |
214 |
;; |
207 |
;; |
Lines 222-227
Link Here
|
222 |
fi |
215 |
fi |
223 |
|
216 |
|
224 |
# Set up command-line and desktop menu entries |
217 |
# Set up command-line and desktop menu entries |
|
|
218 |
local game_select="${SELECT_MOD}${MOD_DIR}" |
219 |
[[ -n "${MOD_MAP}" ]] \ |
220 |
&& game_select="${game_select} ${SELECT_MAP}${MOD_MAP}" |
221 |
|
225 |
if [[ -n "${MOD_BINS}" ]] |
222 |
if [[ -n "${MOD_BINS}" ]] |
226 |
then |
223 |
then |
227 |
for binary in ${MOD_BINS} |
224 |
for binary in ${MOD_BINS} |
Lines 229-248
Link Here
|
229 |
if [[ -n "${MOD_DIR}" ]] |
226 |
if [[ -n "${MOD_DIR}" ]] |
230 |
then |
227 |
then |
231 |
games_make_wrapper "${GAME_EXE}-${MOD_BINS}" \ |
228 |
games_make_wrapper "${GAME_EXE}-${MOD_BINS}" \ |
232 |
"${GAME_EXE} ${SELECT_MOD}${MOD_DIR}" "${dir}" "${dir}" |
229 |
"${GAME_EXE} ${game_select}" "${dir}" "${dir}" |
233 |
make_desktop_entry "${GAME_EXE}-${MOD_BINS}" \ |
230 |
make_desktop_entry "${GAME_EXE}-${MOD_BINS}" \ |
234 |
"${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" |
231 |
"${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" |
235 |
elif [[ -e "${S}"/bin/"${binary}" ]] |
232 |
elif [[ -e "${S}"/bin/"${binary}" ]] |
236 |
then |
233 |
then |
237 |
exeinto "${dir}" |
234 |
exeinto "${dir}" |
238 |
newexe bin/${binary} ${GAME_EXE}-${binary} \ |
235 |
newexe "bin/${binary} ${GAME_EXE}-${binary}" \ |
239 |
|| die "newexe failed" |
236 |
|| die "newexe failed" |
240 |
new_bin_name= |
237 |
new_bin_name= |
241 |
bin_name=$(echo ${binary} | sed -e 's:[-_.]: :g') |
238 |
bin_name=$(echo ${binary} | sed -e 's:[-_.]: :g') |
242 |
# We want our wrapper to use the libraries/starting |
239 |
# We want our wrapper to use the libraries/starting |
243 |
# directory of our game. If the game is in |
240 |
# directory of our game. If the game is in |
244 |
# GAMES_PREFIX_OPT, then we want to start there. |
241 |
# GAMES_PREFIX_OPT, then we want to start there. |
245 |
if [[ -d "${GAMES_PREFIX_OPT}"/${GAME} ]] |
242 |
if [[ -d "${GAMES_PREFIX_OPT}/${GAME}" ]] |
246 |
then |
243 |
then |
247 |
GAME_DIR="${GAMES_PREFIX_OPT}/${GAME}" |
244 |
GAME_DIR="${GAMES_PREFIX_OPT}/${GAME}" |
248 |
else |
245 |
else |
Lines 267-273
Link Here
|
267 |
make_desktop_entry "${GAME_EXE}-${binary}" \ |
264 |
make_desktop_entry "${GAME_EXE}-${binary}" \ |
268 |
"${GAME_TITLE} - ${bin_name}" "${MOD_ICON}" |
265 |
"${GAME_TITLE} - ${bin_name}" "${MOD_ICON}" |
269 |
# We remove the binary after we have installed it. |
266 |
# We remove the binary after we have installed it. |
270 |
rm -f bin/${binary} |
267 |
rm -f "bin/${binary}" |
271 |
fi |
268 |
fi |
272 |
done |
269 |
done |
273 |
# We don't want to leave the binary directory around |
270 |
# We don't want to leave the binary directory around |
Lines 275-281
Link Here
|
275 |
elif [[ -n "${MOD_DIR}" ]] |
272 |
elif [[ -n "${MOD_DIR}" ]] |
276 |
then |
273 |
then |
277 |
games_make_wrapper "${GAME_EXE}-${MOD_DIR}" \ |
274 |
games_make_wrapper "${GAME_EXE}-${MOD_DIR}" \ |
278 |
"${GAME_EXE} ${SELECT_MOD}${MOD_DIR}" "${dir}" "${dir}" |
275 |
"${GAME_EXE} ${game_select}" "${dir}" "${dir}" |
279 |
make_desktop_entry "${GAME_EXE}-${MOD_DIR}" \ |
276 |
make_desktop_entry "${GAME_EXE}-${MOD_DIR}" \ |
280 |
"${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" |
277 |
"${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" |
281 |
# Since only quake3 has both a binary and a source-based install, |
278 |
# Since only quake3 has both a binary and a source-based install, |
Lines 285-291
Link Here
|
285 |
if has_version games-fps/quake3-bin |
282 |
if has_version games-fps/quake3-bin |
286 |
then |
283 |
then |
287 |
games_make_wrapper "${GAME_EXE}-bin-${MOD_DIR}" \ |
284 |
games_make_wrapper "${GAME_EXE}-bin-${MOD_DIR}" \ |
288 |
"${GAME_EXE}-bin ${SELECT_MOD}${MOD_DIR}" \ |
285 |
"${GAME_EXE}-bin ${game_select}" \ |
289 |
"${dir}" "${dir}" |
286 |
"${dir}" "${dir}" |
290 |
fi |
287 |
fi |
291 |
make_desktop_entry "${GAME_EXE}-bin-${MOD_DIR}" \ |
288 |
make_desktop_entry "${GAME_EXE}-bin-${MOD_DIR}" \ |
Lines 327-337
Link Here
|
327 |
directories=$(cd "${D}"/"${INS_DIR}";find . -maxdepth 1 -type d -printf '%P ') |
324 |
directories=$(cd "${D}"/"${INS_DIR}";find . -maxdepth 1 -type d -printf '%P ') |
328 |
for i in ${directories} |
325 |
for i in ${directories} |
329 |
do |
326 |
do |
330 |
if [[ -h "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] |
327 |
if [[ -h "${GAMES_PREFIX_OPT}/${GAME}/${i}" ]] |
331 |
then |
328 |
then |
332 |
# Skip this directory, and just run a symlink |
329 |
# Skip this directory, and just run a symlink |
333 |
dosym "${INS_DIR}"/${i} \ |
330 |
dosym "${INS_DIR}/${i}" \ |
334 |
"${GAMES_PREFIX_OPT}"/"${GAME}"/${i} || die |
331 |
"${GAMES_PREFIX_OPT}/${GAME}/${i}" || die |
335 |
elif [[ -d "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] |
332 |
elif [[ -d "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} ]] |
336 |
then |
333 |
then |
337 |
dodir "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} |
334 |
dodir "${GAMES_PREFIX_OPT}"/"${GAME}"/${i} |
Lines 492-500
Link Here
|
492 |
fi |
489 |
fi |
493 |
cat <<-EOF > "${T}"/${GAME_EXE}-${MOD_DIR}-ded.conf.d |
490 |
cat <<-EOF > "${T}"/${GAME_EXE}-${MOD_DIR}-ded.conf.d |
494 |
$(<${PORTDIR}/header.txt) |
491 |
$(<${PORTDIR}/header.txt) |
495 |
|
492 |
|
496 |
# Any extra options you want to pass to the dedicated server |
493 |
# Any extra options you want to pass to the dedicated server |
497 |
# ${GAME_EXE}_${MOD_DIR}_OPTS="+set com_hunkmegs 64 +set com_zonemegs 32" |
494 |
# ${GAME_EXE}_${MOD_DIR}_OPTS="+set com_hunkmegs 64 +set com_zonemegs 32" |
498 |
|
495 |
|
499 |
EOF |
496 |
EOF |
500 |
} |
497 |
} |