mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-27 16:43:01 +00:00
108 lines
4.7 KiB
Plaintext
108 lines
4.7 KiB
Plaintext
There are two ways to build this code;
|
|
|
|
(1) Manually
|
|
|
|
(2) Using all-singing all-dancing (all-confusing) autotools, ie. autoconf,
|
|
automake, and their little friends (autoheader, etc).
|
|
|
|
=================
|
|
Building Manually
|
|
=================
|
|
|
|
There is a basic "Makefile" in this directory that gets moved out of the way and
|
|
ignored when building with autoconf et al. This Makefile is suitable for
|
|
building tunala on Linux using gcc. Any other platform probably requires some
|
|
tweaking. Here are the various bits you might need to do if you want to build
|
|
this way and the default Makefile isn't sufficient;
|
|
|
|
* Compiler: Edit the "CC" definition in Makefile
|
|
|
|
* Headers, features: tunala.h controls what happens in the non-autoconf world.
|
|
It, by default, assumes the system has *everything* (except autoconf's
|
|
"config.h") so if a target system is missing something it must define the
|
|
appropriate "NO_***" symbols in CFLAGS. These include;
|
|
|
|
- NO_HAVE_UNISTD_H, NO_HAVE_FCNTL_H, NO_HAVE_LIMITS_H
|
|
Indicates the compiling system doesn't have (or need) these header files.
|
|
- NO_HAVE_STRSTR, NO_HAVE_STRTOUL
|
|
Indicates the compiling system doesn't have these functions. Replacements
|
|
are compiled and used in breakage.c
|
|
- NO_HAVE_SELECT, NO_HAVE_SOCKET
|
|
Pointless symbols - these indicate select() and/or socket() are missing in
|
|
which case the program won't compile anyway.
|
|
|
|
If you want to specify any of these, add them with "-D" prefixed to each in
|
|
the CFLAGS definition in Makefile.
|
|
|
|
* Compilation flags: edit DEBUG_FLAGS and/or CFLAGS directly to control the
|
|
flags passed to the compiler. This can also be used to change the degree of
|
|
optimisation.
|
|
|
|
* Linker flags: some systems (eg. Solaris) require extra linker flags such as;
|
|
-ldl, -lsocket, -lnsl, etc. If unsure, bring up the man page for whichever
|
|
function is "undefined" when the linker fails - that usually indicates what
|
|
you need to add. Make changes to the LINK_FLAGS symbol.
|
|
|
|
* Linker command: if a different linker syntax or even a different program is
|
|
required to link, edit the linker line directly in the "tunala:" target
|
|
definition - it currently assumes the "CC" (compiler) program is used to link.
|
|
|
|
======================
|
|
Building Automagically
|
|
======================
|
|
|
|
Automagic building is handled courtesy of autoconf, automake, etc. There are in
|
|
fact two steps required to build, and only the first has to be done on a system
|
|
with these tools installed (and if I was prepared to bloat out the CVS
|
|
repository, I could store these extra files, but I'm not).
|
|
|
|
First step: "autogunk.sh"
|
|
-------------------------
|
|
|
|
The "./autogunk.sh" script will call all the necessary autotool commands to
|
|
create missing files and run automake and autoconf. The result is that a
|
|
"./configure" script should be generated and a "Makefile.in" generated from the
|
|
supplied "Makefile.am". NB: This script also moves the "manual" Makefile (see
|
|
above) out of the way and calls it "Makefile.plain" - the "ungunk" script
|
|
reverses this to leave the directory it was previously.
|
|
|
|
Once "ungunk" has been run, the resulting directory should be able to build on
|
|
other systems without autoconf, automake, or libtool. Which is what the second
|
|
step describes;
|
|
|
|
Second step: "./configure"
|
|
--------------------------
|
|
|
|
The second step is to run the generated "./configure" script to create a
|
|
config.h header for your system and to generate a "Makefile" (generated from
|
|
"Makefile.in") tweaked to compile on your system. This is the standard sort of
|
|
thing you see in GNU packages, for example, and the standard tricks also work.
|
|
Eg. to override "configure"'s choice of compiler, set the CC environment
|
|
variable prior to running configure, eg.
|
|
|
|
CC=gcc ./configure
|
|
|
|
would cause "gcc" to be used even if there is an otherwise preferable (to
|
|
autoconf) native compiler on your system.
|
|
|
|
After this run "make" and it should build the "tunala" executable.
|
|
|
|
Notes
|
|
-----
|
|
|
|
- Some versions of autoconf (or automake?) generate a Makefile syntax that gives
|
|
trouble to some "make" programs on some systems (eg. OpenBSD). If this
|
|
happens, either build 'Manually' (see above) or use "gmake" instead of "make".
|
|
I don't like this either but like even less the idea of sifting into all the
|
|
script magic crud that's involved.
|
|
|
|
- On a solaris system I tried, the "configure" script specified some broken
|
|
compiler flags in the resulting Makefile that don't even get echoed to
|
|
stdout/err when the error happens (evil!). If this happens, go into the
|
|
generated Makefile, find the two affected targets ("%.o:" and "%.lo"), and
|
|
remove the offending hidden option in the $(COMPILE) line all the sludge after
|
|
the two first lines of script (ie. after the "echo" and the "COMPILE" lines).
|
|
NB: This will probably only function if "--disable-shared" was used, otherwise
|
|
who knows what would result ...
|
|
|