Hexen II: Hammer of Thyrion 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. Minimum version required is 3.78. Versions 3.79.1 and newer are recommended. binutils: A GNU collection of binary utilities. Minimum version required is 2.9.5. 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 recommended. YASM, a re-write of NASM, is also supported: Versions 0.5.0, 0.6.0 and 0.6.1 are tested. The assemblers nasm or yasm are required for compiling hexen2 and hexenworld clients for ia32 machines. The makefiles present an option to not use x86 assembly, in that case this tool will not be necessary. GCC : GNU C Compiler. No other compilers (such as LCC, Watcom or MS VC) are tested. Minimum version required is GCC 2.95. GCC versions in the 2.95/2.96 and 3.x series work fine. Gcc 3.2.2 and newer recommended. Gcc-2.91.66 (aka. egcs-1.1.2) still seems to work, but the resulting binaries are not tested much. Even 2.7.2 is reported to compile fine (it doesn't like the -march option, though.) Gcc-4.0 quirks: Gcc 4.0.x series has a problem when unit-at-a-time mode is active, such as with optimizations -O2 and -O3: With H.o.T versions up to 1.4.2-rc1, where the command/script buffer was assigned the address of a static stack buffer in cmd.c, the resulting hexen2 binary segfaulted when a crusader class player fired his tome'd ice mace. The problem used to go away if the binary was compiled with the -fno-unit-at-a-time switch. With gcc 2.x, 3.x, 4.1.x and 4.2.x, however, the problem didn't exist. We now allocate dynamically, either by Hunk_Alloc or by malloc, and there are no problems. If you still run into unexpected segfaults, try re-compiling your binaries with the -fno-unit-at-a-time switch: For that, you can edit the Makefile, or you can specify it on the command line: make NO_UNIT_AT_A_TIME=1 [other options] 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.12, 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: You need to install 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.12.dmg Copy the SDL.framework from that package into your /Library/Frameworks folder. Compiling the software renderer for non-x86: ============================================ As of version 1.4.2, 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 gives prebuilt cross compiler tools. 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 compiled all of the Hammer of Thyrion 1.4.2 windows binaries on linux using a snapshot of MinGW from Aug. 05, 2007. 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 (as of this writing, latest stable is 1.0.11-2004.04.30, which is the version I use), and install it to c:\msys . For assembly, download nasm (0.98.39 is latest) and put nasmw.exe into the C:\MinGW\bin directory. 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. I use MinGW-5.1.3 if I ever compile on Windows. Open a console window, cd into \msys and type "msys sh.exe". You'll 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/ 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. 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/