Compiling

From BZFlagWiki
Jump to: navigation, search

Overview[edit]

Compiling BZFlag is the act of building executable applications for a target system using the raw source code..

Obtaining sources[edit]

In order to compile a user must have his or her own copy of the Source Code. The code can be obtained from a source archive from the download page, or from Git.

README files[edit]

Users should always read the README files for the appropriate operating system. These files are located in the root directory of the source code tree.

Compilers[edit]

BZFlag is capable of being built on a number of compilers. The compiler used will depend in some way on the operating system of the computer doing the build.

  • Windows computers can use the Visual C++ compiler, or the MinGW compiler (based on GCC). Windows is the most popular client OS and nearly all clients are built with the Visual C++ compiler, including the official binaries.
  • Macintosh OS X computers use the Xcode compiler (or optionally gcc, see notes). OS X is the second most popular client OS, official builds are built with Xcode, not GCC.
  • Linux and BSD computers use the GCC compiler. Linux is the third most common client OS and packages for distributions are built using GCC.

Visual C++[edit]

The most common way to build on windows to to use the Visual C++ 2010 compiler (Both Express and Retail versions are supported). The current free Express version of Visual C++ can be found at http://www.microsoft.com/express/vc/

GCC[edit]

If the required dependencies are installed, the user must then run the following commands from at root level of the source tree

 ./autogen.sh
 ./configure
 make
 make install

Please note that depending on permissions levels the make install command may need to be run as an administrator or root. On Macintosh OS X, do not run make install when building with GCC. Run the program from the source directory or install it manually as desired instead.

Xcode[edit]

The Xcode system uses the Xcode/BZFlag.xcodeproj project. Building is fairly straightforward. Follow the instructions in the README.MacOSX file.

Dependencies[edit]

In order to compile BZFlag, some third party libraries may be required depending on the operating system being built for. The readme file for each OS will contain the current dependencies for each OS and should be consulted before attempting any build.

The following is a general dependency list for version 2.4.

Windows (Visual Studio)[edit]

The only third party dependency required to build the client is the DirectX SDK that is available from Microsoft. A download is available at http://www.microsoft.com/en-us/download/details.aspx?id=6812.

If a user wishes to build a full set of windows installers, they will need to install the NSIS installer system, available from http://nsis.sourceforge.net.

All other dependencies are included.

Linux (GCC)[edit]

Required Libraries[edit]

  • SDL development libraries (1.2.10 or greater)
  • SDL-sound development libraries (1.2.10 or greater)
  • libtool
  • automake
  • autoconf
  • g++
  • mesa development libraries (gl, and glu)
  • mesa development libraries

Optional Libraries[edit]

These libraries are included with the source tree but users may have better results using ones included with a Linux distribution.

  • curl development libraries
  • c-ares development libraries
  • glew development libraries
  • zlib development libraries

Macintosh OS X (Xcode or GCC)[edit]

Required Libraries[edit]

  • SDL framework 1.2 (1.3 may not work on all versions of OSX)

Other build systems[edit]

Other build systems may be supported in the various readme files (minGW, IRIX, SOLARIS,etc..) see the Compiling/Solaris_Notes page for more info.