Difference between revisions of "CompilingWesnoth"

From The Battle for Wesnoth Wiki
(Prerequisites)
(updated basically everything, adding boost and compressing those strange ubuntu commands into two simple lines)
Line 29: Line 29:
 
* libsdl-net ( http://www.libsdl.org/projects/SDL_net )
 
* libsdl-net ( http://www.libsdl.org/projects/SDL_net )
 
* libintl (and other libraries found in gettext package) ( http://www.gnu.org/software/gettext/gettext.html )
 
* libintl (and other libraries found in gettext package) ( http://www.gnu.org/software/gettext/gettext.html )
* (only Wesnoth 0.8.5 or older) libsdl-ttf2.0 ( http://www.libsdl.org/projects/SDL_ttf )
+
* (newer than Wesnoth 1.3) python >= 2.4 ( rather optional but highly recommended, http://www.python.org )
* (newer than Wesnoth 0.8.5) libfreetype2 ( http://www.freetype.org )
+
* (newer than Wesnoth 1.3.12) lib-boost ( currently only iostreams, http://www.boost.org )
 +
 
 +
If you attempt to build from svn you will also need those packages:
 +
* autoconf >= 2.60
 +
* automake >= 1.9
  
 
The various SDL libraries can be found at http://www.libsdl.org
 
The various SDL libraries can be found at http://www.libsdl.org
Line 37: Line 41:
 
http://freshmeat.net/projects/wesnoth -> Dependencies -> Download links
 
http://freshmeat.net/projects/wesnoth -> Dependencies -> Download links
  
For Ubuntu Breezy Badger (5.10) the following will satisfy '''runtime''' dependencies.
+
On all linux distributions that are based on Debian it should be enough to use this command:
apt-get install libsdl1.2 libsdl-image1.2 libsdl-mixer1.2 libsdl-net1.2 gettext libfreetype6
+
  apt-get build-dep wesnoth
 
 
For Ubuntu Dapper Drake (6.06) the following will satisfy '''runtime''' dependencies
 
apt-get install libsdl1.2debian-all libsdl-image1.2 libsdl-mixer1.2 libsdl-net1.2 gettext libfreetype6
 
 
 
For both Dapper (6.06) and Breezy (5.10) the following will satisfy '''development''' dependencies
 
  apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev gettext libfreetype6-dev
 
  
Edgy needs automake1.9 also
+
To make sure Wesnoth >= 1.3.13 and svn head does build, too, you might need those:
apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev gettext libfreetype6-dev automake1.9
+
  apt-get install python-dev libboost libboost-iostreams-dev  
 
 
For Feisty,  
 
apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev gettext libfreetype6-dev  python-openal libopenal0a python2.5-openal libopenalpp-cvs1 libopenalpp-cvs-dev libopenal-dev openalpp-cvs-doc libghc6-openal-prof python2.4-openal (some of these, particularly the last few might be unecessary)
 
 
 
For Ubuntu Gutsy (7.10),
 
apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev gettext libfreetype6-dev
 
(if you havnt compiled anything before you probably also need apt-get install build-essential)
 
build from svn also needs
 
  apt-get install -y python-dev libboost-iostreams-dev libfribidi-dev
 
 
 
[From version 1.3.13 The above apt-get line for Gutsy seems to not satisfy the needed stuff: libboost is also needed.]
 
  
 
==  Sourcecode  ==
 
==  Sourcecode  ==
Line 92: Line 79:
  
 
'''Note: Users compiling SVN sources should 'make clean' before 'make' after any tree update.'''
 
'''Note: Users compiling SVN sources should 'make clean' before 'make' after any tree update.'''
 
I'm not sure, but according to the INSTALL file, you may want to 'make maintainer-clean' instead of 'make clean' for the SVN build.
 
  
 
- You can pass certain options to configure by the way, see the following example. It will install the whole game to /opt/games/wesnoth-1.2 and create the binary for the editor. The editor binary will be  called wesnoth_editor.
 
- You can pass certain options to configure by the way, see the following example. It will install the whole game to /opt/games/wesnoth-1.2 and create the binary for the editor. The editor binary will be  called wesnoth_editor.

Revision as of 20:59, 3 January 2008

[edit]Compiling Wesnoth

Platforms
Tools

Compiling Wesnoth

This page covers compilation on a Unix-like system. See also:

Forcemstr has cross compiled for Windows using the free mingw32 tools, running under Linux.

Here's documentation of another cross compilation attempt: CompilingWesnoth/CrossCompiling

For detailed instructions and full prerequisites, please consult the current INSTALL file in the source code.

NOTE: it seems the compilation of trunk has problems with Debian Sarge see [1]

Prerequisites

You need to have the development packages of these libraries and a compiler (such as gcc) installed to build Wesnoth. You will also need the runtime packages to actually run Wesnoth.

If you attempt to build from svn you will also need those packages:

  • autoconf >= 2.60
  • automake >= 1.9

The various SDL libraries can be found at http://www.libsdl.org

You can also get them from Freshmeat at http://freshmeat.net/projects/wesnoth -> Dependencies -> Download links

On all linux distributions that are based on Debian it should be enough to use this command:

apt-get build-dep wesnoth

To make sure Wesnoth >= 1.3.13 and svn head does build, too, you might need those:

apt-get install python-dev libboost libboost-iostreams-dev 

Sourcecode

You can get it here:

Compiling

If you have an older installation, first uninstall that by changing into its source directory (i.e. the directory where you unpacked the older package) and by typing:

$ make uninstall

(It's very likely that you'll need root privileges to uninstall. To do this, check the Installing section.)

Change directory by typing

$ cd ..

You may want to delete the older unpacked package. You can do that now (or later) by typing:

$ rm -r wesnoth-1.x

(If you do it later be sure that you don't erase the new unpacked package.)

Untar the new package:

$ tar xfjv wesnoth-1.x.tar.bz2

then change directory:

$ cd wesnoth-1.x

If you have downloaded from svn run autogen.sh

$ ./autogen.sh

Once you have unpacked the source and uninstalled the old version,

$ ./configure

(you might want extra arguments to configure, for instance to build the map editor or to install with prefix, if so see below). Finally, compile with

$ make

Note: Users compiling SVN sources should 'make clean' before 'make' after any tree update.

- You can pass certain options to configure by the way, see the following example. It will install the whole game to /opt/games/wesnoth-1.2 and create the binary for the editor. The editor binary will be called wesnoth_editor.

$ ./configure --prefix=/opt/games/wesnoth-1.2 --enable-editor

- You also can specify compiler options using enviroment variables. For example, if you want to build a version using optimization you would run the following before running ./configure. (Post 1.1.8 note: the default optimisation is now -O2)

$ CXXFLAGS="-O2" ; export CXXFLAGS

- If you would like to keep a version separated from other versions and attach a version suffix you could do this. In your users dir you will have the dir .wesnoth-1.2 for your preferences. The program itself will be called wesnoth-1.2 and the datadir will be the in the default path but named wesnoth-1.2. Remember that the path to the preferences dir is always relative. Absolut paths are not supported.

$ ./configure --with-preferences-dir=.wesnoth-1.2 --program-suffix=-1.2 --with-datadir-name=wesnoth-1.2

Some more configure options are shown when running ./configure --help.

Installing

Become superuser, so that you have permission to install.

$ su
  Password: /*doesn't show*/

Now that you have permission, install it.

# make install

or for smaller binaries,

# make install-strip

See also