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.
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.
As a quick reference:
sudo apt-get install automake flex gcc libgd-tools libgd2-xpm-dev libtool make subversion
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.
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
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.
This is the starting point and confirms you are located in your home directory
$ pwd /home/<username>
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.
$ 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
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
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
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
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.
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
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 &
- Confirm which method should be used to launch the server and if there is a difference between Trunk and Branches/1.x
– 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.
The following tools are used to compile the server:
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 issuespthreadVC2.dll, zlib1.dll, libcurl.dllHAVE_CURL_CURL_H in the projects settings (project settings → C/C++ → general → preprocessor definitions)libcurl.lib and pthreadVC2.lib (project settings → link → general → object/library modules)make_win32 directory, run the installwin32.bat file. It will create required directoriesThe following tools are used to compile the client:
libpng.lib to png.lib). Don’t ask why here, ask Glade/GTK+ project instead :)undef HAVE_SDL, comment out lines, add files, and such). That may be fixed or not eventually.