Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 13

[[TOC]]

This page describes how to install the latest development version of the code. This
may be **unstable** and is intended for those that want to actively follow or
contribute to the software development. **To install the latest alpha release,
[https://play0ad.com/download Download the Latest Alpha] instead.**

The development version of the game is aimed at software developers (not regular
players). As such, these instructions assume a higher level of technical
proficiency. If you encounter difficulties, please consult the
[https://www.wildfiregames.com/forum/index.php?showforum=312 forum].

== System requirements ==
You'll need:

* An adequately high-spec computer:


* At least 30 GB of free disk space
* At least 1 GB of RAM for compiling, more if compiling multiple jobs in
parallel (using -j)
* 32 or 64-bit x86-compatible CPU, or an ARMv5+ processor
* Modern graphics hardware is also recommended, though the game can run (slowly)
on fairly old devices (!GeForce 4, Intel 945GM, etc)
* One of the following operating systems:
* [#Windows Windows] (7 or newer)
* [#Linux Linux]
* [#OSX macOS / OS X] (10.7/Lion or newer)
* [#BSD FreeBSD/OpenBSD] (only experimental support at this time)
* Up-to-date system software (Windows service packs, graphics driver updates, etc)
* Some technical proficiency. We try to make the build process as smooth and
painless as possible, but it's designed to be followed by programmers - if you just
want to play the game, wait for a pre-packaged installer instead.

== Introduction ==

The development environment for 0 A.D. is comprised of three layers. Each goes on
top of the previous:

1. Libraries.
2. Workspaces.
3. Source code.

Libraries are external dependencies (such as SpiderMonkey). For Windows and Linux,
the script to create or update the Workspaces also handles installation and
updating of libraries. For macOS, the `libraries/osx/build-osx-libs.sh` script
should be used instead.

Workspaces contain the integrations for code editors (such as Visual Studio, Xcode,
etc.) as well as the Makefile for the main source code. The workspaces are auto-
generated by the `update-workspaces` script from the `buids/workspaces/` directory.
Once ready, the integrations are ready for use, such as
`build/workspaces/gcc/Makefile` (for Linux and macOS) and `build\workspaces\vc2015`
(for Windows).

Finally, the source code is build by the workspace. For example, by running `make`
in `build/workspaces/gcc`.

== Windows ==
The main supported versions are:
* Windows 10
* Windows 8.1
* Windows 8
* Windows 7

If you want to develop, the only supported IDE is:

* Visual C++ 2015

'''Important notes:'''

* We have dropped support for older versions of Visual Studio when moving to C+
+11, see #2669.
* XP and Vista are supported as targets, but not for installing Visual Studio
2015.
* Only 32-bit builds are supported, though they can be compiled and run on 64-bit
Windows.

=== Getting the code ===

See [wiki:BuildInstructionsGettingTheCode Getting the Code].

=== Setting up the build environment ===


The game must be compiled with Microsoft Visual C++. You can get the free 2015
Community edition here: [https://www.visualstudio.com/vs/older-downloads/ Visual
Studio older downloads]. You can also install Visual Studio 2017/2019 and choose to
install the 2015 compiler (version 14.0). When choosing Visual Studio 2019, firstly
Visual Studio 2015 have to be installed to be able to select the 2015 compiler.

The Visual Studio project/solution files are automatically generated from the
source files:

* Run `cd build\workspaces` and then [source:/ps/trunk/build/workspaces/update-


workspaces.bat update-workspaces.bat].
* Open `build\workspaces\vc2015\pyrogenesis.sln`.

=== Build configuration ===


Make sure to select the "Release" configuration to build an optimized, more
playable version of the game (the target will be `pyrogenesis.exe`). The "Debug"
configuration can be more useful for debugging but has significantly reduced
performance (the target will be `pyrogenesis_dbg.exe`). Both "Release" and "Debug"
builds include debug symbols, see [wiki:Debugging] and [wiki:DebuggingOnWindows
Debugging on Windows] for more details on debugging.

Now you should be able to build the code from within Visual Studio, using "Build
Solution" (F7).

=== Building Atlas ===


If you also wish to test the [wiki:Atlas_Manual Atlas Scenario Editor] or
[wiki:Actor_Editor Actor Editor] tools, you will need to download and build the
[http://www.wxwidgets.org/ wxWidgets] library separately (version 3.0 and above;
see [source:/ps/trunk/libraries/wxwidgets/README.txt
ps\libraries\win32\wxwidgets\README.txt] for details), then supply the `--atlas`
option when running `update-workspaces.bat`. Atlas projects will now be included
when you open `pyrogenesis.sln` in Visual C++.

=== Running ===


Run the game with F5 inside Visual Studio (assuming "pyrogenesis" is set as the
startup project, which is default). If you want to run it outside the debugger, run
`binaries\system\pyrogenesis_dbg.exe`.

To run the automated tests, run the "test" project. (Right click on "test" and "set
as !StartUp Project" and F5; or right click, "Debug", "Start new instance"). In
VS's debug output window, ignore any "first-chance exception" messages; it should
say ".......OK!" if it succeeded.

=== Keeping up to date ===


After you've set everything up, the process for staying up to date is:

* [https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-update.html
Update] the root directory of the checkout.
* Close the solution in Visual Studio if you've got it open. Run `update-
workspaces.bat` again. (This is only needed if any source files have been added or
removed. If you forget to run this, you'll probably get build errors about missing
symbols.)
* Build again.

=== Building Windows dependencies ===

By default windows come with prebuilt libraries but you might want to rebuild them
yourself, to do so follow the instructions at BuildingWindowsDependencies.

== Linux ==
0 A.D. should work on any reasonably modern Linux distro, on x86 and x86_64
(amd64). The details depend on exactly which distro you use.

=== Dependencies ===


First you need to install various standard tools and development libraries:

* Boost (at least 1.57 since r21726)


* CMake (only needed if you use bundled NVTT)
* GCC (at least 4.8.1, required by C++11 features)
* Python 2.7 (required for cxxtest and non-system SpiderMonkey 45)
* libcurl (at least 7.32)
* libenet (1.3, the older 1.2 is not compatible)
* libgloox (needed for the lobby; at least 1.0.10, previous versions are know to
have connection problems; pass `--without-lobby` to `update-workspaces.sh` to
exclude the lobby)
* libicu
* libogg
* libpng
* libsodium (>= 1.0.14, follow the instructions at
https://download.libsodium.org/doc/installation/ if your distro is behind)
* libvorbis
* libxcursor
* libxml2
* miniupnpc (at least 1.6)
* OpenAL
* OpenGL
* SDL2 (at least 2.0.2)
* Subversion (or git if you want to use the Git mirror; see below)
* zlib

To compile editing tools (enabled by default; pass the flag `--disable-atlas` to


`update-workspaces.sh` to disable):

* wxWidgets (at least 3.0; packages are probably called wxgtk)


To use shared system libraries instead of bundled copies (default) of libraries
(pass the flag `--with-system-$COMPONENT` to `update-workspaces.sh` to use the non-
bundled copy):

* [https://developer.mozilla.org/en-
US/docs/Mozilla/Projects/SpiderMonkey/Releases/45 SpiderMonkey 45] (`--with-system-
mozjs45`)
* [https://github.com/castano/nvidia-texture-tools NVTT] (`--with-system-nvtt`)

For a list of all options to `update-workspaces.sh` see [wiki:premake].

==== Debian / Ubuntu ====


* On **Debian 8/jessie or Ubuntu 14.04/trusty or later** install the required
dependencies with:
{{{
#!sh
sudo apt-get install build-essential cmake libboost-dev libboost-filesystem-dev \
libcurl4-gnutls-dev libenet-dev libgloox-dev libicu-dev \
libminiupnpc-dev libnvtt-dev libogg-dev libopenal-dev \
libpng-dev libsdl2-dev libvorbis-dev libxcursor-dev \
libxml2-dev python subversion zlib1g-dev libenet-dev \
libboost-system-dev
}}}
* With these dependencies you have to run:
* `./update-workspaces.sh --with-system-nvtt`
* On all versions **except Ubuntu 16.04, 18.04, and Debian Sid**, you will need to
[https://download.libsodium.org/doc/installation/ install libsodium manually].
* On **Ubuntu 16.04 and Debian Sid** and higher, you can `sudo apt-get install
libsodium-dev`.
* If you want to use a packaged **mozjs45**, which will be made available for
example in [https://launchpad.net/~wfg/+archive/ubuntu/0ad.dev/+packages 0ad.dev
PPA]:
* you should add `libmozjs-45-dev` and run `update-workspace.sh` with `--with-
system-mozjs45`.
* When not using system nvidia-texture-tools, `libnvtt-dev` can be omitted, but
`cmake` is needed to build the bundled NVTT.
* You can also use `libcurl4-openssl-dev` instead of `libcurl4-gnutls-dev` (it's
not possible to install both at once), but
[http://lintian.debian.org/tags/possible-gpl-code-linked-with-openssl.html note
that openssl is not GPL compatible and the resulting binaries could not be
redistributed].

* Finally you need to install the WX libraries. In order to do so you need to find
the current "best" set of versions for the WX libraries that are available on the
repos. Run the command
`sudo apt policy wx3.0-headers`
and the command
`sudo apt policy libwxgtk3.0-dev`
take note of the version that is available for _both_ of them (at time of
writing on my system it's `3.0.4+dfsg-8` and then install the following packages
using the format `package=version`, so for
example run
{{{
#!sh
sudo apt install wx3.0-headers=3.0.4+dfsg-8 libwxbase3.0-dev=3.0.4+dfsg-8
libwxgtk3.0-dev=3.0.4+dfsg-8 libwxbase3.0-0v5=3.0.4+dfsg-8 libwxgtk3.0-
0v5=3.0.4+dfsg-8
}}}
to make sure the required packages are all installed at the same version, or you
_will_ get build errors.

With Ubuntu 20.04 the package names changed getting an additional "-gtk3" so
install e.g. `libwxgtk3.0-gtk3-dev` instead of `libwxgtk3.0-dev`.

==== Mandriva ====


'''TODO: outdated, please update'''

Install the dependencies with:

{{{
#!sh
urpmi gcc-c++ python subversion zip cmake boost-devel libcurl-devel \
libenet-devel libgloox-devel libpng-devel libsodium-devel libvorbis-devel \
libxml2-devel libwxgtku2.8-devel openal-soft-devel libicu-devel
}}}
==== Fedora ====
Install the dependencies with:

{{{
#!sh
sudo dnf install gcc-c++ python subversion zip cmake patch \
boost-devel libcurl-devel enet-devel libpng-devel libsodium-devel libvorbis-
devel \
libxml2-devel openal-soft-devel pkgconfig SDL2-devel wxGTK3-devel \
gloox-devel libicu-devel miniupnpc-devel
}}}

* To submit a patch for review via arcanist ([wiki:Phabricator Phabricator]), php


is needed: `dnf install php-cli php-json php-xml`.

==== openSUSE ====


Install the dependencies with:

{{{
#!sh
sudo zypper install gcc-c++ python subversion zip cmake boost-devel \
libcurl-devel libenet-devel libpng-devel libsodium-devel libvorbis-devel \
libxml2-devel openal-soft-devel pkg-config wxWidgets-devel libSDL2-devel \
gloox-devel libicu-devel miniupnpc-devel
}}}

==== !ArchLinux ====


{{{
#!sh
pacman -S --needed boost cmake curl enet gcc gloox icu libgl libogg libpng
libsodium libvorbis libxcursor libxml2 miniupnpc patch sdl2 subversion wxgtk zip
zlib make python python2 pkg-config grep awk
}}}

==== Solus ====


{{{
#!sh
sudo eopkg install libboost-devel curl-devel enet-devel gloox-devel libicu-devel
libogg-devel libpng-devel libsodium-devel libvorbis-devel libxcursor-devel libxml2-
devel miniupnpc-devel openal-soft-devel mesalib-devel sdl2-devel zlib-devel
wxwidgets-devel libgnutls-devel
}}}
==== Slackware ====

After installing the dependencies for your particular version, you can build **0
A.D.** from the [#Gettingthecode svn code] using the instructions from the
[#Building Building] section.

''Note: These instructions have been tested on the **64-bit** version of


Slackware.''

'''''Slackware 14.2'''''

If you've done the full install of Slackware, most of the [#Dependencies


dependencies] are already installed. The other required dependencies you can
install from the [https://slackbuilds.org/ Slackbuilds repo] using
[https://sbopkg.org/ sbopkg]:

* enet
* gloox
* libsodium
* miniupnpc
* OpenAL
* SDL2

Required to build Atlas:


* wxGTK3 (install/build this first, required by wxPython3)
* wxPython3

**0 A.D.** will produce a `segmentation fault` if you try to connect to lobby with
TLS enabled. Though it was reported to work if compiled against the dependencies
below.

Default 14.2 packages:


{{{
a/sed-4.2.2-x86_64-1.txz
d/binutils-2.26-x86_64-3.txz
d/cmake-3.5.2-x86_64-1.txz
d/flex-2.6.0-x86_64-1.txz
d/guile-2.0.11-x86_64-2.txz
d/make-4.1-x86_64-2.txz
d/perl-5.22.2-x86_64-1.txz
d/python-2.7.16-x86_64-1_slack14.2.txz
d/python-setuptools-22.0.5-x86_64-1.txz
l/boost-1.59.0-x86_64-1
l/icu4c-56.1-x86_64-2
l/libogg-1.3.2-x86_64-1
x/libSM-1.2.2-x86_64-2.txz
x/mesa-11.2.2-x86_64-1.txz
}}}

Upgraded packages:
{{{
OpenAL-1.18.1-x86_64-1alien.txz
curl-7.64.0-x86_64-2_slack14.2.txz
enet-1.3.12-x86_64-1_slonly.txz
gcc-5.5.0-x86_64-1_slack14.2.txz
gcc-g++-5.5.0-x86_64-1_slack14.2.txz
libXcursor-1.1.15-x86_64-1_slack14.2.txz
libpng-1.6.27-x86_64-1_slack14.2.txz
libsodium-1.0.16-x86_64-1_slonly.txz
libvorbis-1.3.6-x86_64-1_slack14.2.txz
libxml2-2.9.5-x86_64-1_slack14.2.txz
libzip-1.0.1-x86_64-3_slack14.2.txz
miniupnpc-2.0-x86_64-1_slonly.txz
pip-9.0.3-x86_64-1_slonly.txz
pkg-config-0.29.2-x86_64-1_slack14.2.txz
premake-4.4_beta5-x86_64-1_slonly.txz
sdl2-2.0.3-x86_64-1jsc.txz
wxGTK3-3.0.4-x86_64-2ponce.txz
zlib-1.2.11-x86_64-1_slack14.2.txz
}}}

Special packages:
{{{
gloox-1.0.22-x86_64-1_SBo.tgz
kernel-headers-4.4.157-x86-1.txz
}}}

Notes:

Gloox 1.0.22 was created using this


[https://slackbuilds.org/repository/14.2/libraries/gloox/ Slackbuild]. Just open
the Slackbuild script and change version from 1.0.13 to 1.0.22 and compile with
this [https://camaya.net/download/gloox-1.0.22.tar.bz2 tarball].

Kernel headers must match your kernel version.

'''''Slackware-current'''''

Presently, **0 A.D.** does not build on Slackware-current. If you'd like to help
with the [https://trac.wildfiregames.com/ticket/5157#comment:21 ticket], please
[https://play0ad.com/about/contact-us/ contact us].

If you attempt to build on Slackware-current, install the dependencies listed above


with `sbopkg`, but skip ''libsodium'' and ''sdl2''; they are already distributed
with Slackware-current.

==== CentOS ====

Discussion of installing on //CentOS 7// can be found on the forums


[https://wildfiregames.com/forum/index.php?/topic/24985-installation-on-centos-7
here].

**Note:** The advice below is derived from installing in a Virtual Machine with
//CentOS 7// 64-bit minimally installed. If you have //CentOS 6// (or earlier), the
following steps may not be possible. Installation on a physical machine, a machine
with more stuff already installed upon it, or a machine that is 32-bit, may differ
slightly.

1. Firstly, you will need to enable the "Extra Packages for Enterprise Linux" (or
"EPEL") repository (if you haven't already). You can do this by running (as
root/via sudo)
{{{ #!sh
yum install epel-release
}}}

2. Install some auxiliary packages. These are not dependencies of 0 A.D. itself,
but are necessary to run update_workspaces.sh successfully. They might already be
installed on your system:
{{{ #!sh
yum install bzip2 patch
}}}

3. Install the 0 A.D. dependencies that are available directly from repos:
{{{ #!sh
yum install cmake gcc-c++ enet-devel libglvnd-devel gloox-devel libicu-devel \
libogg-devel libpng-devel libsodium-devel libvorbis-devel libXcursor-devel
libxml2-devel \
miniupnpc-devel openal-soft-devel subversion wxGTK3-devel zlib-devel SDL2-
devel
}}}

4. Acquire a sufficiently recent version of //libcurl//:


* From this site: https://mirror.city-fan.org/ftp/contrib/libraries/, download
the two files that satisfy one of the following patterns:
- `libssh2-{version}.cf.rhel7.{arch}.rpm`
- `libssh2-devel-{version}.cf.rhel7.{arch}.rpm`
* From this site: https://mirror.city-fan.org/ftp/contrib/sysutils/Mirroring/,
download the three files that satisfy one of the following patterns:
- `curl-{version}.cf.rhel7.{arch}.rpm`
- `libcurl-{version}.cf.rhel7.{arch}.rpm`
- `libcurl-devel-{version}.cf.rhel7.{arch}.rpm`
* Install some dependencies from repos:
{{{ #!sh
yum install nss-devel libnghttp2 libpsl libmetalink
}}}
* Install dependencies from downloaded packages.
[[BR]][[BR]]
**Note:** This will replace the version of //libssh2// that is provided by the
//CentOS// official repos. This is necessary as the version of //libcurl// we're
installing needs a more up-to-date version than what the official repos can
provide. As the packages we've acquired are compiled as to be interoperable
with //CentOS// systems, this shouldn't cause any problems with other programs
installed on your system.
[[BR]][[BR]]
Install the `libssh2-*` and `libssh2-devel-*` packages using `rpm -Uvh`. For
example:
{{{ #!sh
rpm -Uvh libssh2-1.8.0-8.0.cf.rhel7.x86_64.rpm libssh2-devel-1.8.0-
8.0.cf.rhel7.x86_64.rpm
}}}
* Install the updated //curl// packages (`curl-*`, `libcurl-*` and `libcurl-
devel-*`) using `rpm -Uvh`. For example:
{{{ #!sh
rpm -Uvh curl-7.61.1-3.0.cf.rhel7.x86_64.rpm libcurl-7.61.1-
3.0.cf.rhel7.x86_64.rpm libcurl-devel-7.61.1-3.0.cf.rhel7.x86_64.rpm
}}}

5. Acquire a sufficiently recent version of //boost//:


* From https://www.boost.org/users/history/version_1_70_0.html, download
`boost_1_70_0.tar.gz`.
* Uncompress archive:
- $ `tar -xf boost_1_70_0.tar.gz`
* Enter folder:
- $ `cd ./boost_1_70_0`
* Compile the parts that are needed to be compiled, and install the libraries:
- $ `./bootstrap.sh --with-libraries=filesystem,system`
- # `./b2 install`
- (Compiled files end up in `/usr/local/lib/`, header files in
`/usr/local/include/boost/`)
* Make sure the runtime linker can find the updated //boost// libraries:
- Navigate to `/etc/ld.so.conf.d` and create a blank file called `pyro.conf`.
- Within this file, enter the text `/usr/local/lib` and save.

6. You should now have all dependencies for 0 A.D. Continue by [#Gettingthecode
getting the code], as described below. When you get to the part below in [#Building
Building] where you run `./update-workspaces.sh`, you **must** use the argument `--
prefer-local-libs`.

==== !VoidLinux ====


{{{
#!sh
sudo xbps-install -Syv base-devel boost-devel cmake curl gcc icu-devel libcurl-
devel libenet-devel libogg-devel libopenal-devel libpng-devel libsodium-devel
libvorbis-devel libXcursor libxml2 MesaLib-devel miniupnpc-devel patch pkg-config
SDL2-devel wxWidgets-devel zip zlib
}}}
If there are issues, install more header files depending on the compiler's error
message.
pyrogenesis requires `MesaLib-devel` to provide header files for libGL.
Custom compile `gloox` for the Lobby or use xbps source packages or use `update-
workspaces.sh --without-lobby` or wait until https://github.com/voidlinux/void-
packages/pull/5102 is merged.
If there are unresolved shlibs or an update breaks a package, then e.g.
{{{
#!sh
sudo xbps-install -Syv SDL2-devel dbus dbus-x11 # credit Vaelatern
sudo xpbs-install -Su # update, add -d for debugging, credit duncaen
}}}

=== Getting the code ===

See [wiki:BuildInstructionsGettingTheCode Getting the Code].

=== Building ===


Compile the code with:

{{{
#!sh
cd 0ad/build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
}}}
* '''-j3''' gives the number of parallel builds to run, and should typically be
one plus the number of CPU cores available.
* The '''Release''' mode builds (which are the default) are more optimised, but
are harder to debug. Use `make config=debug` (and run `pyrogenesis_dbg`) if you
need better debugging support. See [wiki:Debugging] for more details.

If you encounter any build errors, review the


[https://trac.wildfiregames.com/report existing bug reports], check the
[#Knownproblemsandsolutions known problems section] or please file a
[https://trac.wildfiregames.com/newticket new bug in the tracker].

=== Testing ===


Run the automated tests to verify that everything works as expected like this:

{{{
#!sh
cd ../../..
binaries/system/test
}}}
=== Running ===
If everything went well, compiling the code worked and all tests passed, it's
finally time to run the game:

{{{
#!sh
binaries/system/pyrogenesis
}}}
=== Keeping up to date ===
If you want to rebuild quickly after updating from SVN, you can usually get away
with:

{{{
#!sh
svn up
cd build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
}}}
If the `make` line gives errors, you may need to run `make clean` before it. If the
`update-workspaces.sh` gives errors, you may need to run `clean-workspaces.sh`
before it.

== Creating Linux packages ==


If you want to create packages for a Linux distribution see the current
[https://salsa.debian.org/games-team/0ad/tree/master/debian 0ad] and
[https://salsa.debian.org/games-team/0ad-data/tree/master/debian 0ad-data] packages
on [https://salsa.debian.org/public Salsa] for examples (especially the `control`
and `rules` files).

== OS X ==
== macOS ==

The process on macOS is similar to Linux:

=== Dependencies ===


1. '''Apple Command Line Tools for Xcode'''. There are a number of command-line
tools you need that are not installed on macOS by default. Instead, these are
available as a separate free download from Apple. '''This does not include or
require Xcode.''' It is branded as "for Xcode" but it works by itself.
* If you're using macOS 10.7 Lion or later, install this package from
[https://developer.apple.com/downloads/index.action Apple Developer Downloads]. You
need a (free) Apple ID to access the download.
* See [https://developer.apple.com/library/archive/technotes/tn2339/_index.html
Apple Command Line FAQ] for additional instructions.
2. Python 2.7.3 or later If you're on Mountain Lion (10.8) or earlier, you will
need to first update your Python installation with the latest 2.7.x installer from
[https://www.python.org/downloads/release/python-279/ here].
3. CMake:
* If you have [https://brew.sh/ Homebrew] installed, use
[https://brewformulas.org/Cmake `brew install cmake`].
* Alternatively, download a prebuilt macOS package at
https://cmake.org/download/. If prompted, choose to install the "CMake command line
tools" to the **default location**.
* '''Note:''' Recent versions have no installer, so after copying the app
bundle to '''Applications''', you need to run CMake with elevated permissions to
install the command line tools. From the terminal: `sudo
"/Applications/CMake.app/Contents/bin/cmake-gui" --install`.
* If the install command fails, you can manually add the following line to the
end of `/etc/paths`: `/Applications/CMake.app/Contents/bin`.

=== Getting the code ===

See [wiki:BuildInstructionsGettingTheCode Getting the Code].

Now you have two options:

=== Build the game ===


* Run [source:/ps/trunk/libraries/osx/build-osx-libs.sh libraries/osx/build-osx-
libs.sh], the macOS libraries build script, this will download and build the game's
dependencies (except CMake, see above). This script will take some time to finish
when first run, after that it will reuse the old build.
{{{
#!sh
cd libraries/osx
./build-osx-libs.sh -j3
}}}
* '''-j3''' gives the number of parallel builds to run, and should typically be
one plus the number of CPU cores available.
* To force a rebuild for some reason, e.g. the SVN folder is moved or Xcode /
macOS is upgraded, pass in the `--force-rebuild` flag.
* Next, to build the game on the command line, use the following commands:
{{{
#!sh
cd build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
}}}
* The '''Release''' mode builds (which are the default) are more optimised, but
are harder to debug. Use `make config=debug` (and run `pyrogenesis_dbg`) if you
need better debugging support. See [wiki:Debugging] for more details.
* If you encounter any build errors, review the
[https://trac.wildfiregames.com/report existing bug reports], check the
[#Knownproblemsandsolutions known problems section] or please file a
[https://trac.wildfiregames.com/newticket new bug in the tracker].
* Or if you have Xcode 4 installed, you can open
`build/workspaces/xcode4/pyrogenesis.xcworkspace` (see discussion on this
[https://www.wildfiregames.com/forum/index.php?showtopic=15511&st=160#entry261743
here]).
* Run the automated tests to verify that everything works as expected like this:
{{{
#!sh
binaries/system/test
}}}
* If everything went well, compiling the code worked and all tests passed, it's
finally time to run the game:
{{{
#!sh
binaries/system/pyrogenesis
}}}
* '''Note:''' Newer versions of Xcode no longer include the command line tools by
default, you need to install them as described above.
* '''Note:''' It is recommended to use the command line build, since the Xcode
build is not as well-tested, but Xcode's IDE can be very useful for code editing.

== Create macOS distributable app bundle ==


* You will need Xcode installed (for its SDKs)
* Open [source:/ps/trunk/build/workspaces/build-osx-bundle.sh
build/workspaces/build-osx-bundle.sh] and read the comments. You will need to
change a few settings depending on your version of macOS, Xcode, etc.
* Run `build-osx-bundle.sh`, the bundle build script, which will download and
build the game's dependencies for the appropriate SDK, build the game's source
code, package the mod data, and set up the app bundle info.
{{{
#!sh
cd build/workspaces
./build-osx-bundle.sh -j3
}}}
* '''-j3''' gives the number of parallel builds to run, and should typically be
one plus the number of CPU cores available.
* When it's finished, there should be a complete '''0ad app''' bundle in
`build/workspaces`. You can open it by double-clicking its icon in Finder or with
the `open 0ad.app` command in the terminal.
* Consider the following to make an official release:
* Use `build-osx-bundle.sh --release`, to create a bundle from a clean SVN
working copy.
* Package the bundle inside a compressed DMG with background image, for easy
distribution (see ReleaseProcess).

== BSD ==
'''Note: The *BSD support is a work in progress and should be considered
experimental. That means don't try it unless you "know what you're doing" :)'''

'''TODO: outdated, please update (see #5255)'''

* Install the following ports or packages (names probably differ depending on the
BSD variant):[[BR]] Install commands for the variants are provided below.
* boost-libs
* cmake
* curl (at least 7.32)
* enet
* execinfo
* gloox
* gmake
* iconv
* icu
* libGL
* libogg
* libvorbis
* libxml2
* miniupnpc
* openal
* png
* sdl2
* subversion
* wxWidgets-gtk2 (3.0 and above) - required to build the Atlas editor
* zip
* '''Note:''' zlib should already be installed by default
* GCC 4.8.1+ or Clang
* Obtain the game's source code as [#Gettingthecode described above] for Linux.
* Check for any variant specific issues below.
* '''Note:''' Our build scripts should detect that you are running *BSD and use
`gmake` as the make command. If for some reason this isn't correct, you can set the
`MAKE` environment variable to the correct GNU make path.
* Follow the [#Building build] instructions above for Linux.

=== FreeBSD ===


* Install the dependencies with:
{{{
#!sh
pkg install boost-libs cmake curl enet gloox gmake iconv libGL libogg \
libsodium libvorbis libxml2 miniupnpc openal pkgconf png sdl2 subversion
\
wx30-gtk2 zip
}}}

* If running FreeBSD 10.0+ you need to set `CC` to `clang` and `CXX` to `clang++`.
{{{
#!sh
export CC=clang CXX=clang++
}}}
* TODO: Fix missing ecvt() (see #1325)
* If building Atlas, you need to set the `WX_CONFIG` variable, because `wx-config`
has a different name on FreeBSD. For example, you'd run this command if you built
the wxGTK 2.8 package with unicode support:
{{{
#!sh
export WX_CONFIG=wxgtk2u-2.8-config
}}}
if not correct, you will get errors about missing "wx/*.h" includes. You can
skip building Atlas altogether (and the wxWidgets dependency) by later passing the
`--disable-atlas` option to `update-workspaces.sh`.
* You'll have to set this variable every time you run `update-workspaces.sh`, so
it may be most convenient to put these commands into another shell script.

=== OpenBSD ===


* As we require GCC 4.8.1+ you need to set `CC` and `CXX` before building
{{{
#!sh
export CC=egcc CXX=eg++
}}}
* Install the dependencies with:
{{{
#!sh
pkg_add -i boost cmake curl enet g++ gcc gloox gmake icu4c libexecinfo libogg
libsodium \
libxml miniupnpc openal png sdl2 subversion zip
}}}
* As OpenBSD's packaged libxml isn't build with threading support, building Atlas
is not possible so you should run `update-workspaces.sh` with the `--disable-atlas`
option.
* You probably need to run pyrogenesis with
`LD_PRELOAD=/usr/local/lib/libogg.so.6.2:/usr/local/lib/libvorbis.so.8.0` (see
#1463).

== Known problems and solutions ==


* None currently.

You might also like