blob: 8559e3cc0e79ff8607883b841a74c8c8740ae549 (
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: $
# [x] Base Install Required (+400MB)
# [x] Videos (+225MB)
# --------------------
# Total 625MB
inherit eutils games
IUSE="langpatch nocd videos"
DESCRIPTION="Civilization Call to Power"
HOMEPAGE="http://www.lokigames.com/products/civctp/"
KEYWORDS="x86"
DEPEND="virtual/libc
sys-apps/gawk
games-util/loki_patch"
# Since I do not have a PPC machine to test with, I will leave the PPC stuff in
# here so someone else can stabilize loki_setupdb and loki_patch for PPC and
# then KEYWORD this appropriately.
CTP_LANGUAGES="english french german italian spanish"
CTP_NO_LANG=${CTP_LANG:-y}
CTP_LANG=${CTP_LANG:-english}
SRC_URI="x86? (
mirror://lokigames/${PN}/${P}-english-unified-x86.run
linguas_fr? ( mirror://lokigames/${PN}/${P}-french-unified-x86.run )
linguas_de? ( mirror://lokigames/${PN}/${P}-german-unified-x86.run )
linguas_it? ( mirror://lokigames/${PN}/${P}-italian-unified-x86.run )
linguas_es? ( mirror://lokigames/${PN}/${P}-spanish-unified-x86.run )
)
ppc? (
mirror://lokigames/${PN}/${P}-english-unified-ppc.run
linguas_fr? ( mirror://lokigames/${PN}/${P}-french-unified-ppc.run )
linguas_de? ( mirror://lokigames/${PN}/${P}-german-unified-ppc.run )
linguas_it? ( mirror://lokigames/${PN}/${P}-italian-unified-ppc.run )
linguas_es? ( mirror://lokigames/${PN}/${P}-spanish-unified-ppc.run )
)
langpatch? (
mirror://lokigames/${PN}/${P}-${CTP_LANG}.run
)"
LICENSE="LOKI-EULA"
SLOT="0"
RESTRICT="nostrip nomirror"
S=${WORKDIR}
dir=${GAMES_PREFIX_OPT}
Ddir=${D}/${dir}
check_ctp2_cd_version() {
local CUR_LANG
local LANG_CNT
local MY_LANGS
local USED_LANG
cdrom_get_cds CivCTP-data.tar.gz
MY_LANGS=${CTP_LANGUAGES// /|}
USED_LANG=""
test -f ${CDROM_ROOT}/.ctpcd || die "No .ctpcd file found.";
CTP_VER=$(cat ${CDROM_ROOT}/.ctpcd)
test -f ${CDROM_ROOT}/setup/tarball.list || die "No setup/tarball.list found."
CTP_CD_LANG=$(awk -F/ "/\/ctp_data\/(${MY_LANGS})\/$/ { print \$3; }" ${CDROM_ROOT}/setup/tarball.list 2>/dev/null|head -n 1)
if test -z "${CTP_CD_LANG}"; then
die "Could not determine language of CtP-CD.";
else
einfo "Found CtP-CD version ${CTP_VER} in ${CTP_CD_LANG}."
fi
LANG_CNT=0
for CUR_LANG in ${CTP_LANG_USE}; do
if useq ${CUR_LANG}; then
LANG_CNT=$((LANG_CNT+1))
USED_LANG=${CUR_LANG}
fi
done
if [ $LANG_CNT -eq 0 ]; then
eerror ""
eerror "You did not specify the language of your CivCTP cd."
eerror ""
eerror "I determined you have the ${CTP_CD_LANG} version of CivCTP."
eerror "Please add civctp-${CTP_CD_LANG} to your USE-flags."
eerror ""
die "Language of CivCTP-CD not specified in USE-flags."
elif [ $LANG_CNT -gt 1 ]; then
eerror ""
eerror "You specified more than one language for your CivCTP cd."
eerror "Obviously, this cannot be true. I determined you have the"
eerror "${CTP_CD_LANG} version of CivCTP."
eerror "Please remove any other civctp-* flag from your USE-flags"
eerror ""
die "More than one language specified for CivCTP-CD"
fi
USED_LANG=${USED_LANG//civctp-/}
if [ "${CTP_CD_LANG}" != "${USED_LANG}" ]; then
eerror ""
eerror "You specified you have the ${USED_LANG} version of CivCTP."
eerror "However, i recognized the ${CTP_CD_LANG} version."
eerror "Please replace civctp-${USED_LANG} by ${CTP_CD_LANG}"
eerror "in your USE-flags."
eerror ""
die "Expected ${CTP_CD_LANG}, but got ${USED_LANG}."
fi
}
pkg_setup() {
check_license || die "License check failed"
use nocd && ewarn "The full installation takes about 625 MB of space!"
# The following is ugly, but we need to know the CTP version
# _before_ we can download the updates
check_ctp2_cd_version
if useq langpatch; then
if [ "${CTP_NO_LANG}" = "y" ]; then
ewarn ""
ewarn "You did not set the CTP_LANG variable to contain the language"
ewarn "your CivCTP should be patched to."
ewarn "Thus, i assume you want the ${CTP_LANG} version of CivCTP."
ewarn ""
fi
fi
games_pkg_setup
}
src_unpack() {
local my_a
# We patch in order of A=in order of SRC_URI
for my_a in ${A} ; do
mkdir -p ${S}/${my_a}.dir
cd ${S}/${my_a}.dir
unpack_makeself ${my_a}
done
}
src_install() {
local my_a
einfo "Copying files... this may take a while..."
dodir ${dir}
exeinto ${dir}
cd ${CDROM_ROOT} || die "Could not change directory to ${CDROM_ROOT}"
/bin/sh ${CDROM_ROOT}/setup/unpack_data install ${Ddir} > /dev/null 2>&1 || die "unpack_data failed"
if useq nocd; then
/bin/sh ${CDROM_ROOT}/setup/unpack_videos install ${Ddir} > /dev/null 2>&1 || die "unpack_videos failed"
elif useq videos; then
/bin/sh ${CDROM_ROOT}/setup/unpack_videos install ${Ddir} > /dev/null 2>&1 || die "unpack_videos failed"
fi
cd ${S}
for my_a in ${A}; do
einfo "Applying patch from ${my_a}..."
cd ${S}/${my_a}.dir || die "patch dir ${my_a}.dir does not exist in workdir."
loki_patch --verify patch.dat || die "Verifying patch failed"
loki_patch patch.dat ${Ddir}/CivCTP > /dev/null 2>&1 || die "Patching CivCTP to ${PV} failed."
done
games_make_wrapper civctp ./civctp ${dir}/CivCTP
insinto /usr/share/pixmaps
cp -p ${Ddir}/CivCTP/icon.xpm ${S}/civctp.xpm
doins ${S}/civctp.xpm
# now, since these files are coming off a cd, the times/sizes/md5sums wont
# be different ... that means portage will try to unmerge some files (!)
# we run touch on ${D} so as to make sure portage doesnt do any such thing
find ${Ddir} -exec touch '{}' \;
prepgamesdirs
make_desktop_entry civctp "Civilization Call to Power" "civctp.xpm"
}
pkg_postinst() {
einfo "To play the game run:"
einfo " civctp"
games_pkg_postinst
}
|