-
Notifications
You must be signed in to change notification settings - Fork 24
/
README.linux
300 lines (183 loc) · 10.2 KB
/
README.linux
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
THIS FILE IS NOT GENERATED OR SUPPORTED BY ACTIVISION.
This document provides instructions on how to compile the Civilization: Call
To Power 2 source code and install the game on your Linux system.
== Conventions used in this document ==
=======================================
Things you need to type into the shell are on a new line and prefixed with the
string "shell>". This is your shell prompt. So if you see:
shell> cd foo
then this means you should type "cd foo" at your shell prompt.
== Things you need to compile the Civ:CTP source ==
===================================================
- Berkeley YACC (byacc). Avaibility and install instructions depend on your
Linux distribution. If all fails, search for the source code by googling for
"byacc" (it's trivial to compile and install).
- SDL and its header files. Almost every distribution comes with the necessary
SDL packages, but you probably need to install the SDL development packages
to get the header files.
- SDL_mixer and its header files.
- SDL_ffmpeg > 0.7.0 and its header files.
- ffmpeg and its libavcodec
- X11 and its header files. The same as with SDL, check that you have the
development packages of XFree86 or X.org installed.
- Unzip. Especially unpacking the data files won't work if you don't have the
unzip utility installed.
- GCC, make, automake, autoconf
- The usual UN*X/Linux tools. This means bash, (g)awk, sed, Perl, etc. You
normally already have them installed.
- Microsoft's TrueType fonts. Specifically, you'll need "arial.ttf",
"times.ttf" and "timesbd.ttf". If you don't have them, just google for them,
they are easy to find and available freely.
== How to compile the Civ:CTP2 source with Linux ==
===================================================
A small suggestion first: don't work as root ! Always work (and compile) as a
normal user. This prevents unrepairable accidents, however unlikely they are.
You need to decide where you want Civ:CTP2 to be installed. Let's
assume your user name is "foo" and you want the final game to reside in your
home directory "/home/foo/CTP2". If you want to install the game system wide
then "/usr/local/CTP2" would be a good path.
Note that this document assumes you're using the path "/home/foo/CTP2" to
avoid permission problems/changing to the root account.
(note from lynx: I wonder if anyone ever got this to work on a case sensitiv
file system. I found case inconsistencies in the code. The script mentioned
later on that is ment to fix it (fix_data_names.sh) does not help if the code
is inconsistent about the case of opend files. The best way would be fixing
the code but if you are too lasy you can use a fat-filesystem (vfat). If you
don't have a partition at hand you can do as follows:
shell> mkfs.vfat -v -C ctp_vfat.img -n ctp_fs 700000
root> mount -v -t vfat -o loop /path/to/ctp_vfat.img /home/foo/CTP2
Now you have a vfat "partition" of around 700000kB at /home/foo/CTP2.
Linux is great, isn't it?)
So, let's start:
0. Go to the source code top level directory and do a bootstrap:
shell> make bootstrap
1. Run "configure". Assuming you want CTP2 installed in "/home/foo/CTP2" you
would type:
shell> ./configure --prefix=/home/foo/CTP2 --bindir=/home/foo/CTP2/ctp2_program/ctp
Note the "--bindir" option ! If you omit that, the "ctp2" binary will be
installed in "/home/foo/CTP2/bin", but this is not what we want, because
when we unpack the data some configuration files will be installed in
"/home/foo/CTP2/ctp2_program/ctp", so this is where we want our binary to
be installed as well.
If configure fails then you're normally missing one of the previously
mentioned packages or don't have a supported version installed. I'm sorry,
but you have to fix those problems on your own.
Note:
When having modified some code or updated the source with svn you can try
without a new configure. That way only the modified/new files get compiled
by make which can save you a lot of time! But do a new configure if you
plan to complain about some thing;)
2. Run "make". Simply type:
shell> make
This takes a loooong time. Go grab a good book or have a nice meal.
Depending on the speed of your system this can take up to almost 2 hours
(this was measured on a Pentium III 850MHz laptop, I assume your machine is
faster ;-)
If the compilation aborts and you're not a developer capable of fixing the
problems yourself, please contact the CTP2 developers at the Apolyton
forum:
http://apolyton.net/forums/forumdisplay.php?forumid=213
Note: If you don't plan on debugging the binary you can strip it down to
around 10MB (don't do this if you plan to use eg. gdb !!!):
shell> strip ctp2_code/ctp2
3. Run "make install" in the source directory.
shell> make install
If you've decided to install into a global directory like "/usr/local/CTP2"
then you need to use "su" or "sudo":
shell> su -c "make install"
or
shell> sudo make install
You'll get asked for your root password.
== How to unpack the Civ:CTP2 data files ==
===========================================
1. Mount your Civ:CTP2 CD. Again, this is system dependant. This document
assumes the mount point "/media/cdrom".
2. Create the directory where you want the game to be install into:
shell> mkdir -p /home/foo/CTP2
Then "cd" into the directory:
shell> cd /home/foo/CTP2
3. Unzip "civlang.ctp":
shell> unzip /media/cdrom/Setup/data/civlang.ctp
This will install a lot of new files in your CTP2 directory: you will get
a "Scenarios" directory, a "ctp2_data/<yourlanguage>" directory with the
language data of your CTP2 version and some configuration files in
"ctp2_program/ctp". These files were the reason for the "--bindir" option
for "configure".
4. Unzip "civmain.ctp":
shell> unzip /media/cdrom/Setup/data/civmain.ctp
This will install most of the data files like pictures, sounds and control
files into "ctp2_data/default" and some more files in the "Scenarios"
directory.
There will be some file collisions: if "unzip" tells you that certain files
exist and ask you whether to replace them, answer "(N)one" (just enter an
uppercase "N" and press return).
5. Call the "fix_data_names.sh" script from the "tools" directory in your CTP2
source directory:
shell> /path/to/ctp2_source/tools/fix_data_names.sh
This will fix some names of data files. The problem is that CTP2 was
developed on Windows and its file systems are case insensitive while Linux
file systems are case sensitive and thus won't find some files if we don't
rename them.
(Let's not get into the gory details, I know NTFS can be case sensitive
and that FAT based file systems are case insensitive under Linux as well)
6. Copy the new data files from the source directory:
shell> cp -Rf /path/to/ctp2_source/ctp2_data ./
This installs new/updated data files. If you omit this step you won't be
able to change the screen resolution, for example.
7. Call "fix_data_names.sh" again:
shell> /path/to/ctp2_source/tools/fix_data_names.sh
The reason we're calling it two times is because in the source some of the
data files have a different case then in ZIP files on the CD. So if we'd
call "fix_data_names.sh" only once we'd risk mixing files that shouldn't be
mixed.
So the first time we call "fix_data_names.sh" makes sure the names are in a
consistent state. We then copy the new data files and fix their names as
well and are now sure that the data files are up to date, have the correct
case and aren't mixed up.
8. Install the TrueType fonts:
shell> cp /path/to/arial.ttf /home/foo/CTP2/ctp2_data/default/uidata/fonts/
shell> cp /path/to/times.ttf /home/foo/CTP2/ctp2_data/default/uidata/fonts/
shell> cp /path/to/timesbd.ttf /home/foo/CTP2/ctp2_data/default/uidata/fonts/
Pay attention to the cases of the file names ! They must be lower case. If
they contain uppercase characters you must rename them.
9. Install texture.dat
Copy /media/cdrom/Setup/data/ctp2_program/ctp/texture.dat to the directory
where the ctp2 binary is installed (/home/foo/CTP2/ctp2_program/ctp).
shell> /media/cdrom/Setup/data/ctp2_program/ctp/texture.dat \
/home/foo/CTP2/ctp2_program/ctp
This file is used to determine a legal CD, and ctp2 will not start a
game without it.
Install some libs:
shell> pushd /home/foo/CTP2/ctp2_code/mapgen/.libs/ && cp crater.la crater.so geometric.la geometric.so plasma2.la plasma2.so /home/foo/CTP2/ctp2_program/ctp/dll/map/ && popd
10.Movies
ffmpeg and sdl_ffmpeg > 0.7.0 are used for movie playing now. Strangely ffmpeg can't
play the movies of the CD. So you'll have to convert them to a format ffmpeg
can handle.
One way of doing that is with mencoder (you can choose any codec ffmpeg
can play, even h264;):
shell> cd /home/foo/CTP2/ctp2_program/ctp
shell> for i in `ls /media/cdrom/Setup/data/Max/ctp2_data/default/videos/`; do mencoder -ovc lavc -lavcopts vcodec=mpeg4 -srate 44100 -af resample=44100 -oac lavc /media/cdrom/Setup/data/Max/ctp2_data/default/videos/$i -o $i; done
Note concerning languages:
The files ctp2_data/*/sound/sound.zfs contain the sound of units an so.
ctp2_data/default/sound/sound.zfs has the language independent sounds.
On the CD is only one language in the civlang.ctp file!
If you got another do the following to make use of it:
shell> sed -i '4s/german/english/' ctp2_program/ctp/civpaths.txt
== Finally ==
=============
You did it ! If everything worked as expected, then you can now cd into your
CTP2 program dir:
shell> cd /home/foo/CTP2/ctp2_program/ctp
and call the game:
shell> ./ctp2 fullscreen
Note: Get an idea of what commandline options you can use with:
shell> grep -Hn "strstr(szCmdLine" ctp2_code/ctp/civ3_main.cpp
nointromovie: skip intro movie
fullscreen: run SDL/game in full screen mode;)
openglblit: experimental option to let SDL use OpenGL for blitting
(SDL has to be configured to use GL for this!)
hwsurface: make SDL use a hardware surface, if omitted use software surface
If you encountered problems with this document or have suggestions on how to
improve it, please e-mail me at marc@darkdust.net.
Have fun !
Marc