Changes between Version 172 and Version 173 of BuildInstructions


Ignore:
Timestamp:
May 26, 2012, 9:36:21 PM (12 years ago)
Author:
mackwic
Comment:

adding premake in dependency + some visual changes

Legend:

Unmodified
Added
Removed
Modified
  • BuildInstructions

    v172 v173  
    11[[TOC]]
    22
    3 '''NOTE: The build system has changed since Alpha 7 and the instructions are now subtly different. If you want to build Alpha 7 or previous versions of the game, use the [http://trac.wildfiregames.com/wiki/BuildInstructions?version=140 older version] of this page.'''
    4 
    5 This page describes how to get the very latest unstable version of the code. Unless you want to actively follow and contribute to development, you probably want the [LatestRelease latest relatively-stable release] instead.
     3[[br]]
     4
     5    **NOTE: The build system has changed since Alpha 7 and the instructions are now subtly different.**
     6
     7    **If you want to build Alpha 7 or previous versions of the game, use the older version of this page.**
     8
     9[[br]]
     10
     11This page describes how to get the very latest unstable version of the code. Unless you want to actively follow and contribute to development, **you probably want the [wiki:LatestRelease latest relatively-stable release] instead.**
    612
    713The current release of the game is aimed at developers and not at 'normal' users. As such, the following instructions assume a reasonable level of technical proficiency. If you encounter difficulties, please post on the [http://www.wildfiregames.com/forum/index.php?showforum=312 forum].
     14
     15[[br]]
     16
    817
    918== General prerequisites ==
     
    1120
    1221 * An adequately high-spec computer:
    13   * At least 5GB of free disk space
    14   * Preferably at least 1GB of RAM for compiling
    15   * Intel x86-compatible CPU, 32- or 64-bit, multiple cores will help compile faster
    16   * Modern graphics hardware is also recommended, though the game can run (slowly) on fairly old devices (!GeForce 4, Intel 945GM, etc)
     22   * At least 5GB of free disk space
     23   * At least 1GB of RAM for compiling
     24   * Intel x86-compatible CPU, 32- or 64-bit
     25   * Modern graphics hardware is also recommended, though the game can run (slowly) on fairly old devices (!GeForce 4, Intel 945GM, etc)
    1726 * One of the following operating systems:
    18   * [#Windows Windows] (2000 or newer)
    19   * [#Linux Linux]
    20   * [#OSX OS X] (currently 10.6 or newer)
    21   * [#FreeBSD FreeBSD] (only experimental support at this time)
     27   * [#Windows Windows] (2000 or newer)
     28   * [#Linux Linux]
     29   * [#OSX OS X] (currently 10.6 or newer)
     30   * [#FreeBSD FreeBSD] (only experimental support at this time)
    2231 * Up-to-date system software (Windows service packs, graphics driver updates, etc)
    2332 * 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.
    2433
     34[[br]]
     35
    2536== Windows ==
    26 Windows 7, Vista and XP are the main supported versions; 2000 should work too but is rarely tested. Visual C++ 2010 and 2008 are supported. Visual C++ 2005 may also work given a sufficiently modern Platform SDK. Only 32-bit builds are supported (though they can be compiled and run on 64-bit Windows). We have noticed occasional trouble with the free Express Editions; if possible, please consider acquiring the full version (e.g. via university programs). In particular, failures of the built-in self-test test_wdbg_sym.h seem to occur with VC2008 EE but not VC2008 nor VC2010 (c.f. #884).
     37
     38The main supported OS are :
     39 * Windows 7
     40 * Windows Vista
     41 * Windows XP
     42
     43Windows 2000 should work too but is rarely tested.
     44
     45The main supported IDE are :
     46 * Visual C++ 2010 and 2008
     47 * Code Blocks
     48{{{
     49#!comment
     50Code Blocks is guessed from 0ad/build/workspaces/codeblocks
     51What about the support of Eclipse ?
     52}}}
     53
     54NOTE : Visual C++ 2005 may work with a sufficiently modern Platform SDK.
     55
     56NOTE : Only 32-bit builds are supported (though they can be compiled and run on 64-bit Windows)
     57
     58NOTE : We have noticied occasional trouble with the free Express Editions; please consider acquire the full version (e.g. via university programs) or using free IDE like Code Blocks or Eclipse CDT.
     59In particular, failures of the built-in self-test test_wdbg_sym.h seem to occur with VC2008 EE but not VC2008 nor VC2010 (c.f. #884).
     60
    2761
    2862=== Acquiring the code ===
     
    4377 * If you have the old VC++ 2005 Express, you need to install the separate [http://social.msdn.microsoft.com/forums/en-US/Vsexpressvc/thread/c5c3afad-f4c6-4d27-b471-0291e099a742/ Platform SDK] (steps 1-3).
    4478
    45 
    4679The Visual Studio project/solution files are automatically generated from the source files:
    4780
     
    4982 * Open `build/workspaces/vc2010/pyrogenesis.sln`. (Use the `vc2005` directory for VC++ 2005 or the `vc2008` directory for VC++ 2008.)
    5083
    51 === Optimised builds ===
    52 Make sure to select the "Release" configuration to build an optimised, 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:DebuggingOnWindows Debugging on Windows] for more details on debugging.
     84=== Type of builds ===
     85Make sure to select the "Release" configuration to build a 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:DebuggingOnWindows Debugging on Windows] for more details on debugging.
    5386
    5487Now you should be able to build the code from within Visual Studio, using "Build Solution" (F7).
     
    69102 * Build again.
    70103
     104[[br]]
     105
    71106== Linux ==
    72 
    731070 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.
    74108
    75109=== Dependencies ===
    76 
    77110First you need to install various standard tools and development libraries:
    78111
    79112 * Boost
    80113 * CMake (only needed if you use bundled NVTT)
     114 * premake4
    81115 * Gamin (FAM should work too, but is considered deprecated)
    82116 * GCC (at least 4.0, preferably 4.3 or later)
     
    102136
    103137==== Debian (wheezy or later) / Ubuntu (12.04 or later) ====
    104 
    105138Install the dependencies with:
    106    
    107 {{{
    108 #!html
    109 <pre class="wiki" style="white-space: pre-wrap">
    110 sudo apt-get install build-essential libboost-dev libboost-filesystem-dev libboost-signals-dev libcurl4-gnutls-dev libenet-dev libgamin-dev libjpeg-dev libmozjs185-dev libnvtt-dev libogg-dev libopenal-dev libpng-dev libsdl-dev libvorbis-dev libwxgtk2.8-dev libxcursor-dev libxml2-dev subversion zlib1g-dev
    111 </pre>
     139
     140{{{
     141#!sh
     142sudo apt-get install build-essential libboost-dev libboost-filesystem-dev   \
     143    libboost-signals-dev libcurl4-gnutls-dev libenet-dev libgamin-dev       \
     144    libjpeg-dev libmozjs185-dev libnvtt-dev libogg-dev libopenal-dev        \
     145    libpng-dev libsdl-dev libvorbis-dev libwxgtk2.8-dev libxcursor-dev      \
     146    libxml2-dev premake subversion zlib1g-dev
    112147}}}
    113148 * You can also use `libcurl4-openssl-dev` instead of `libcurl4-gnutls-dev` (it's not possible to install both at once), but note that openssl is not GPL compatible and the resulting binaries could not be redistributed.
     
    115150
    116151==== Mandriva ====
    117 
    118152Install the dependencies with:
    119153
    120154{{{
    121 #!html
    122 <pre class="wiki" style="white-space: pre-wrap">
    123 urpmi gcc-c++ python subversion zip cmake boost-devel fam-devel libcurl-devel libjpeg-devel libpng-devel libvorbis-devel libxml2-devel libwxgtku2.8-devel openal-soft-devel
    124 </pre>
     155#!sh
     156urpmi gcc-c++ python subversion zip cmake premake boost-devel fam-devel     \
     157    libcurl-devel libjpeg-devel libpng-devel libvorbis-devel libxml2-devel  \
     158    libwxgtku2.8-devel openal-soft-devel
    125159}}}
    126160
    127161==== Fedora ====
    128 
    129162Install the dependencies with:
    130163
    131164{{{
    132 #!html
    133 <pre class="wiki" style="white-space: pre-wrap">
    134 su -c 'yum -y install gcc-c++ python subversion zip cmake boost-devel fam-devel libcurl-devel libjpeg-devel libpng-devel libvorbis-devel libxml2-devel openal-soft-devel pkgconfig SDL-devel wxGTK-devel'
    135 </pre>
     165#!sh
     166su -c 'yum -y install gcc-c++ python premake subversion zip cmake boost-devel \
     167    fam-devel libcurl-devel libjpeg-devel libpng-devel libvorbis-devel        \
     168    libxml2-devel openal-soft-devel pkgconfig SDL-devel wxGTK-devel'
    136169}}}
    137170
    138171==== OpenSUSE ====
    139 
    140172Install the dependencies with:
    141173
    142174{{{
    143 #!html
    144 <pre class="wiki" style="white-space: pre-wrap">
    145 sudo zypper install gcc-c++ python subversion zip cmake boost-devel fam-devel libcurl-devel libjpeg-devel libpng-devel libvorbis-devel libxml2-devel openal-soft-devel pkg-config wxGTK-devel libSDL-devel
    146 </pre>
     175#!sh
     176sudo zypper install gcc-c++ python premake subversion zip cmake boost-devel \
     177    fam-devel libcurl-devel libjpeg-devel libpng-devel libvorbis-devel      \
     178    libxml2-devel openal-soft-devel pkg-config wxGTK-devel libSDL-devel
    147179}}}
    148180
     
    150182
    151183=== Getting the code ===
    152 
    1531840 A.D. is primarily developed on SVN. To checkout the latest code from SVN, run this command:
    154185
    155186{{{
     187#!sh
    156188svn co http://svn.wildfiregames.com/public/ps/trunk/ 0ad
    157189}}}
    158190
    159 Sometimes SVN stops before it has downloaded all files. You should check that it outputs something like `at revision rXXXX`. Otherwise run
    160 {{{
     191Note : Sometimes SVN stops before it has downloaded all files. You should check that it outputs something like `at revision rXXXX`. Otherwise run
     192
     193{{{
     194#!sh
    161195svn up 0ad
    162196}}}
     
    165199
    166200{{{
     201#!sh
    167202git clone https://github.com/0ad/0ad.git
    168203}}}
    169204
    170205=== Building ===
    171 
    172206Compile the code with:
     207
    173208{{{
    174209#!sh
     
    185220
    186221=== Testing ===
    187 
    188222Run the automated tests to verify that everything works as expected like this:
    189223
    190224{{{
     225#!sh
    191226binaries/system/test
    192227}}}
    193228
    194229=== Running ===
    195 
    196230If everything went well, compiling the code worked and all tests passed, it's finally time to run the game:
    197231
    198232{{{
     233#!sh
    199234binaries/system/pyrogenesis
    200235}}}
    201236
    202237=== Keeping up to date ===
    203 
    204238If you already checked out the code and only want to update and rebuild it, you may find it helpful to save the lines below to a script called e.g. `rebuild.sh`, place it in your 0ad directory, make it executable and run it.
    205239
     
    218252
    219253If you just edited one source code file and want to rebuild, you can usually get away with:
     254
    220255{{{
    221256make -j3
     
    223258
    224259If you want to rebuild quickly after updating from SVN, you can usually get away with:
     260
    225261{{{
    226262#!sh
     
    231267make -j3
    232268}}}
     269
    233270If 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.
     271
     272== Creating Linux packages ==
     273If you want to create packages for a Linux distribution, see the current [https://build.opensuse.org/package/files?package=0ad&project=games 0ad] and [https://build.opensuse.org/package/files?package=0ad-data&project=games 0ad-data] packages on OBS for examples (especially the `.spec` and `debian.rules` files).
     274[[br]]
    234275
    235276== OS X ==
     
    238279 * If you're using Lion 10.7.3 or later, Apple has made their ''Command Line Tools for Xcode'' package freely available, as a separate download. '''It does not include or require Xcode.''' If you don't want the Xcode IDE, it's recommended to install only this package from [https://developer.apple.com/downloads/index.action Apple Developer Downloads]. You need a free Apple ID to access the download. If you already have Xcode 4.3+, you can download the command line tools from the [https://developer.apple.com/library/IOs/#recipes/xcode_help-documentation_preferences/DownloadingandInstallingXcodeComponents/DownloadingandInstallingXcodeComponents.html download preferences].
    239280 * If you're using Snow Leopard or Lion 10.7.2 or earlier, you'll probably need to install Xcode to get the command line tools (or you can try [https://github.com/kennethreitz/osx-gcc-installer/ OSX GCC Installer]):
    240     * If available, use your Mac OS X install DVD which saves downloading 1.72+ GB.
    241     * Visit [https://developer.apple.com/downloads/index.action Apple Developer Downloads] (logging in with your free Apple ID) and download the latest Xcode version for your OS. Version 4.x is required for Lion, while version 3.x is required for Snow Leopard. It's very important you install the correct version.
    242     * The latest version of Xcode is also available for free from the [http://www.apple.com/mac/app-store/ Mac App Store], you'll need Snow Leopard 10.6.6 or later to access the App Store. ''Note: if you download the app, it is only the installer for Xcode. You need to open it and run the "Install Xcode" app.''
     281   * If available, use your Mac OS X install DVD which saves downloading 1.72+ GB.
     282   * Visit [https://developer.apple.com/downloads/index.action Apple Developer Downloads] (logging in with your free Apple ID) and download the latest Xcode version for your OS. Version 4.x is required for Lion, while version 3.x is required for Snow Leopard. It's very important you install the correct version.
     283   * The latest version of Xcode is also available for free from the [http://www.apple.com/mac/app-store/ Mac App Store], you'll need Snow Leopard 10.6.6 or later to access the App Store. ''Note: if you download the app, it is only the installer for Xcode. You need to open it and run the "Install Xcode" app.''
    243284 * Install [http://www.macports.org/install.php MacPorts]. This is the easiest way to install all the dependencies needed by the game.
    244285 * `sudo port install` the following packages :
     
    252293   * wxWidgets-devel (required for building Atlas, only the 2.9.x branch will work on 64-bit Macs)
    253294   * subversion (the default version on 10.5 seems to cause checksum mismatch errors)
     295
     296Run the fdollowing command in a shell :
     297{{{
     298#!sh
     299sudo port install boost cmake libenet libsdl libvorbis libxml2 curl wxWidgets-devel subversion
     300}}}
     301
    254302 * Now follow the [#Gettingthecode same instructions] as for Linux above, starting from the `svn co`.
    255303 * Newer versions of Xcode no longer include the command line tools by default, you need to install them as described above. Additionally, the command line tools package no longer includes GCC but it does include LLVM-GCC which is compatible. If you get errors during the build like "C compiler cannot create executables" then you probably have the newer command line tools with LLVM. The following command should fix it:
    256  {{{
     304{{{
     305#!sh
    257306 export CC=gcc CXX=g++
    258  }}}
    259 
     307}}}
    260308
    261309=== Compiling with GCC 4.2 or 4.3 under OS X ===
    262 
    263 If you get errors compiling with OS X's default version of GCC (4.0.1), you can try compiling with GCC 4.2 or 4.3. On Snow Leopard, running
    264 {{{
     310If you get errors compiling with OS X's default version of GCC (4.0.1), you can try compiling with GCC 4.2 or 4.3. On Snow Leopard, running
     311
     312{{{
     313#!sh
    265314export CXX=/usr/bin/g++-4.2
    266315}}}
    267316before compiling the game may be sufficient. Leopard does not ship with a recent version of GCC, so you first have to get them from !MacPorts and then patch some system libraries:
    268317
    269  * `sudo port install gcc42 gcc43 gcc_select`
    270 
    271  * Select GCC 4.2 or 4.3: `sudo gcc_select mp-gcc42` or `sudo gcc_select mp-gcc43`
     318{{{
     319#!sh
     320sudo port install gcc42 gcc43 gcc_select`
     321}}}
     322
     323 * Select GCC 4.2 or 4.3:
     324{{{
     325#!sh
     326sudo gcc_select mp-gcc42
     327}}}
     328
     329or
     330
     331{{{
     332#!sh
     333sudo gcc_select mp-gcc43
     334}}}
    272335
    273336 * You may need to patch Apple's OpenAL (`/System/Library/Frameworks/OpenAL.Framework/Headers/alc.h`: replace all `ALCvoid` by `void`, except the first one which is a `typedef`). (GCC >=4.2 is stricter about parameters invalidly typedefed to void in C++.)
     
    279342== FreeBSD ==
    280343'''Note: this is a work in progress and should be considered experimental. That means don't try it unless you "know what you're doing" :)'''
     344
    281345 * Install the following ports or packages (using `pkg_add -r`):
    282   * sdl
    283   * boost-libs
    284   * png
    285   * execinfo
    286   * libxml2
    287   * libGL
    288   * openal
    289   * zip
    290   * libogg
    291   * libvorbis
    292   * curl
    293   * gamin
    294   * cmake
    295   * wxgtk2-unicode - required to build Atlas tools
    296   * subversion - note the latest version for 8.2 Release is 1.6
    297   * Note: GCC 4.2.1 and zlib should already be installed by default
     346   * sdl
     347   * boost-libs
     348   * png
     349   * execinfo
     350   * libxml2
     351   * libGL
     352   * openal
     353   * zip
     354   * libogg
     355   * libvorbis
     356   * curl
     357   * gamin
     358   * cmake
     359   * wxgtk2-unicode - required to build Atlas tools
     360   * subversion - note the latest version for 8.2 Release is 1.6
     361   * Note: GCC 4.2.1 and zlib should already be installed by default
     362{{{
     363#!sh
     364pkg_add -r adl boots-libs png execinfo libxml2 libGl openal zip libogg  \
     365    libvorbis curl gamin cmake premake wxgetk2-unicode subversion
     366}}}
     367
    298368 * Obtain the game's source code as [#Gettingthecode described above] for Linux.
    299369 * TODO: Fix missing ecvt() and get premake to generate a proper build/gmake.unix/Makefile, or maybe create a build/gmake.bsd/? (the only difference is it tries to link libdl, which doesn't exist on FreeBSD)
    300370 * 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:
    301371{{{
     372#!sh
    302373export WX_CONFIG=wxgtk2u-2.8-config
    303374}}}
    304375   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`.
    305   * 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.
     376   * 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.
    306377 * Note: FreeBSD's `make` command is actually Berkeley [http://www.freebsd.org/cgi/man.cgi?query=make make], which is similar to but different than GNU make. Our build scripts will detect if you're on FreeBSD and use the `gmake` command instead. If for some reason this isn't correct, you can set the `MAKE` environment variable with the path and name of the correct GNU make.
    307378 * Follow the [#Building build] instructions above for Linux.
     
    338409}}}
    339410   then you are likely using a build directory with spaces in its path. !SpiderMonkeys build system isn't designed to cope with spaces in the source path (see #916). Rename your build directory so that it doesn't contain any spaces.
    340 
    341 == Creating Linux packages ==
    342 
    343 If you want to create packages for a Linux distribution, see the current [https://build.opensuse.org/package/files?package=0ad&project=games 0ad] and [https://build.opensuse.org/package/files?package=0ad-data&project=games 0ad-data] packages on OBS for examples (especially the `.spec` and `debian.rules` files).