Hexen II: Hammer of Thyrion
Version 1.4.3

Instructions for Compiling:
===========================

To compile the your own binaries, you need a unix build environment. The
makefiles also present several build options, please read them. Makefiles
rely on some scripts residing in the scripts directory. You may be able
to modify them to meet your needs, if necessary, but the defaults should
work just fine.

By editing the makefiles, you can change some compile time options. Other
than the makefiles, we have gathered most, if not all, of our compile time
options in the header file named "h2option.h".  You can edit it, as well,
but be careful.

Here is the recommended software for building:


Tools needed:
========================================

Make	:	The GNU make utility.
		Versions 3.79.1 and newer are recommended.  The minimum
		version required is 3.78.

binutils:	A GNU collection of binary utilities.
		Tested with versions 2.11.9x and newer. Recent versions
		are recommended.

NASM	:	Netwide Assembler. An x86 assembler.
		Minimum version required is 0.98.  Versions 0.98.38 and
		0.98.39, or 2.02 from the new 2.x series are recommended.
		YASM, a re-write of NASM, is also supported:  Versions
		0.5.0, 0.6.0-0.6.2 are tested.

		The assemblers nasm or yasm are required for compiling
		hexen2 and hexenworld clients for 32 bit x86 machines.
		The makefiles present an option to not use x86 assembly,
		in that case nasm of yasm will not be necessary.

GCC	:	GNU C Compiler.  NO other compilers (such as MS VisualC,
		LCC, or Watcom) are tested.

		Minimum version required is GCC 2.95.  GCC versions in
		the 2.95/2.96, 3.x and 4.x series up to 4.3.0 are tested
		and work fine.  Versions 3.2.2, 3.3.6, 3.4.6, or newer
		are recommended.

		Of the old versions, gcc-2.91.66 (aka. egcs-1.1.2) still
		seems to work.  Even 2.7.2 is reported to compile fine (it
		doesn't like the -march option, though.)


Libraries needed for various platforms:
========================================

General Unix requirements:
--------------------------

SDL	:	Simple DirectMedia Layer libraries.
		Required for compiling hexen2 and hexenworld clients
		on unix platforms. Minimum version required is 1.2.4.
		As of this writing, the latest version is 1.2.13, which
		is recommended.

SDL_mixer:	SDL mixer library.
		Required for midi playback support on unix platforms.
		Should be compiled with timidity+ support. The minimum
		version required is 1.2.4. As of this writing, the
		latest version is 1.2.8, which is recommended.
		The makefiles present an option for disabling midi
		support, in that case this library will not be
		necessary.

Linux requirements	:
-------------------------

GLIBC	:	C libraries.  Any glibc >= 2.1 should be fine. Not tested
		with anything older.

ALSA	:	Advanced Linux Sound Architecture libraries.
		Necessary, if you want to support ALSA sound on Linux.
		Minimum version required is 1.0.1. Version 0.9.8 should
		theoretically work, but not tested. 1.0.7 or newer are
		recommended at runtime.  The makefiles present an option
		for disabling ALSA sound support, in that case this
		library will not be necessary.

Windows requirements	:
-------------------------

MSVCRT.DLL:	The windows exe files depend on msvcrt.dll, the microsoft
		C runtime library. Any sane windows installation already
		has it unless it is an ancient windows version.  In case
		you need it, here is a download link from the MS site:
		http://support.microsoft.com/kb/259403
		or:
		http://support.microsoft.com/default.aspx?scid=kb;en-us;259403

Mac OS X requirements	:
-------------------------

Xcode, SDKs:	Install the free Xcode suite from developer.apple.com :  It
		comes with all required things except SDL.  Our own project
		files are for the latest xcode.  SDL framework for Mac OS X:
		http://www.libsdl.org/release/SDL-1.2.13.dmg
		Copy the SDL.framework from that package into your
		/Library/Frameworks  folder.

Compiling the software renderer for non-x86:
============================================

The software renderer clients can be compiled for non-x86 cpus: not as fast
as the intel code, yet, but it works very well in general.

On the other hand, it's still possible to compile them as 32 bit binaries
for intel compatible cpus, such as amd64: for that, you must add -m32 to
the cpu and linker flags (see the COMPILE_32BITS option in the Makefiles)
and link against 32 bit versions of any necessary libraries.


Compiling for Windows:
========================================

a. On Linux, using MinGW cross compiler:
----------------------------------------
See the MinGW FAQ on the MinGW homepage, and read the icculus.org cross
compiling tips (link down below). The icculus.org page provides prebuilt
cross compiler tools: Either download and install them, or prepare your
own cross compiler.  You can then run the "build_cross_win32.sh" scripts
residing in all directories. Read the scripts and edit them as necessary.

I usually compile all of the Hammer of Thyrion windows binaries on linux
using a snapshot of MinGW from Mar. 24, 2008. Both x86/glibc-2.3 binaries
and the sources for this snapshot can be found on our downloads page under
the support files section.

b. On Windows, using win32-native MinGW compiler:
-------------------------------------------------
Download a prebuilt MinGW installer and install it to C:\MinGW .  Then
download MSys and install it to c:\msys , 1.0.11-2004.04.30 is the version
I use.  As the assembler, download nasm version 0.98.39, put nasmw.exe into
the C:\MinGW\bin directory and rename it to "nasm.exe".  Adding the mingw
directory to your PATH may be a good idea, too.  MinGW-3.1.0 comes with
gcc-3.2.3.  MinGW-5.1.3, on the other hand, comes with gcc-3.4.5 and is
recommended.

Open a console window, cd into \msys and type "msys sh.exe". You will be
in a unixish sh environment. The rest is just like doing things in linux:
cd into your fake "home directory", extract the HoT tarball, then change
into into each subdirectory you want to build and normally use the make
commands to compile.

Note that "make" may be named "mingw32-make". In that case, you may want
to try "mingw32-make" if "make" command itself fails to run. Remember to
do a make clean between each different build.


Compiling for Mac OS X:
========================================

The Xcode project file is in source tarball: look at the hexen2/MacOSX
folder. Currently, project files are adjusted to generate hexen2 and
glhexen2 (universal) binaries for all Mac OS X versions, ppc part tuned
for older g3's for better performance for these slower cpu's.

Double click on hexen2.xcodeproj. At the Xcode main window, on the left
side look at "Targets" in the Groups & Files. Expand "Targets". You'll
see both glhexen2 and hexen2 targets and one of them selected. You can
press the hammer icon at the toolbar and start building, or you can
select "Project/Set Active Target/<glhexen2 or hexen2> to change the
build target to glhexen2 or hexen2.

For building for older Mac OS X sdk's (probably you don't need to),
double click on the little icon at the left of "Architectures" and
select only "ppc"; then double click on the "SDK Path" value and
delete "/Developer/SDKs/MacOSX10.4u.sdk" from there, build as usual.


Compiling for DOS:
========================================

You need DJGPP. At present, the beta1 version of djgpp 2.04 is required,
because 2.03 and earlier versions doesn't provide a stdint.h and / or
inttypes.h header, besides, they don't have a vsnprintf implementation.
Compilers other than djgpp most probably won't work at all.  I use
gcc-3.3.6 and binutils-2.15 and compile the binaries on linux with a
cross compilation toolchain using 2.04 runtime library from the CVS
snapshot from Mar. 24, 2008:  see the tiny script build_cross_dos.sh
to have an idea of how I do it.  You can download both the sources and
the x86/glibc-2.3 binaries of my toolchain from our downloads page under
the support files section.
Compilation on DOS is never tested and is not supported.  Compiling on
windows in a command console, however, ~should~ be possible:  remember
adding DOSBUILD=1 to your environment.
CWSDPMI.EXE is needed at runtime: the "0.90+ r1" version from 1996 which
was packaged with quake still seems to work but isn't recommended: use
the "0.90+ r5" or a newer version.


Links:
------
SDL homepage		:	http://www.libsdl.org/
SDL_mixer homepage	:	http://www.libsdl.org/projects/SDL_mixer/
ALSA homepage		:	http://www.alsa-project.org/
GCC homepage		:	http://gcc.gnu.org/
NASM homepage		:	http://nasm.sourceforge.net/
YASM homepage		:	http://www.tortall.net/projects/yasm/
MinGW/MSYS homepage	:	http://www.mingw.org/
				http://mingw.sourceforge.net/
MinGW cross compiling tips:	http://www.libsdl.org/extras/win32/cross/
DJGPP homepage		:	http://www.delorie.com/djgpp/

