Difference between revisions of "Compiling using GCC"

From OdaWiki
m (Compiling using a Makefile moved to Compiling using GCC)
Line 1: Line 1:
Note: If you intend to build the client, you'll need the current version of SDL and SDL_mixer development libraries installed.
+
GCC is the official GNU C Compiler which is bundled with many Unix and Linux distributions.  This article assumes that you are planning to build Odamex at the command line.  If you are using an IDE that uses GCC as its compiler, please refer to the IDE's documentation in this wiki on how to compile Odamex.
  
== GNU/Linux ==
 
  
=== Get the source ===
+
== Compiling in a nutshell ==
You can either download a stable source package, or risk using the bleeding edge svn code.
+
Compiling using GCC is simple.  Simply go to the root directory of the branch that you want to compile and type:
  
==== Download ====
+
<pre>make</pre>
Download the [http://odamex.net/ latest source]
+
Untar the archive somewhere:
+
  
<pre>
+
This will compile the client, the server and the master, one after another. If you want to compile them one at a time, simply use one of the following commands:
tar -xjf odamex_build.tar.bz2
+
cd odamex_build
+
</pre>
+
  
==== SVN ====
+
<pre>make client
Get a dev build using (must have [[svn|subversion]] installed!):
+
make server
 +
make master</pre>
  
<pre>
+
That's it!
svn co svn://odamex.net
+
</pre>
+
 
+
=== Build ===
+
 
+
In the source directory, use the make command:
+
 
+
<pre>
+
make
+
</pre>
+
 
+
Binaries should appear in the bin dir after a successful compile: odamex, odasrv, odamaster
+
 
+
You can run "make server" or "make client" to only build the module you want:
+
 
+
<pre>
+
make server
+
make client
+
make launcher
+
</pre>
+
  
 
== FreeBSD ==
 
== FreeBSD ==
  
To compile Odamex on FreeBSD, you must have the following ports installed, above and beyond the usual suspects:
+
FreeBSD has their own version of make, which is not compatable with Odamex.  In order to compile under FreeBSD, you must install gmake from the ports collection:
 
*'''GNU Make''':  [[http://cvsweb.freebsd.org/ports/devel/gmake gmake-3.80_2]]
 
*'''GNU Make''':  [[http://cvsweb.freebsd.org/ports/devel/gmake gmake-3.80_2]]
*'''SDL 1.2.9''':  [[http://cvsweb.freebsd.org/ports/devel/sdl12 sdl-1.2.9_2,2]]
+
Then, substitue '''gmake''' for '''make''', respectively.
*'''SDL_Mixer 1.2.6''':  [[http://cvsweb.freebsd.org/ports/audio/sdl_mixer sdl_mixer-1.2.6_2]]
+
 
+
In addition, if you want to compile the absolute latest cutting edge version of Odamex, you will also need:
+
*'''Subversion''':  [[http://cvsweb.freebsd.org/ports/devel/subversion subversion-1.3.0_4 ]]
+
 
+
Once those ports are installed, you can simply untar or grab the latest source through subversion into its own directory, switch to the trunk subdirectory, and simply type '''gmake'''.  If you only want to compile the client or only compile the server, simply type '''gmake client''' or '''gmake server''' respectively.
+
 
+
== Windows ==
+
 
+
It is possible to compile Odamex with a makefile under Windows
+
  
 
== Cygwin ==
 
== Cygwin ==
 
+
Odamex does not compile natively under Cygwin at this timeHowever, you can still use Cygwin to compile Odamex as a MinGW programPlease see the appropraite article for details.
[[Image:Cygwin.png|thumb|Screenshot of Odamex in Cygwin]]
+
 
+
===Step 1: Installing Cygwin===
+
 
+
Download and run the setup.exe file avalable from [http://www.cygwin.com/ here].  Make sure that the make, gcc and subversion (if you are going to download the source via svn) packages are selected to be installed.
+
 
+
===Step 2: Required Libraries ===
+
 
+
For ODAMEX to successfully compile, you must obtain some libraries for it, which are:
+
 
+
<b>SDL Development Libraries</b>
+
 
+
You can get the latest version of SDL [http://www.libsdl.org/download-1.2.php  here].  Extract the archive where you think it's approprite.  If you don't know where to put it, your home directory should work nicely.
+
 
+
<b>SDL_mixer Development Libraries</b>
+
 
+
You can get the latest version of SDL_mixer [http://www.libsdl.org/projects/SDL_mixer/ here].  Extract the archive where you think it's approprite.  If you don't know where to put it, your home directory should work nicely.
+
 
+
===Step 3: Patch SDL_config_minimal.h===
+
 
+
Unfortunately, SDL does not always play ball with cygwin's headers. The biggest offender has been a conflict between <SDL_config_minimal.h> and <stdint.h>. You may need to edit the following two lines in <SDL_config_minimal.h>:
+
 
+
* typedef signed int int32_t;
+
* typedef unsigned int uint32_t;
+
 
+
To read:
+
 
+
* typedef signed long int int32_t;
+
* typedef unsigned long int uint32_t;
+
 
+
===Step 4: Getting the source code for ODAMEX===
+
 
+
The source code can be obtained through the [http://odamex.net website] or from the [[SVN]] repository using cygwin's svn client.
+
 
+
===Step 5: Modifying your makefile===
+
 
+
There is one extra step you have to do before compiling.  You must edit the makefile in the root of the branch you want to compile.  The two things you must change are SDL_LOCATION and SDL_MIXER_LOCATION, and you have to modify these two lines to point to the directories where you extracted your SDL and SDL_Mixer development libraries, respectively.
+
 
+
===Step 5: Compiling the ODAMEX source code===
+
 
+
Finally, you can '''make''', and the client and server and master server should compile sucessfully.
+
 
+
===Step 6: Obtaining the runtime libraries===
+
 
+
Once its all built (and no errors have occurred), you should find some binary files located in the '''trunk''' directoryThe only thing that you're likely missing is the SDL and SDL_Mixer runtime libraries.  Download the Win32 library from [http://www.libsdl.org/download-1.2.php here] and [http://www.libsdl.org/projects/SDL_mixer/ here].
+

Revision as of 16:38, 10 November 2006

GCC is the official GNU C Compiler which is bundled with many Unix and Linux distributions. This article assumes that you are planning to build Odamex at the command line. If you are using an IDE that uses GCC as its compiler, please refer to the IDE's documentation in this wiki on how to compile Odamex.


Compiling in a nutshell

Compiling using GCC is simple. Simply go to the root directory of the branch that you want to compile and type:

make

This will compile the client, the server and the master, one after another. If you want to compile them one at a time, simply use one of the following commands:

make client
make server
make master

That's it!

FreeBSD

FreeBSD has their own version of make, which is not compatable with Odamex. In order to compile under FreeBSD, you must install gmake from the ports collection:

Then, substitue gmake for make, respectively.

Cygwin

Odamex does not compile natively under Cygwin at this time. However, you can still use Cygwin to compile Odamex as a MinGW program. Please see the appropraite article for details.