| 12
 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
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 
 | <HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Steve Hardt">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.09 [en] (WinNT; I) [Netscape]">
   <TITLE>Compiling XEvil 2.X</TITLE>
</HEAD>
<BODY>
<H1>
Compiling XEvil 2.X</H1>
Steve Hardt
<BR>last modified 01/17/2000
<H2>
<HR WIDTH="100%">Windows (NT,95,98)</H2>
Requires Microsoft Visual C++ to compile.  If you have version 5.0,
you can use the workspace file already in the distribution. I've successfully
built XEvil with Visual C++ 4.2.  You'll have to make your own project,
though.  Other compilers should work, but I haven't tried them.
<OL>
<LI>
Download xevilsrc.zip and unzip it somewhere.</LI>
<LI>
At a command prompt, type:</LI>
<OL>subst x: <directory where you put the source></OL>
If the directory name has spaces in it, put quote marks around the directory
name, e.g,
<OL>subst x: "e:\my files\xevil2.0b7"</OL>
<LI>
If you have VC++ 5.0,</LI>
<OL>
<LI>
Run VC++ 5.0</LI>
<LI>
Open the project, "x:\win32\xevil.dsw".</LI>
</OL>
<LI>
If you have VC++ 4.2, or the .dsw file doesn't work for some reason.</LI>
<OL>
<LI>
Make a new project called xevil in the directory "x:\win32".</LI>
<LI>
Add all the cpp files in x:\win32 and x:\cmn.  (Don't add the ones
in x:\x11, they are for UNIX.)</LI>
<LI>
Add the libraries "x:\win32\ddraw.lib", "x:\win32\dsound.lib"</LI>
<LI>
Go to the "Projects | Settings" dialog.  Switch to the "Link" tab. 
Look at the "Object/libraries modules" text field.  Add "winmm.lib
ole32.lib" if they aren't already there.</LI>
</OL>
<LI>
Select the "Tools | Options" menu.</LI>
<OL>
<LI>
Go to the "Directories" tab and look at directories for "Include Files". 
Add "x:\cmn" and "x:\win32" to the list of include directories.</LI>
<LI>
Go to the "Tabs" tab.  Set the toggle to "Insert spaces" and set "Tab
size" and "Indent size" to 2.  This is not strictly necessary, but
helps make the formatting look right.  This also helps if you want
to contribute code back to xevil.com.  We disallow tab characters
in your code, use spaces instead.  See the coding standards documentation
on www.xevil.com for more details.</LI>
</OL>
<LI>
Compile and run.</LI>
</OL>
<H2>
<HR WIDTH="100%">UNIX/X</H2>
Requires:
<UL>
<LI>
C++ compiler.  I've used a variety of compilers, g++, CC, cfront,
etc.</LI>
<UL>
<LI>
Must have the C++ iostream libraries, i.e. iostream.h, strstream.h, etc. 
These will generally be installed along with your C++ compiler.</LI>
</UL>
<LI>
Xlib libraries and include files.  Does not require Motif or any widget
set.</LI>
<UL>
<LI>
Include files are often somewhere like /usr/X11R6/include or /usr/openwin/include.</LI>
<LI>
libX11.a or libX11.so are often somewhere like /usr/lib or /usr/X11/lib</LI>
</UL>
<LI>
The X Pixmap libraries (XPM).  You should be able to get these on
the net.  You may have to compile XPM source to generate libraries
for your machine.</LI>
<UL>
<LI>
xpm.h and libXpm.a (or libXpm.so)</LI>
</UL>
</UL>
I have built and run XEvil on the following UNIX platforms:
<UL>
<LI>
Red Hat Linux</LI>
<LI>
SGI IRIX</LI>
<LI>
Sun, Solaris and SunOS</LI>
<LI>
HPUX</LI>
<LI>
AIX</LI>
<LI>
FreeBSD</LI>
<LI>
Open Caldera Linux</LI>
<LI>
Alpha OSF</LI>
<LI>
Solaris x86</LI>
</UL>
XEvil should build without much trouble on other UNIX system that meet
the above requirements.  I only have certain UNIX machines at my disposal. 
So, one benefit of distributing XEvil source is that other people can build
XEvil on platforms not available to me.
<H3>
Building XEvil on UNIX</H3>
<OL>
<LI>
Unzip xevilsrc.zip to some directory</LI>
<OL>
<LI>
There's a trick here. All the text files are Windows-style, with CRLF for
line breaks (as opposed to just LF which is standard UNIX).  In emacs,
you'll see a bunch of '^M' in the code.  You can use "unzip -a" to
auto-convert text files.  But, this corrupts several of the binary
files.  The binary files are just needed for the Windows build, so
you might not care about them at all.  You can use the csh script
<a href="ftp://ftp.xevil.com/helpers/unzipxevil">unzipxevil</a>
to convert the text files without corrupting the binary files.</LI>
</OL>
<LI>
Look at the value of your HOSTTYPE environment variable and look for a
corresponding entry in config.mk.  Set the HOSTTYPE environment variable
if necessary, make a new entry in config.mk if necessary.  As described
below, set the symbols in config.mk to correspond to your specific machine.</LI>
<LI>
Type "make".  The new executable will be built in the directory given
by OBJ_DIR.</LI>
</OL>
<H3>
Meanings of symbols in config.mk</H3>
<DL>
<DT>
CC</DT>
<DD>
C++ compiler to use.  Probably g++ or CC.</DD>
<DT>
LIBS</DT>
<DD>
 Libraries to use.  Usually "-lXpm -lX11 -lm".  For some
odd reason  I needed to add "-ldnet_stub" for the Alpha I was using
and  "-lsocket -lnsl" for Sun 4 machines on Project Athena.</DD>
<DT>
INCL_DIRS</DT>
<DD>
Where to look for the include files.</DD>
<DT>
LIBS_DIRS</DT>
<DD>
Where to look for libraries.</DD>
<DT>
LINK_FLAGS</DT>
<DD>
Command line options for the link phase of compiling.  I generally
try to build XEvil with static linking.</DD>
<DT>
CFLAGS</DT>
<DD>
Command line options for compiling.  You can use any flags your compiler
understands as well as the XEvil-specific ones given in the next section.</DD>
<DT>
OBJ_DIR</DT>
<DD>
Output directory for building the executable and object files.  You
can build XEvil for several UNIX platforms in the same directory tree by
assigning different values to OBJ_DIR for different platforms.</DD>
<DT>
PCKG_NAME</DT>
<DD>
Used to tar up the executable for distribution.  E.g. if PCKG_NAME="irix",
then create xevil2.0.irix.tar.Z.</DD>
</DL>
<H3>
Additional options for CFLAGS</H3>
<DL>
<DT>
-DUSE_RANDOM</DT>
<DD>
Use the random() function instead of rand() to generate random numbers. 
random() is a better pseudo-number generator than rand().  Use this
unless random() is not available on your machine.</DD>
<DT>
-DRANDOM_NEEDS_PROTOTYPES</DT>
<DD>
If you are using random() and for some reason the prototypes for random()
and srandom() do not appear in <math.h>.</DD>
<DT>
-DUSE_SELECT_H</DT>
<DD>
Use if you need <sys/select.h> for the prototypes for select().</DD>
<DT>
-DSELECT_NEEDS_PROTOTYPES</DT>
<DD>
Use if the prototypes for select() still do not show up after trying -DUSE_SELECT_H.</DD>
<DT>
-DXEVIL_KEYSET=<keyset-name></DT>
<DD>
Different UNIX/X machines have different keyboard layouts.  Use -DXEVIL_KEYSET
to specify at compile-time one of the sets of keyboard controls for XEvil.  
This gives the default value that can be overridden with the -keys command
line option or with the "Set Controls" button at run-time.  Look in
x11/ui.h at the UIkeyset enum for possible values.</DD>
<DT>
-DPROTECTED_IS_PUBLIC</DT>
<DD>
Some compilers have a broken idea of what "protected" means in an inherited
class.  Try this flag if you get an error like "method <some method>
is protected in this context".  It makes (ick) all protected class
members into public members.</DD>
<DT>
-DCLOCKS_PER_SEC=<clocks-per-sec></DT>
<DD>
In some cases, the symbol CLOCKS_PER_SEC is not defined anywhere and you
must manually define it.  This is the conversion from the unit of
time given by the clock() function to seconds.  If you don't know
what the value is for your system, try -DCLOCKS_PER_SEC=1000000L 
This is the most common value.</DD>
<DT>
-DMATH_H_IS_CC</DT>
<DD>
Use this if you get strange errors from the include file math.h. 
Usually math.h is written in C, so the XEvil source includes it as a C
include file.  Sometimes, however, math.h is in C++, so it should
be included as a C++ include file.</DD>
<DT>
-DNO_PRAGMAS</DT>
<DD>
g++ uses "#pragma interface" and "#pragma implementation" compiler directives
to do some code optimization.  In theory, other C/C++ compilers should
ignore unknown pragmas.  But, some compilers whine about it, so use
-DNO_PRAGMAS to avoid these warning messages.</DD>
<DT>
-DUSE_UINT_NET_LENGTH</DT>
<DT>
-DUSE_ULONG_NET_LENGTH</DT>
<DD>
Use "unsigned int" or "unsigned long" for the type of the last argument
to accept() and recvfrom().  Default is "int".</DD>
<DT>
-DNO_SETPRECISION</DT>
<DD>
Only for setting the number of significant digits in the statistics printed
when XEvil exits.  Would you believe that some HP systems actually
<I>crash</I> if you set the number of significant digits in an output stream.</DD>
<DT>
-DIO_COOKIE_HACK</DT>
<DD>
Some really weird linux system needs a type defined for _IO_cookie_io_functions_t. 
Don't ask me, I just work here.</DD>
</DL>
<HR WIDTH="100%">
<P>Steve Hardt
<BR><A HREF="mailto:satan@xevil.com">satan@xevil.com</A>
<BR><A HREF="http://www.xevil.com">http://www.xevil.com</A>
</BODY>
</HTML>
 |