Building EDuke32 on Linux: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
Bioman (talk | contribs)
Use the MediaWiki syntax instead of HTML for tables
Line 25: Line 25:
* LibGTK+ >= 2.8.0 (optional)
* LibGTK+ >= 2.8.0 (optional)


<u>On Debian / Ubuntu</u>
<span style="text-decoration: underline">On Debian / Ubuntu</span>
<pre>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 timidity freepats</pre>
<pre>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 timidity freepats</pre>


<u>On Fedora 14</u>
<span style="text-decoration: underline">On Fedora 14</span>
<pre>sudo yum groupinstall "Development Tools"</pre>
<pre>sudo yum groupinstall "Development Tools"</pre>
<pre>sudo yum install SDL-devel SDL_mixer SDL_mixer-devel SDL_image-devel nasm libstdc++-devel libstdc++-static libpng-devel</pre>
<pre>sudo yum install SDL-devel SDL_mixer SDL_mixer-devel SDL_image-devel nasm libstdc++-devel libstdc++-static libpng-devel</pre>
Line 48: Line 48:
Example: <code>make USE_LIBPNG=1</code>
Example: <code>make USE_LIBPNG=1</code>


<u>Various options</u>
{|class="wikitable" width="45%"
|+ <span style="text-decoration: underline">Various options</span>
|-
!Options!!Description!!Default value
|-
|PRETTY_OUTPUT||use colored output||1
|}


<table class=wikitable width=45%>
{|class="wikitable" width="45%"
<tr>
|+ <span style="text-decoration: underline">Engine options</span>
<th>Options</th>
|-
<th>Description</th>
!Options!!Description!!Default value
<th>Default value</th>
|-
</tr>
|USE_OPENGL||enables basic OpenGL Polymost renderer||1
|-
|POLYMER||enables fancy Polymer renderer||1
|-
|NOASM||disables the use of inline assembly pragmas||0
|-
|LINKED_GTK||enables compile-time linkage to GTK+||0
|-
|WITHOUT_GTK||does not compile GTK+ code||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)||0
|-
|USE_LIBVPX||VP8 video codec used as an alternative to the ANM file format (only works if compiled with OpenGL support)||0
|}


<tr>
{|class="wikitable" width="45%"
<td>PRETTY_OUTPUT</td>
|+ <span style="text-decoration: underline">Debugging/Build options</span>
<td>use colored output</td>
|-
<td>1</td>
!Options!!Description!!Default value
</tr>
|-
</table>
|RELEASE||no debugging||1
 
|-
<u>Engine options</u>
|DEBUGANYWAY||include debug symbols even when generating release code||0
 
|-
<table class=wikitable width=45%>
|KRANDDEBUG||include logging of krand() calls for debugging the demo system||0
<tr>
|-
<th>Options</th>
|EFENCE||compile with Electric Fence for malloc() debugging||0
<th>Description</th>
|-
<th>Default value</th>
|OPTLEVEL||GCC optimization strategy||2
</tr>
|-
 
|PROFILER||||0
<tr>
|-
<td>USE_OPENGL</td>
|MUDFLAP||||0
<td>enables basic OpenGL Polymost renderer</td>
|-
<td>1</td>
|LTO||enable link-time optimization, for GCC 4.5 and up||0
</tr>
|}
 
<tr>
<td>POLYMER</td>
<td>enables fancy Polymer renderer</td>
<td>1</td>
</tr>
 
<tr>
<td>NOASM</td>
<td>disables the use of inline assembly pragmas</td>
<td>0</td>
</tr>
 
<tr>
<td>LINKED_GTK</td>
<td>enables compile-time linkage to GTK+</td>
<td>0</td>
</tr>
 
<tr>
<td>WITHOUT_GTK</td>
<td>does not compile GTK+ code</td>
<td>0</td>
</tr>
 
<tr>
<td>BUILD32_ON_64</td>
<td></td>
<td>0</td>
</tr>
 
<tr>
<td>NEDMALLOC</td>
<td></td>
<td>0</td>
</tr>
 
<tr>
<td>USE_LIBPNG</td>
<td>compile with libpng (used to make screenshots in the PNG format)</td>
<td>0</td>
</tr>
 
<tr>
<td>USE_LIBVPX</td>
<td>VP8 video codec used as an alternative to the ANM file format (only works if compiled with OpenGL support)</td>
<td>0</td>
</tr>
</table>
 
<u>Debugging/Build options</u>
 
<table class=wikitable width=45%>
<tr>
<th>Options</th>
<th>Description</th>
<th>Default value</th>
</tr>
 
<tr>
<td>RELEASE</td>
<td>no debugging</td>
<td>1</td>
</tr>
 
<tr>
<td>DEBUGANYWAY</td>
<td>include debug symbols even when generating release code</td>
<td>0</td>
</tr>
 
<tr>
<td>KRANDDEBUG</td>
<td>include logging of krand() calls for debugging the demo system</td>
<td>0</td>
</tr>
 
<tr>
<td>EFENCE</td>
<td>compile with Electric Fence for malloc() debugging</td>
<td>0</td>
</tr>
 
<tr>
<td>OPTLEVEL</td>
<td>GCC optimization strategy</td>
<td>2</td>
</tr>
 
<tr>
<td>PROFILER</td>
<td></td>
<td>0</td>
</tr>
 
<tr>
<td>MUDFLAP</td>
<td></td>
<td>0</td>
</tr>
 
<tr>
<td>LTO</td>
<td>enable link-time optimization, for GCC 4.5 and up</td>
<td>0</td>
</tr>
</table>


== Confirm successful compile ==
== Confirm successful compile ==

Revision as of 05:47, 15 September 2011

Compiling From Source

Installation Notes

  • You need an actual copy of Duke Nukem 3D. The shareware version can be found here
  • Proper 3D acceleration drivers. NVIDIA has classically had the best Linux drivers.
  • Proper MIDI install. The EDuke32 will appear to "randomly" crash without one. Use timidity for an easy software midi solution.

Getting source files

  • Current version (You need to install the subversion program) :
svn co https://eduke32.svn.sourceforge.net/svnroot/eduke32/polymer/eduke32
  • Source tarballs (Lite subversion snapshots, it does not include metadata, Apple compiled libraries, third-party jaudiolib and Photoshop files).
  • Old and Older versions.

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)
  • LibStdc++
  • LibGL and LibGLU (optional)
  • LibSDL >= 1.2.10 or 1.3
  • LibSDL Mixer > 1.2.6
  • LibVorbis >= 1.1.2
  • LibPNG >= 1.2.13 (optional)
  • 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 timidity freepats

On Fedora 14

sudo yum groupinstall "Development Tools"
sudo yum install SDL-devel SDL_mixer SDL_mixer-devel SDL_image-devel nasm libstdc++-devel libstdc++-static libpng-devel

Build the 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 enables basic OpenGL Polymost renderer 1
POLYMER enables fancy Polymer renderer 1
NOASM disables the use of inline assembly pragmas 0
LINKED_GTK enables compile-time linkage to GTK+ 0
WITHOUT_GTK does not compile GTK+ code 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) 0
USE_LIBVPX VP8 video codec used as an alternative to the ANM file format (only works if compiled with OpenGL support) 0
Debugging/Build options
Options Description Default value
RELEASE no debugging 1
DEBUGANYWAY include debug symbols even when generating release code 0
KRANDDEBUG include logging of krand() calls for debugging the demo system 0
EFENCE compile with Electric Fence for malloc() debugging 0
OPTLEVEL GCC optimization strategy 2
PROFILER 0
MUDFLAP 0
LTO enable link-time optimization, for GCC 4.5 and up 0

Confirm successful compile

These files should now be present in the EDuke32 directory.

  • mapster32.sym (this file is not built in newer versions)
  • mapster32 (executable)
  • eduke32.sym (this file is not built in newer versions)
  • eduke32 (exectuable)

Use the game files

You need to have the original Duke Nukem 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.

Run the game!

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

./eduke32
./eduke32 -g duke3d_hrp.zip hrp_update.zip maphacks.zip eduke32_mus.zip
  • To use the Polymer HRP you need to pass the -g parameter :
./eduke32 -g polymer_hrp.zip polymer_upd.zip polymer_mhk.zip eduke32_mus.zip
  • 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.