Building EDuke32 on Linux: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Bioman (talk | contribs)
No edit summary
Bioman (talk | contribs)
Update build options, NEDMALLOC removed since r3086.
Line 74: Line 74:
|BUILD32_ON_64||||0
|BUILD32_ON_64||||0
|-
|-
|NEDMALLOC||Use nedmalloc instead of malloc().||0
|USE_LIBPNG||Compile with libpng (used to make screenshots in the PNG format). This may or may not require libz.||1
|-
|USE_LIBPNG||Compile with libpng (used to make screenshots in the PNG format). This may or may not require libz.||0
|-
|-
|USE_LIBVPX||VP8 video codec used as an alternative to the ANM file format (only works if compiled with the OpenGL support).||1
|USE_LIBVPX||VP8 video codec used as an alternative to the ANM file format (only works if compiled with the OpenGL support).||1
Line 82: Line 80:


{|class="wikitable" width="65%"
{|class="wikitable" width="65%"
|+ <span style="text-decoration: underline">Debugging/Build options</span>
|+ <span style="text-decoration: underline">Debugging and Build options</span>
|-
|-
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
|-
|CLANG||Use the Clang compiler instead of the default GCC.||0
|-
|CPLUSPLUS||Enable C++ building.||0
|-
|-
|RELEASE||No debugging.||1
|RELEASE||No debugging.||1
Line 91: Line 93:
|-
|-
|KRANDDEBUG||Include logging of krand() calls for debugging the demo system.||0
|KRANDDEBUG||Include logging of krand() calls for debugging the demo system.||0
|-
|DISABLEINLINING||Compile inline functions as extern instead of static inline.||0
|-
|-
|EFENCE||Compile with Electric Fence for malloc() debugging.||0
|EFENCE||Compile with Electric Fence for malloc() debugging.||0
|-
|-
|DMALLOC||Compile with dmalloc for malloc() debugging.||0
|DMALLOC||Compile with dmalloc for malloc() debugging.||0
|-
|PROFILER||||0
|-
|MUDFLAP||||0
|}
{|class="wikitable" width="65%"
|+ <span style="text-decoration: underline">Optimization options</span>
|-
!width="15%"|Options!!width="70%"|Description!!width="15%"|Default value
|-
|-
|OPTLEVEL||GCC optimization strategy. Values above 2 can cause crashes.||2
|OPTLEVEL||GCC optimization strategy. Values above 2 can cause crashes.||2
|-
|-
|LTO||Enable link-time optimization, for GCC 4.5 and up.||0
|LTO||Enable link-time optimization, for GCC 4.5 and up.||1
|-
|-
|ARCH||Define options specific to the CPU architecture.||empty (except for i686)
|OPTOPT||Define options specific to the CPU architecture.||empty (except for i686)
|-
|-
|CLANG||Use the Clang compiler instead of the default GCC.||0
|CUSTOMOPT||Custom options or optimizations, parameters defined here, are sent to both compiler and linker.||empty
|-
|PROFILER||||0
|-
|-
|MUDFLAP||||0
|}
|}


== Confirm successful compile ==
== Confirm successful compile ==
These files should now be present in the EDuke32 directory:
These files should now be present in the EDuke32 directory:
* eduke32 (exectuable)
* eduke32, the binary to launch the game.
* mapster32 (executable)
* mapster32, the binary to launch the maps editor.


= Run the game! =
= Run the game! =

Revision as of 16:36, 14 November 2012

EDuke32 Distribution

Download · Source Code · APT repository · Packages
Building from source on: Linux · Windows · macOS


Compiling From Source

Installation Notes

  • You need an actual copy of Duke Nukem 3D. See Installation and configuration.
  • 3D acceleration drivers (optional). NVIDIA has classically had the best Linux drivers.
  • A MIDI player for the soundtrack (optional). By default, the game uses SDL_mixer, which has a light, built-in version of TiMidity++. It's possible to use an external command to play back MIDI music with the EDUKE32_MUSIC_CMD environment variable. In all cases, a set of instrument patches is also required, such as Freepats.

Getting source files

See Acquiring the EDuke32 Source Code.

Prerequisites for the build

EDuke32 requires some development files installed before you can properly build.

  • Basic dev environment (GCC >= 4.3.3, make, etc)
  • NASM (optional)
  • LibGL and LibGLU (optional)
  • LibSDL >= 1.2.10 or 1.3
  • LibSDL Mixer >= 1.2.7
  • LibVorbis >= 1.1.2
  • LibPNG >= 1.2.13 (optional)
    • LibZ (zlib) (optional; required for LibPNG)
  • LibVPX >= 0.9.0 (optional)
  • LibGTK+ >= 2.8.0 (optional)

On Debian / Ubuntu

sudo apt-get install build-essential nasm libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev libsdl-mixer1.2-dev libvorbis-dev libpng12-dev libvpx-dev libgtk2.0-dev freepats

On Fedora 14-17

sudo yum groupinstall "Development Tools"
sudo yum install nasm mesa-libGL-devel mesa-libGLU-devel SDL-devel SDL_mixer-devel libvorbis-devel libpng-devel libvpx-devel gtk2-devel

Freepats is not packaged in Fedora, you must download and install it by yourself. See also the "timidity-patch-freepats" package on others RPM based distros.

Build EDuke32

In a terminal window move to the EDuke32 sources folder and type make.

NOTE: with eduke32_src_20080924 and older GCC versions (< 4.3) remove; -finline-small-functions -fpredictive-commoning options from debug= options in eduke32/Makefile and build/Makefile. Newer source releases do not have this problem.

NOTE2:

If building fails with GCC version 4.4.x, try: make OPTLEVEL=0

If it fails again, you can try with another version of GCC, for example: make CC=gcc-4.3

Build options

It is possible to define some options during the build. Just add them before or after the 'make' command.

Example: make USE_LIBPNG=1

Various options
Options Description Default value
PRETTY_OUTPUT Use colored output. 1
Engine options
Options Description Default value
USE_OPENGL Enable basic OpenGL Polymost renderer. 1
POLYMER Enable modern Polymer renderer for great justice. 1
NOASM Disable the use of the ASM code for the classic renderer. Should be enabled on 32-bit Pentium compatible processors only. 0 (ASM is disabled for x86_64 automatically because the ASM is 32-bit.)
LINKED_GTK Enable compile-time linkage to GTK+. 0
WITHOUT_GTK Do not compile GTK+ code. 0
BUILD32_ON_64 0
USE_LIBPNG Compile with libpng (used to make screenshots in the PNG format). This may or may not require libz. 1
USE_LIBVPX VP8 video codec used as an alternative to the ANM file format (only works if compiled with the OpenGL support). 1
Debugging and Build options
Options Description Default value
CLANG Use the Clang compiler instead of the default GCC. 0
CPLUSPLUS Enable C++ building. 0
RELEASE No debugging. 1
DEBUGANYWAY Include debug symbols even when generating release code.
Additionally, with RELEASE=0, the following arrays are allocated statically: spriteext, spritesmooth, sector, wall, sprite, tsprite, while necessarily disabling the clipshape feature (because it relies on setting sector/wall to different malloc'd block temporarily). Really only useful with CC=clang.
0
KRANDDEBUG Include logging of krand() calls for debugging the demo system. 0
DISABLEINLINING Compile inline functions as extern instead of static inline. 0
EFENCE Compile with Electric Fence for malloc() debugging. 0
DMALLOC Compile with dmalloc for malloc() debugging. 0
PROFILER 0
MUDFLAP 0
Optimization options
Options Description Default value
OPTLEVEL GCC optimization strategy. Values above 2 can cause crashes. 2
LTO Enable link-time optimization, for GCC 4.5 and up. 1
OPTOPT Define options specific to the CPU architecture. empty (except for i686)
CUSTOMOPT Custom options or optimizations, parameters defined here, are sent to both compiler and linker. empty

Confirm successful compile

These files should now be present in the EDuke32 directory:

  • eduke32, the binary to launch the game.
  • mapster32, the binary to launch the maps editor.

Run the game!

You need to have the original Duke Nukem 3D files and the newly created EDuke32 executables in the same place. So, you could create a new folder (example eduke32_linux) and copy the original game files and the newly created EDuke32 executables there.

To run the game open up a terminal window, move to the proper directory and type :

./eduke32
./eduke32 -grp duke3d_hrp.zip polymost_hrp_update-*.zip
  • To use the Polymer HRP you can pass the -grp parameter :
./eduke32 -grp polymer_hrp.zip polymer_upd.zip

Note that polymer_upd.zip may not be available. It is also possbile to add additional packs such as remade music and Z-Pack.

  • Using the autoload folder :

Copy mods or HRP files in the $HOME/.eduke32/autoload folder and it will be automaticaly loaded without additional parameters.

Installing EDuke32 globally

Why

Installing EDuke32 as an application that you could run anywhere brings some useful advantages and is surprisingly easy to do.

EDuke32 will use the directory you are currently in as the directory to work in, as well as ~/.eduke32 (/home/yourname/.eduke32). This means that you could have a directory, copy a Duke Nukem TC (or mod) in there, cd to that directory and run the global EDuke32 binary without having to make even more copies of the same EDuke32 binaries. EDuke32 will adapt to use the GAME/USER.CON files it finds in the CURRENT directory.

How

All you'll have to do to get EDuke32 to run from anywhere is copy the eduke32 and mapster32 binaries to /usr/local/bin. After doing this, copy the duke3d.grp file to /usr/local/share/games/eduke32 or ~/.eduke32 (it's hidden, so try to cd to it or show hidden files). After this you'll be able to run EDuke32 from any directory on your hard disk!

Notes

Lowercase/Uppercase problems

Maps with extra resources Some maps that include extra resources might have trouble finding these new files (for example, an older version of Duke Plus won't be able to find Step#.wav and Grate#.wav sounds). The EDuke32 log will output a "file not found" error every time this happens. To fix this, change the names of these files to match the exact case given in EDuke32's log (for example, GRATE#.wav instead of Grate#.wav).

ART file inconsistency While most standard resources are referred to as UPPERCASE by EDuke32 (for example, GAME.CON), ART files are not as consistent and should be renamed to lowercase if you want to use custom art (tiles014.art instead of TILES014.ART).

Running with HRP Notes

If you want to run Polymer with the HRP you will need to provide the path to polymer_hrp.zip (even if its installed globally): eduke32 -g/path/to/polymer_hrp.zip.

Running EDuke32 with an ATI card is slow for some users. One user has had success with a Radeon 4850 and Fedora 12 with the open source default driver plus the latest Mesa experimental - the game runs smooth and pretty fast.