This is a generalized quide on how to download source files from SVN and compile a server (under different platforms) for local use or testing.

*nix

Requirements

It’s likely that many of these packages (listed alphabetically) are already installed on your system, but this list is a way to make sure. It’s important to have all the right packages in place before attempting any builds or compiles.

  • automake - A tool for generating GNU Standards-compliant Makefiles
  • flex - A fast lexical analyzer generator
    • m4 - a macro processing language (required by flex)
  • gcc - The GNU C compiler
  • libgd-tools - GD command line tools and example code
    • libgd2-noxpm - GD Graphics Library version 2 (without XPM support) (required by libgd-tools)
  • libgd2-xpm-dev - GD Graphics Library version 2 (development version)
  • libtool - Generic library support script
  • make - The GNU version of the “make” utility
  • subversion - advanced version control system (aka. svn)
    • libapr0 - the Apache Portable Runtime (required by subversion)
    • libsvn0 - shared libraries used by Subversion (aka. svn) (required by subversion)

As a quick reference:

sudo apt-get install automake flex gcc libgd-tools libgd2-xpm-dev libtool make subversion 

Recommended Packages

The recommended packages provide additional add-ons or features (summaries included, below) to the server or as a way to test new functions and features.

  • autoconf - automatic configure script builder (Not normally required for end-user builds, but it is useful if build scripts are not up to date)
  • check - unit test framework for C (used by the unit tests)
  • libsqlite3-0 - SQLite 3 shared library (used by cflogger)
  • libpython2.4 - Python shared object library (used by game features such as bank, post office, slot machines, etc.)
  • libpython2.4-devel - Required to compile python support into the server
  • libcurl3 - - Multi-protocol file transfer library (required by metaserver2)
  • libcurl4-openssl-dev - Development files and documentation for libcurl (OpenSSL) (required by metaserver2)
  • libsvn-dev - Development files for Subversion libraries (required for Subversion revision number reporting in metaserver2)

As a quick reference:

sudo apt-get install check autoconf libsqlite3-0 libcurl3 libcurl4-openssl-dev libsvn-dev

Installing Python and which version is still under investigation/discussion

  • lib64python2.4-2.4.3 is known to work on Mandriva 2007.0 x86_64
  • python2.4-dev is known to work on Ubuntu

Useful Packages

These useful packages are not normally required for end-user builds, but they come in handy in cases where developers may have forgotten to check in changes to build scripts, etc.

  • cproto - supports `make proto` to automatically update prototype files.
  • sudo - Provide limited super user privileges to specific users
    • Not required, but `sudo make install` is useful for installing to system directories.
    • sudo is also useful for installing packages that are missing.
    • Do not run `make` as the root user for security reasons.

START HERE

This is the starting point and confirms you are located in your home directory

 $ pwd
 /home/<username>

DOWNLOAD

  • Trunk contains the newest features and development for the game
  • Branch contains the most recent “stable” version of the game
  • Tags is an official & stable release of the game

IMPORTANT - One should be consistant with what they check out; meaning use all trunk server & archetypes & maps or branches/1.x server & archetypes & maps or tags/1.10.0 server & archetypes & maps otherwise you run the risk of incompatibilities (broken maps, missing graphics, etc.)

The follow steps will download the necessary files to your computer, which will be used to compile (or build) the server.

Trunk

$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/server/trunk server.svn
$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/maps/trunk maps.svn
$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/arch/trunk arch.svn

Branch

These steps have you download the most recent release candidate for branches/1.x

$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/server/branches/1.12 server.svn
$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/maps/branches/1.12 maps.svn
$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/arch/branches/1.12 arch.svn

Tag

Here’s how you download Tag and is using the 1.10.0 release as an example

$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/server/tags/1.10.0 server.svn
$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/maps/tags/1.10.0 maps.svn
$ svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire/arch/tags/1.10.0 arch.svn

SETUP

This confirms that you are still in your home directory

 $ pwd
 /home/<username>

Now change directory (hence the cd) to the directory that contains the server files

 $ cd server.svn

This confirms that you are in the server directory

 $ pwd
 /home/<username>/server.svn

This step “links” two directories to each other which makes the compile process more automated

 $ sudo ln -s /home/<username>/maps.svn maps

This step “links” two directories to each other which makes the compile process more automated and is used by the server once Crossfire server is up and running. This links the server to the map files which you downloaded earlier.

First, create the necessary directory tree for the map files with this command:

 $ sudo mkdir /usr/games/crossfire;sudo mkdir /usr/games/crossfire/share; sudo mkdir /usr/games/crossfire/share/crossfire

What that does, is it creates a directory located here: /usr/games/crossfire/share/crossfire

Now this step “links” two directories to each other which makes the compile process more automated

 $ sudo ln -s /home/<username>/maps.svn /usr/games/crossfire/share/crossfire/maps

Now change directory (hence the cd) to the directory that contains the library files

 $ cd lib

Double check that you are in the correct directory

 $ pwd
 /home/<username>/server.svn/lib

This step “links” two directories to each other which makes the compile process more automated. This links the arch or archetype files to the server files which you downloaded earlier.

 $ ln -s /home/<username>/arch.svn ./arch

Go back another directory

 $ cd ..

Double check that you are in the correct directory which is the server directory

 $ pwd
 /home/<username>/server.svn

COMPILE

Now you are going to begin the compile process; choose one of the following:

$ ./configure && make && sudo make install

Any missing dependencies, errors or similar problems during the compile process will be listed. Each should be addressed or resolved accordingly.

Optional: If you want to have more useful debugging information in case of crashes, set the CFLAGS environment variable to disable optimization (-O0) and enable debugging (-g): That is a uppercase letter O and a zero

$ CFLAGS="-O0 -g" ./configure && make && sudo make install

Optional: To disable the unit test or check when compiling the server, use ./configure –disable-check

$ ./configure --disable-check && make && sudo make install

Optional: To enforce the unit test or check when compiling the server, use make -k check

$ ./configure && make -k check && sudo make install

Recent SVN commit (~2007-Mar-30) changed the build process for the server; use the following command in the server root directory:

$ sh autogen.sh && make && sudo make install

autogen.sh script re-creates the configure (./configure) script while the rest of the command starts the compile (build) process. Pass the same options to autogen.sh as you would normally pass to ./configure since autogen.sh calls ./configure. This command requires both autoconf and automake to be installed.

LAUNCH

Once the server has been successfully built (aka compiled), you need to launch the Crossfire Server application

Double check that you are in the correct directory which is the server directory

 $ pwd
 /home/<username>/server.svn

Change directory the server directory

$ cd server

Your file directory path should look like this:

 $ pwd
 /home/<username>/server.svn/server

Run this command to launch the server:

$ ./crossfire-server &

What that command will do is run the Crossfire server and return you back to bash or shell prompt

Launch, Part2

As observed on 2008-June-08, launching the server using the method listed above does or might not work. It will result in an error and segmentation fault (unable to find hook cfapi_map_trigger_connected! Segmentation fault (core dumped) ). So, try launching the server this way from any directory:

$ ./crossfire &

FIXME - Confirm which method should be used to launch the server and if there is a difference between Trunk and Branches/1.x

FIXME – How to use crossloop for running the server; crossloop is a script that automatically restarts the server if/when it crashes and can also provide useful debugging or error information from the crash event.

Microsoft (c) Windows

The following tools are used to compile the server:

  • Microsoft Visual Studio 6 (service pack 4 probably). Server has not been tested with other versions.
    • you need it to build common/loader.c and random_maps/reader.c from their respective .l. Syntax is: flex -oloader.c -i loader.l, flex -oreader.c -i -P rm reader.l respectively. The -P rm seems to be required to not have duplicate symbol issues
  • Python to build the Python plugin. Any version starting from 2.3 should do the trick, if not report a bug please
  • if you want metaserver2 support, you’ll need:
    • libcurl, from http://http://curl.haxx.se/. You probably want this file.
    • pthread, obtained from http://www.sourceware.org/pthreads-win32/. Tested with pthreads-w32-2-8-0-release.exe
    • zlib, file zlib123-dll.zip from http://www.zlib.net/ (direct link)
    • copy the following files to the directory you’ll run Crossfire from: pthreadVC2.dll, zlib1.dll, libcurl.dll
    • define HAVE_CURL_CURL_H in the projects settings (project settings → C/C++ → general → preprocessor definitions)
    • link the executable to libcurl.lib and pthreadVC2.lib (project settings → link → general → object/library modules)
  • to build the installer, you need NSIS, and PERL (for maps installer).
  • to build archetypes, you need PERL
  • once you got the server sources, open a command prompt, go to make_win32 directory, run the installwin32.bat file. It will create required directories

The following tools are used to compile the client:

  • GTK. An installer with all required dependencies can be found at the Glade/GTK+ project. Warning: you’ll need to add ~10 directories to include list, and rename some files around (like copy libpng.lib to png.lib). Don’t ask why here, ask Glade/GTK+ project instead :)
  • current SVN (end of 2006) is somewhat broken, and requires some tweaking to build (need to undef HAVE_SDL, comment out lines, add files, and such). That may be fixed or not eventually.
  • if you want metaserver2 support, follow the same instructions as for the server.
 
crossfire_compile_guide.txt · Last modified: 2009/06/22 20:30 by leaf
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Debian Driven by DokuWiki