Linux Compile Guide
In Short
Note about library versions:
The 3.1 branch uses Qt4 and SDL 1.2: this is the release branch
Install all the libraries you might need:
sudo apt-get install --yes build-essential automake xz-utils g++ libqt4-dev libsdl-dev libtheora-dev libfribidi-dev libopenal-dev libvorbis-dev libxrandr-dev libfontconfig-dev wget cmake wkhtmltopdf libglew-dev libphysfs-dev
These libs are for 3.2 versions
sudo apt-get install --yes build-essential automake libpng12-dev libsdl2-dev libopenal-dev libphysfs-dev libvorbis-dev libtheora-dev libglc-dev libglew1.5-dev libxrandr-dev zip unzip libqt5opengl5-dev libssl-dev qtscript5-dev qt5-default libharfbuzz-dev
These libs are for 3.2.3 version
sudo apt-get install --yes g++ build-essential autoconf libpng-dev libsdl2-dev libopenal-dev libphysfs-dev libvorbis-dev libtheora-dev libglew-dev zip unzip libcrypto++-dev libssl-dev libharfbuzz-dev libcryptsetup-dev libfribidi-dev libfreetype6-dev libfontconfig1-dev
(please, add if something is missing)
- Extract the downloaded file and enter the main folder (see below for options).
- Compile:
| For the 3.1 release use | ./autogen.sh && ./configure --disable-debug CFLAGS="-O2 -gstabs -g -g3 -pipe" CXXFLAGS="-O2 -gstabs -g -g3 -pipe" && make | This will build without Debug output |
./autogen.sh && ./configure && make
- Launch the game:
./src/warzone2100
If you encounter any problem please first read this page entirely.
Preface
This guide assumes some familiarity with Linux/Unix systems and their command line, for example how to run commands that install packages as root. The author uses a Debian system, so users of other distributions might have to adapt some commands, like for the package manager. It was completely rewritten in 2010/08, the old version can be seen at Compile Guide Linux.
Introduction
Warzone 2100 uses the common autotools build system, so the basic procedure is just "./configure && make" from the source tree, then you can run the game with "src/warzone2100". Note that we strongly discourage running "make install" unless you gave a custom prefix to ./configure (not /usr/ or /usr/local/, e.g. "./configure --prefix=/home/user/warzone"), since the game can be confused by old data when you install a newer version and haven't removed all old files first. In this page, two different ways of compiling the game will be presented.
Generic Build Instructions
Preparation
You need to get the source for Warzone, either from a release tarball or Git. You also need some build tools, and libraries with their header files (Linux distributions usually put those in separate packages with the suffix -dev or -devel, so for a library foo you need both libfoo and libfoo-dev(el) installed).
Getting The Dependencies
As mentioned, Warzone needs the various autotools to compile, as well as Flex, Bison, and various libraries. On a current Debian/Ubuntu system, you can install the needed packages with "apt-get build-dep warzone2100". That should install all needed packages, to do that manually, run apt-get install build-essential automake libpng12-dev libsdl2-dev libopenal-dev libphysfs-dev libvorbis-dev libtheora-dev libglc-dev libglew1.5-dev libxrandr-dev zip unzip libqt5opengl5-dev libssl-dev qtscript5-dev qt5-default", plus the OpenGL development packages for your graphics driver (libgl1-mesa-dev for the open source drivers, nvidia-glx-dev for the binary Nvidia driver). For 2.3, you also need the libpopt-dev package, and bisonc++ on Ubuntu.
Getting The Source From A Tarball
Go to http://wz2100.net/download or http://sourceforge.net/projects/warzone2100/files/ to download it, then running "tar xfJ warzone2100-<version>.tar.xz" will create a subfolder "warzone2100-<version>" in the current folder. Run "cd warzone2100-<version>" to change to that folder, unless stated otherwise, all following commands have to be run from there.
Getting The Source From Git
Our base repository is at git://github.com/Warzone2100/warzone2100.git, with the usual Git branch master and several others. The most important two branches at the moment are master (main development branch) and 3.1 (more or less stable release branch). For example, "git clone git://github.com/Warzone2100/warzone2100.git warzone" will check out the current master into a subdirectory "warzone" (then use git checkout origin/3.1, if you want the 3.1 branch). If you want to use Git to access the repository, then you're in luck, since we just switched to Git, see Compile Guide. As for the tarball, change into the source folder, since all following commands have to be run from there.
Configuring
For the 3.1.3 release please use this instead of ./configure --> ( ./configure --disable-debug CFLAGS="-O2 -gstabs -g -g3" CXXFLAGS="-O2 -gstabs -g -g3" )
Now comes the time for the configure script. If you got the source from Git, run "./autogen.sh" to create the script, tarballs already include it (but if it is too old, you might have to run autogen.sh to recreate a working version). As mentioned above, it is recommended to use a custom prefix (or run the game directly from the source tree, if you don't need translations), e.g. "./configure --prefix=/opt/warzone2100-master". You can install different versions into different prefixes, if you want to run e.g. both master and 2.3. If you want to make packages to distribute, please use the "--with-distributor=<your name/distro name/website here>" option, so if it crashes, we know who made the build.
Compiling
Compiling is done with a simple "make", maybe using the -jX option to run X processes in parallel (if possible). This will generate the executable "./src/warzone2100" that launches the game.
Installing / Running
If you want to install the game and gave configure a custom prefix, run "make install" now. For translations to work, "make -Cpo install" is enough. For the videos, put them into ~/.warzone-<version> (created automatically after running the game once) as usual. If you want to make a launcher in your desktop enviroment, point it at <prefix>/bin/warzone2100 or <source-tree>/src/warzone2100 as target, or run it from the command line.
If you just run "make -Cpo install", this will only create <prefix>/share/... directories. For <prefix>/bin/... you need to run "make install" first, and then "make -Cpo install" for translations to work.
Updating
If you want to install a new version into the same prefix as an older one, make sure to remove all old files first. With a custom prefix, this is easy, just run "rm -rf <prefix>" (e.g. for the prefix used in the configure section above "rm -rf /opt/warzone2100-master"). Then either get a new tarball or do "git pull" to update your Git tree (this might need a "git checkout -f" first, if you or the build system modified some files), and restart at "Configuring" above.
Building Debian/Ubuntu Packages
This is another way of compiling the game from the source code, based on the Debian packages.
Current master and 3.1 have dpkg scripts to build .debs of Warzone. To begin with, get the source and dependencies as above, and if you're building from git run "./autogen.sh". Then run "ln -s pkg/dpkg debian", this will create a symbolic link between the two directories, so dpkg can find the files (having them in debian directly makes life for the packagers harder). Since the package version number isn't kept up to date, you need to adjust debian/changelog, the easiest way is to run e.g. "dch -v 3.1.2" for version 3.1.2.
To build the packages themselves, run "dpkg-buildpackage -uc -b" (you need to have the abovementioned dependencies installed, but if something is missing, it'll tell you the package names). This will create three packages : warzone2100, warzone2100-data and warzone2100-music that will be located in the parent folder. Go to this folder, then install these three packages using the command "dpkg -i warzone2100*.deb" (warzone2100-music is optional).
If you want to have videos as well, you can use http://sourceforge.net/projects/warzone2100/files/warzone2100/Videos/warzone2100-video_2.3-1_all.deb/download for the good English videos. Or download the sequences.wz you want to use (low-quality English and German are the two other options at the moment), put it into "pkg/dpkg/videos" and run "dpkg-buildpackage -uc -b" from there. Then, once again, go to the parent folder and install the package with "dpkg -i warzone2100-video*.deb". The videos probably won't change in the foreseeable future, so you won't have to update that package for newer versions of the game.
To launch the game, simply type warzone2100 in the command line.
libcrypto error during build on ubuntu
I got the error during ./configure step saying libcrypto was not found. This one can be resolved by
sudo apt-get install libssl-dev
Alternate Install Dependencies Ubuntu
Installed dependencies with:
sudo apt-get build-dep warzone2100
then:
./autogen.sh && ./configure && make