Fandom

Freeciv

Building Freeciv from source

704pages on
this wiki
Add New Page
Talk1 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

This is a historic page, please remove the {{historic}} tag if you plan to revive it.

This page documents the steps necessary to build Freeciv from source, either from a prepackaged download, or direct from the project subversion repository.

Initial assumptionsEdit

These instructions assume the following about your system:

  • You are using a Unix or Unix-like operating system. This includes Unix, Linux, OSX, Cygwin and others.
  • You have a C compiler available, meeting the minimum C compiler requirements.
  • You have the zlib open source compression library, or compatible alternative installed.
  • You have the following GNU programs, or compatible alternatives installed:

If you intend to install from a prepackaged download, you will need one of the following file decompression/archive utilities, or compatible alternative.

If you intend to install from the subversion repository, or wish to rebuild the configuration script, you will need the following programs, or compatible alternatives installed:

If compiling for MinGW, you need the following dependencies:

  • Libcurl development files

Downloading and upackingEdit

Prepackaged downloadsEdit

If you have the GNU Wget utility, you can do this using one of the following commands:
wget http://sourceforge.net/projects/freeciv/files/Freeciv%202.2/2.2.1/freeciv-2.2.1.tar.bz2/download
wget http://sourceforge.net/projects/freeciv/files/Freeciv%202.2/2.2.1/freeciv-2.2.1.tar.gz/download
wget http://sourceforge.net/projects/freeciv/files/Freeciv%202.2/2.2.1/freeciv-2.2.1.zip/download
Note: If you have installed wget in a non-standard location, you may have to specify the full path the the executable.
  • Unpack the Freeciv distribution using the appropriate one of the following commands:
bunzip2 --stdout freeciv-2.2.1.tar.bz2 | tar tf -
gunzip --stdout freeciv-2.2.1.tar.gz | tar tf -
unzip freeciv-2.2.1.zip
Note: If you have installed bunzip2, gunzip, unzip or tar, in a non-standard location, you may have to specify the full path the the executable.
You should now have a new subdirectory called freeciv-2.2.1
  • Change into the newly-created directory:
cd freeciv-2.2.1

Subversion repositoryEdit

  • Check out the latest development version of Freeciv using subversion:
svn co svn://svn.gna.org/svn/freeciv/trunk freeciv-trunk
  • Change into the newly-created directory:
cd freeciv-trunk

Building the configuration scriptEdit

If you are building from a distribution package, the necessary configuration script should already be present, and you may choose to skip this stage and go straight to configuring the build

If autoconf has been installed in a non-standard location, you will need to set the PATH environment variable to allow the build process to find the executable. For example, if autoconf is installed in $HOME/install/autoconf, you will need:

PATH="$PATH:$HOME/install/autoconf/bin"

If automake has been installed in a non-standard location, you will need to set the PATH environment variable to allow the build process to find the executable. For example, if automake is installed in $HOME/install/automake, you will need:

PATH="$PATH:$HOME/install/automake/bin"

If libtool has been installed in a non-standard location, you will need to set the PATH environment variable to allow the build process to find the executable, and the ACLOCAL_FLAGS environment variable to allow autoconf to find the necessary macros to configure Freeciv's use of libtool. For example, if libtool is installed in $HOME/install/libtool, you will need:

PATH="$PATH:$HOME/install/libtool/bin"
ACLOCAL_FLAGS="-I $HOME/install/libtool/share/aclocal"; export ACLOCAL_FLAGS

If gettext has been installed in a non-standard location, you will need to set the PATH environment variable to allow the build process to find the executable. For example, if gettext is installed in $HOME/install/gettext, you will need:

PATH="$PATH:$HOME/install/gettext/bin"

You should now be able to build the configuration scripts:

./autogen.sh --no-configure-run

This will examine your system setup and build a suitable configuration script. A successful result should look something like this:

+ checking for autoconf >= 2.58 ... found 2.65, ok.
+ checking for autoheader >= 2.58 ... found 2.65, ok.
+ checking for automake >= 1.6 ... found 1.9, ok.
+ checking for aclocal >= 1.6 ... found 1.9, ok.
+ checking for libtoolize >= 1.4.3 ... found 2.2, ok.
+ checking for xgettext >= 0.10.36 ... found 0.18, ok.
+ checking for msgfmt >= 0.10.36 ... found 0.18, ok.
+ running aclocal ...
+ running autoheader ... 
+ running autoconf ... 
+ running libtoolize ... 
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `bootstrap'.
libtoolize: linking file `bootstrap/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: linking file `m4/libtool.m4'
libtoolize: linking file `m4/ltoptions.m4'
libtoolize: linking file `m4/ltsugar.m4'
libtoolize: linking file `m4/ltversion.m4'
libtoolize: linking file `m4/lt~obsolete.m4'
+ running automake ... 
configure.ac: installing `bootstrap/install-sh'
configure.ac: installing `bootstrap/missing'
ai/Makefile.am: installing `bootstrap/depcomp'
configure.ac:11: installing `bootstrap/config.guess'
configure.ac:11: installing `bootstrap/config.sub'
+ removing config.cache ... 

Now type 'configure' to configure freeciv.

DependenciesEdit

Freeciv requires the development libraries to be available for a number of other packages. If using Ubuntu, the following command will install the dependency packages used by the Ubuntu version of Freeciv:

sudo apt-get build-dep freeciv

Configuring the buildEdit

If zlib has been installed in a non-standard location, you will need to set the CFLAGS environment variable to allow the C compiler and linker to find the necessary files. For example, if zlib is installed in $HOME/install/zlib, you will need:

CFLAGS="$CFLAGS -I $HOME/install/zlib/include"; export CFLAGS
LDFLAGS="$LDFLAGS -L$HOME/install/zlib/lib"; export LDFLAGS

You will now need to run the configuration script, either as provide in the source code distribution, or built using the above instructions. To build just the Freeciv server, we will use the --enable-client=stub option.

You will need to decide where you want the Freeciv files installed. This is specified using the --prefix option. For example, if you want to install Freeciv in $HOME/install/freeciv you will need to specify --prefix=$HOME/install/freeciv.

Other configuration options are available, and are discussed elsewhere.

When you are ready, run configure with your chosen options. For example:

./configure --enable-client=stub --prefix=$HOME/install/freeciv

This will examine your system setup and build suitable makefiles. A successful result should look something like this:

Building FreecivEdit

Once everything is configured, building Freeciv should be straightforward. Run make:

make

This will build Freeciv.

Installing FreecivEdit

To install Freeciv to the directory which you specifed earlier, use make:

make install

This will install Freeciv.

Running the Freeciv serverEdit

The Freeciv requires access to certain runtime libraries in order to execute correctly. If these are installed in a standard location on your system, they should be found automatically.

If zlib has been installed in a non-standard location, you will need to set the LD_LIBRARY_PATH environment variable to allow the operating system to find the runtime libraries. For example, if zlib is installed in $HOME/install/zlib, you will need:

LD_LIBRARY_PATH="$HOME/install/zlib/lib:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH

To start the Freeciv server, simply run the executable from the directory into which it was installed, as specified when the build was configured. For example, if you installed Freeciv in $HOME/install/freeciv, you would run:

$HOME/install/freeciv/bin/freeciv-server

This will start the Freeciv server, and wait for user input. A successful result should look something like this:

This is the server for Freeciv version 2.2.99-dev
You can learn a lot about Freeciv at http://www.freeciv.org/
2: Loading rulesets
2: AI*1 has been added as Easy level AI-controlled player.
2: AI*2 has been added as Easy level AI-controlled player.
2: AI*3 has been added as Easy level AI-controlled player.
2: AI*4 has been added as Easy level AI-controlled player.
2: AI*5 has been added as Easy level AI-controlled player.
2: Now accepting new client connections.
 
For introductory help, type 'help'.
> 

To stop the server, type the following at the > prompt:

quit

Also on Fandom

Random Wiki