PlaneShift Compiling Guide

Select your OS, compiler, target (laanx compatible or developer), and build type:

Building PS:

Source Revisions
Working Directory
Install Tools
Download Sources
Compile Sources
Setup Server (optional)
Mini Scripts (optional)
Mounting External Art (optional)
Getting Help

MinGW32 is a free, open source compiler with an associated toolset that can be used for compiling Win32 executables. In conjunction with other free or open source software the majority of PlaneShift can be compiled under Windows without having to purchase any compiler or other licenses.

Credits
Arianna Benigno, maintained the guide;
Rolenun, adjuster for good part of the content;
Dave Garrett, author of the new compiling guides layout;
Steve Cook, author of the guide to compiling with Mingw32.
This guide lists the steps necessary to download all the tools and compile PlaneShift. This guide assumes that Visual C++.NET or Visual Studio.NET is installed. Some tools need glut, Directx 9 SDK, and python. These features are not needed so they won't be covered here. As a result there will be some compilation errors due to missing files.

Credits
Arianna Benigno, maintained the guide;
Rolenun, adjuster for good part of the content;
Dave Garrett, author of the new compiling guides layout;
Chris Ayers, author of the first guide for MSVC;
Steve Cook, author of the guide to compiling with Mingw32, on which the first MSVC guide was based.
This guide gives a fairly detailed description on how to get a working client up and running in Linux. It gives instructions on how to get all the required tools and how to check out the source code and configure it. At the end there you will have a PlaneShift client and a PlaneShift updater application, and if you want also the server.

Credits
Arianna Benigno, maintained the guide;
Dave Garrett, author of the new compiling guides layout;
Andrew Craig, author of the first Linux guides that were available on Laanx website;
Platyna, author of the first compiling guide for Slackware distribution.
Mike Gist, author of the static compiling guide.

We have no Mac guide at this time. Check the Linux guide, or refer to PSDocs, a user maintained guide.

Last Update

This guide has been update by UPDATE_AUTHOR, the UPDATE_DATE.

Source Dates:

Make sure you get the correct dates required for the version of PS you are building.
Note that different versions of PS require different CS/CEL revisions, and PS revisions
after those listed here may not be compatible with the public server.

Currently compatible with Laanx:
CAL3D SVN revision: CAL3D_SOURCE_REV
CS 1.2 SVN revision: CS_SOURCE_REV
CEL 1.2 SVN revision: CEL_SOURCE_REV

Currently compatible with trunk of PS:
CAL3D SVN revision: CAL3D_SOURCE_REV_HEAD
CS 1.2 SVN revision: CS_SOURCE_REV_HEAD
CEL 1.2 SVN revision: CEL_SOURCE_REV_HEAD

If you want to use latest PS (HEAD) for testing or developing purposes:
CS V1.2 SVN revision for latest PS: CS_SOURCE_REV_HEAD
CEL V1.2 SVN revision for latest PS: CEL_SOURCE_REV_HEAD
Note that this version of PS is NOT compatible with Laanx, yet.

Set Working Directory

The first step is to create your development directory. If you want to choose a specific directory, you can do that, however this guide will assume you use:

/home/user/development/

Many people get confused here because they copy and paste commands which contain this path. User generally refers to your username. The above path is only useable if you create it manually.

C:\development\

/home/user/development

Note that in MinGW/MSYS paths are written as follows:

/c/development/

Install Tools

Platform SDK for MSVC 8

This step is necessary if you are using VC8 Express Edition. You should download and install the Platform SDK from this location:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
Remember to follow all the listed steps to get things working: this includes to update the directories for Visual C++ and edit corewin_express.vsprops as indicated.

MSVC 8 Full Edition

If you are using this version of the build environment, you need to update it with the Service Pack 1!

MinGW32 and MSYS

The MinGW package contains the compiler, header and lib files.
The MSYS package contains the shell and make utility.
The MSYSDTK package contains autoconf, automake, libtool, autogen, guile, SVN, openssl, openssh, inetutils, perl and vim.
Because autoconf and automake will be outdated, we will manually update them.
Also, With MinGW version 4.1.0.0, some of the BinUtils included are broken by default so we're fixing that.

First, we'll get MinGW and a few necessary dependencies.
Note: These are the minimum required packages for the MinGW build.
Go here: http://prdownloads.sourceforge.net/mingw/ and fetch:

MinGW [bin] MinGW-4.1.0.exe
MSYS [bin] MSYS-1.0.10.exe
MSYS DTK [bin] msysDTK-1.0.1.exe
GDB [bin] gdb-5.2.1-1.exe (Optional)
MSYS Autoconf [bin] msys-autoconf-2.59.tar.bz2
MSYS Automake [bin] msys-automake-1.8.2.tar.bz2
BinUtils [bin] binutils-2.16.91-20060119-1.tar.gz

Run the exe files in the order they were downloaded to install the compiler and unzip the conf/make utilities in c:\msys\1.0\.
Then unzip the BinUtils to the c:\mingw directory.
Unzipping the tar.bz2 archives needs to be done through the MSYS command-line by changing directory with the cd command to where you downloaded the files. Then, run the following commands: tar -xjf msys-autoconf-2.59.tar.bz2 -C /c/msys/1.0
tar -xjf msys-automake-1.8.2.tar.bz2 -C /c/msys/1.0
tar -xzf binutils-2.16.91-20060119-1.tar.gz -C /c/MinGW

This allows MSYS to setup the MinGW paths correctly.
The installation program should also add an icon for MSYS to your start menu.
Click the "MSYS" icon and it should open up a shell window. Type "exit" to close the shell window again.

Download the following dependencies from the same site, but do not install these yet. Their install instructions are included.
From explorer, create and place these dependencies into C:\msys\1.0\src. Also, create the C:\msys\1.0\local directory.

freetype-2.1.9-mingwPORT.tar.bz2
jpeg-6b-mingwPORT.tar.bz2
zlib-1.2.3-mingwPORT.tar.bz2
wget-1.9.1-mingwPORT.tar.bz2

The following dependencies use a scripted system to download and install them, built into their files.
For the unanswered questions below, just press enter to accept the default (in parentheses).

Installing wget

The input listed by the mingwPORT.sh script assumes that there is a file called wget-1.9.1.tar.gz in /usr/src, but the file you do have is wget-1.9.1-mingwPORT.tar.bz2.
There seems to be two solutions to this problem, you can choose the one your prefer the most:
1)Download the file from here and put it in /usr/src before running the mingwPORT.sh script
2)Just copy the prebuilt wget instead of compiling it instead of typing "mingwPORT.sh" (see the command list below) to run the script type "cp wget.exe /mingw/bin" and then continue as indicated.

$ tar -jxvf wget-1.9.1-mingwPORT.tar.bz2
$ cd wget-1.9.1/mingwPORT
$ ./mingwPORT.sh
Download file? (Yes) No
Unarchive file? (Yes)
Archive file type? (tar.gz)
Archive file? (wget-1.9.1.tar.gz)
Archive file path? (/tmp) /c/distro
Source path? (/usr/src/wget-1.9.1)
Installation directory? (/mingw)
CFLAGS (-O3 -s -mms-bitfields -march=i686)

Installing zlib

$ tar -jxvf zlib-1.2.3-mingwPORT.tar.bz2
$ cd zlib-1.2.3/mingwPORT
$ ./mingwPORT.sh
Download file? (Yes)
Download file URI? (http://www.zlib.net)
Archive file type?
      0) unknown
      1) tar.gz
      2) tgz
      3) tar.bz2
      4) tbz2
      5) zip
Select a numeric value: (3)
Archive file? (zlib-1.2.3.tar.bz2)
Download to path? (/tmp) /usr/src
Source path? (/usr/src/zlib-1.2.3)
Installation directory? (/mingw)
CFLAGS (-O3 -s -mms-bitfields -march=i686)

Installing JPEG Support

$ tar -jxvf jpeg-6b-mingwPORT.tar.bz2
$ cd jpeg-6b/mingwPORT
$ ./mingwPORT.sh
Download file? (Yes)
Download file URI? (ftp://ftp.uu.net/graphics/jpeg)
Archive file type?
      0) unknown
      1) tar.gz
      2) tgz
      3) tar.bz2
      4) tbz2
      5) zip
Select a numeric value: (1)
Archive file? (jpegsrc.v6b.tar.gz)
Download to path? (/tmp) /usr/src
Source path? (/usr/src/jpeg-6b)
Installation directory? (/mingw)
CFLAGS (-O3 -s -mms-bitfields -march=i686)

Installing LibPNG Support
Go to LibPNG's homepage to get the latest source distribution.
We'll be using libpng-1.2.12.tar.bz2
Do not use the mingwPORT file. It is very outdated and no longer works.
Put this file in the /usr/src directory as well.

$ tar -jxvf libpng-1.2.12.tar.bz2
$ cd libpng-1.2.12
$ ./configure
$ make
$ make install

Installing FreeType2 Support

$ tar -jxvf freetype-2.1.9-mingwPORT.tar.bz2
$ cd freetype-2.1.9/mingwPORT
$ ./mingwPORT.sh
Download file? (Yes)
SF Mirror (Yes)
Which mirror from the list do you wish to use?
      0) none (Oops, I wish to cancel)
      1) jaist (JP)
      2) puzzle (CH)
      3) nchc (TW)
      4) easynews (US)
      5) ovh (FR)
      6) belnet (BE)
      7) citkit (RU)
      8) cogent (US)
      9) voxel (US)
      10) kent (UK)
      11) heanet (IE)
      12) switch (CH)
      13) mesh (DE)
      14) optusnet (AU)
Select a numeric value: (0) 4
Archive file type?
      0) unknown
      1) tar.gz
      2) tgz
      3) tar.bz2
      4) tbz2
      5) zip
Select a numeric value: (3) 3
Archive file? (freetype-2.1.9.tar.bz2)
Download to path? (/tmp) /usr/src
Source path? (/usr/src/freetype-2.1.9)
Installation directory? (/mingw)
CFLAGS (-O3 -s -mms-bitfields -march=i686)

Set Environment Variables

Right-Click My Computer on your desktop and choose Properties. Under Advanced choose Environmental Variables. Click New under either User or System variables depending on how you want it setup. If you choose System, you will have to log off to make the changes.

Variable Name: CRYSTAL (all caps)
Variable Value: C:\development\cs

Variable Name: CEL (all caps)
Variable Value: C:\development\cel

Before compiling each time in MinGW, you will also need to enter at the MSYS prompt:

export CEL=/c/development/cel
export CRYSTAL=/c/development/cs
export CSCONFPATH=/c/development/cel

Jam

You will need a tool called Jam. Jam is a replacement for make. It's a bit easier to maintain and create custom builds. If you do not already have Jam, you can find it at ftp://ftp.perforce.com/pub/jam/ - install it system wide. You can also use your distro's package manager to install it.

SVN

CS, CEL and PlaneShift use SVN for their source repositories, so you'll need that too.
You can find the software at: http://subversion.tigris.org/
A GUI is available at: http://esvn.umputun.com/ You can also use your distro's package manger to install it.

SVN client

PS, CS and CEL use SVN for their source repositories, so you will need an SVN client.
The SVN client for Windows is TortoiseSVN.

Note: This section is incomplete and untested, but contains the Gentoo specific build information that was previously in the manual.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

via portage: #emerge jam

Note: This section is incomplete and untested, but contains the Slackware specific build information that was previously in the manual.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

BOTH of these above commands are assuming you do not need a server, if you do please follow directions in the mysql section for installing other required packages before moving on to building to save you time.

The instructions here are tested using Ubuntu Feisty Fawn and Ubunty Gutsy Gibbons.
Since Feisty Fawn and Gutsy Gibbons are installed by default with minimal packages, many required packages for this project are not available.
To correct this, you will first need to enable the universe and multiverse repositories.
To enable these, do the following:

# sudo gedit /etc/apt/sources.list

Delete everything in the file that you have not added yourself. If you are not running Gutsy Gubbons, replace each instance of the word "gutsy" with the name of the distro you are using, i.e. hoary, warty, dapper, or edgy. Got that? Ok, Paste the following into the file and save it. Be sure to make the necessary changes if you are running a different version than Gutsy:

# Ubuntu supported packages
# GPG key: 437D05B5
deb http://us.archive.ubuntu.com/ubuntu gutsy main restricted
deb http://us.archive.ubuntu.com/ubuntu gutsy-updates main restricted
deb http://security.ubuntu.com/ubuntu gutsy-security main restricted

# Ubuntu community supported packages
# GPG key: 437D05B5
deb http://us.archive.ubuntu.com/ubuntu gutsy universe multiverse
deb http://us.archive.ubuntu.com/ubuntu gutsy-updates universe multiverse
deb http://security.ubuntu.com/ubuntu gutsy-security universe multiverse

# Ubuntu backports project
# GPG key: 437D05B5
deb http://us.archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse


Now we need to double check that the gpg keys are added correctly to avoid gpg errors. Sounds scary, but worry not! All it takes is one simple command:

# gpg --keyserver hkp://subkeys.pgp.net --recv-keys 437D05B5 && gpg --export --armor 437D05B5 | sudo apt-key add -

After that we need to refresh our sources.list file like so:

# sudo apt-get update

Once that is complete, we can fetch all the required packages using the following command:

# sudo apt-get --assume-yes install libjpeg62-dev x11proto-gl-dev autoconf jam bison flex-old automake1.9 libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng12-dev build-essential libtool libglu1-mesa-dev xserver-xorg-dev libxt-dev libopenal0a libopenal-dev subversion zlibc libttf2 libfreetype6-dev libfreetype6 libasound2-dev alsa-oss libxxf86vm-dev libxext-dev x11proto-xext-dev

If you are on Gutsy use this command

# sudo apt-get --assume-yes install libjpeg62-dev x11proto-gl-dev autoconf jam bison flex-old automake1.9 libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng12-dev build-essential libtool libglu1-mesa-dev libglu1-xorg-dev xserver-xorg-dev libxt-dev libopenal0a libopenal-dev subversion zlibc libttf2 libfreetype6-dev libfreetype6 libasound2-dev alsa-oss libxxf86vm-dev libxext-dev x11proto-xext-dev

BOTH of these above commands are assuming you do not need a server if you do please follow directions in the mysql section for installing other required packages

Note: This section is incomplete and untested, but contains the Debian specific build information that was previously in the manual.

Due to the number of dependencies needed, if you wish to read the homepage listing, or dependency description please select Linux's generic dropdown selection.

via apt-get: #apt-get install jam svn build-essentials libfreetype6-dev libasound2-dev

If you are using Debian testing (which uses X.Org), then you need xlibmesa-gl-dev instead of xlibmesa-glu-dev.

Debian: #apt-get install xlibmesa-glu-dev

Testing: #apt-get install xlibmesa-gl-dev

Also, if you have flex, bison or automake other than automake1.8 installed, they should be uninstalled. They would conflict with the older versions flex-old, bison1.35 and automake1.8 needed to compile PlaneShift.

#apt-get install libtool bison-1.35 flex-old autoconf automake1.8

#apt-get install libmng-dev libmikmod2-dev libogg-dev libvorbis-dev zlib1g-dev libpng3-dev libjpeg62-dev python2.3-dev

BOTH of these above commands are assuming you do not need a server if you do please follow directions in the mysql section for installing other required packages

nVidia Toolkit

Since Crystal Space needs it (independently from your graphic card, so even if you have an ATI card), you should download from www.nvidia.com the nvidia-toolkit. Download the appropriate version for your architecture—either x86 or x86-64. Make sure to use the appropriate file based on your chipset. To install the file, place it in the root directory and use the following command, then delete the tar.gz file.

tar -zxvf Cg-1.5_x86*.tar.gz
tar -zxvf Cg-1.5_x86*.tar.gz
tar -zxvf Cg-1.5_x86*.tar.gz
If you are on Gutsy you can

# sudo apt-get install nvidia-cg-toolkit

Otherwise you MUST do this

# wget -c http://developer.download.nvidia.com/cg/Cg_1.5/1.5.0/Cg-1.5_x86.tar.gz

# sudo mv Cg-1.5_x86*.tar.gz /

# cd /

# sudo tar -zxvf Cg-1.5_x86*.tar.gz

# sudo rm Cg-1.5_x86*.tar.gz

Via portage: # emerge nvidia-cg-toolkit

Server Databases

Optional section

MySQL:
If you have the intentions to run the server you have to install
MySQL as well. PlaneShift uses MySQL version 5.0.

For your distro install the mysql package and the -dev package, It might be named mysql-dev or libmysqlclient-dev or something similar.

If after building if you see that mysql was not found when running the server and you get the following error: WARNING: could not load plugin 'planeshift.database.mysql' make sure you have the dev package installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

for Feisty via apt-get: # sudo apt-get --assume-yes install libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client-5.0 mysql-server-5.0 libmysqlclient15-dev libmysqlclient15off

for Gutsy via apt-get: # sudo apt-get --assume-yes install libdbd-mysql-perl libdbi-perl libnet-daemon-perl libplrpc-perl mysql-client-5.0 mysql-server-5.0 libmysqlclient15-dev libmysqlclient15off

If after building if you see that mysql was not found when running the server and you get the following error: WARNING: could not load plugin 'planeshift.database.mysql' make sure you have libmysqlclient15-dev installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

via portage: #emerge mysql

You need to make sure you have libmysqlclient-dev and mysql-server installed for your server to run correctly

If after building if you see that mysql was not found when running the server and you get the following error: WARNING: could not load plugin 'planeshift.database.mysql' make sure you have libmysqlclient-dev installed, if it was not installed, ./autogen.sh, ./configure, and recompile the server again, according to the documentation below.

From the download page, select the Community Server option. You will end up in another page where you should select one of the available Windows downloads between Windows (x86) ZIP/Setup.EXE and the Without Installer version. It is recommend to select the "Without Installer version", since you have just to unzip the file in c:\ and rename the folder (which should resemble mysql-5.0.xx) to simply mysql. At the end of these steps, you should have: c:\mysql\

Also, we need to create MinGW compatible libraries from the standard Microsoft compatible libraries that ship with MySQL. Read the FAQ for mingw32 under the section "How can an MSVC program call a MinGW DLL, and vice versa?" You will find reimp here: http://wyw.dcweb.cn/reimp_new.zip
Copy the reimp.exe file to your /c/mingw/bin directory.
Open an msys prompt, cd to the /c/mysql/lib/debug directory and do the following:

reimp -d libmysql.lib
dlltool -k -d LIBMYSQL.def -l libmysqlclient.a
rm LIBMYSQL.def
mv libmysqlclient.a ..

WordNet:
You will also need the WordNet dictionaries. Download and install the WordNet binaries, version 2.1.

via apt-get: # sudo apt-get --assume-yes install wordnet-base wordnet

Download Source Code

Cal3D

We need to build cal3d from source before we can start on Crystal Space. Cal3d is a library that is used for handling skeleton systems. This is a very nice system and can allow for fluid transformations between animations. This needs to be built/installed first because when we configure Crystal Space it has to find the cal3d libraries so it can know to build the sprcal3d plugin. Cal3D doesn't change much, so just download latest stable or checkout latest from svn:

Cal3D Home

/home/user/development$ svn co -r CAL3D_SOURCE_REV svn://svn.gna.org/svn/cal3d/trunk/cal3d cal3d

Crystal Space (CS)

Crystal Space 3D SDK is the engine that we use for rendering and sound.

/home/user/development$ svn co -r CS_SOURCE_REV https://crystal.svn.sourceforge.net/svnroot/crystal/CS/branches/release/V1.2 cs

/home/user/development$ svn co -r CS_SOURCE_REV_HEAD https://crystal.svn.sourceforge.net/svnroot/crystal/CS/branches/release/V1.2 cs

Crystal Entity Layer (CEL)

CEL is a layer on top of Crystal Space that is used for entity and behavior control.

/home/user/development$ svn co -r CEL_SOURCE_REV https://cel.svn.sourceforge.net/svnroot/cel/cel/branches/release/V1.2 cel

/home/user/development$ svn co -r CEL_SOURCE_REV_HEAD https://cel.svn.sourceforge.net/svnroot/cel/cel/branches/release/V1.2 cel

PlaneShift

Lastly, download our source:

/home/user/development$ svn co https://planeshift.svn.sourceforge.net/svnroot/planeshift/stable planeshift

/home/user/development$ svn co https://planeshift.svn.sourceforge.net/svnroot/planeshift/trunk planeshift

Updating Sources

From time to time, newer PlaneShift revisions will require you to upgrade your cal3d, CS, and CEL repositories to a newer revision as well. To update your supporting libraries, always be certain that you use the "-r" option keep from updating to the latest revision:

If you want to update to a new revision replace REVISON with the number of the revision you want to use:

/home/user/development/cal3d$ svn update -r REVISION
/home/user/development/cs$ svn update -r REVISION
/home/user/development/cel$ svn update -r REVISION

Unlike the supporting libraries, you will generally want to use the latest PlaneShift source (or the HEAD) rather than an intermediate revision. In this case, you will omit the "-r" option like so:

/home/user/development/planeshift$ svn update


If, for some reason, you wish to update any of the supporting libraries to the latest version (i.e. the HEAD), you have to remove the sticky date tag. WE DO NOT RECOMMEND THIS as it may break your build:

/home/user/development/cal3d$ svn update -r HEAD
/home/user/development/cs$ svn update -r HEAD
/home/user/development/cel$ svn update -r HEAD

If you update a repository, you will need to recompile that repository and each repository that depends on it. Before doing so, you should do a "jam clean" for each project you want to jam again. So, for example, if you want to rebuild PS you will do:

/home/user/development/planeshift$ jam clean
/home/user/development/planeshift$ jam -aq

Crystal Space (CS)

Crystal Space is the 3D Software Development Kit (SDK) that is used in PlaneShift mainly for rendering and sound.

Right-click on the development directory and select "SVN Checkout". Specify the URL as:

https://crystal.svn.sourceforge.net/svnroot/crystal/CS/branches/release/V1.2

Specify the checkout directory as "C:\development\CS", select "Revision", and paste the current CS revision number: CS_SOURCE_REV_HEAD

CS Windows Libraries

Rather than having to install CS dependant components manually, Microsoft Visual C++, MinGW/MSYS and Cygwin users can download a single package which contains all common headers, pre-built library files, and dynamic link libraries in pre-compiled form from the Crystal Space website, http://www.crystalspace3d.org/.

The latest version of such libraries is available at:

http://www.crystalspace3d.org/downloads/cs-win32libs/
http://www.crystalspace3d.org/downloads/cs-win32libs/static/
The currently used CS revision needs version LIBS_VER. Don't mix up with other versions!

Run the program and install the libraries. The Default name is fine.

Run the program and install the libraries in C:\CSLibs.
This helps to trim down the length of the CEL linker flag list.

When it asks you for the CS directory, enter C:\development\CS.
When you have to select the components, you can select the options you prefer through the check boxes.

Be sure that you are selecting also the MinGW Win32 Libraries and the support files for MSYS and Cygwin.
Be sure that you are selecting also the MSVC Win32 Libraries and the support files for your version of MSVC.
Be sure that you are installing both DirectX 9 headers and libraries files.
Continue the installation. If this is the first time you are installing the libraries and you do not yet have an SVN checkout of CS uncheck 'Copy DLL's to CS directory' when prompted, otherwise check the box and set the dir to C:\development\CS. To copy the files later, you can do so via the option in the folder from the start menu.
Make sure 'Set up MSYS support' is checked when prompted.

Make sure 'Set up VisualC support' is checked when prompted.

You should now copy your CS Win Libs DLLs over to your new CS directory, if you haven't done that earlier, during the installation of the CS Winlibs. Goto the start menu, go to Programs and then to CrystalSpace Win32 libraries. Select "Copy DLLs to a CS directory". Set the directory to C:\development\CS when prompted.

Next, copy CrystalSpaceLibs MinGW directory into a new generic directory.

Crystal Entity Layer (CEL)

CEL is a layer on top of Crystal Space that is used for entity and behaviour control.

Right-click on the development directory and select "SVN Checkout". Specify the URL as:

https://cel.svn.sourceforge.net/svnroot/cel/cel/branches/release/V1.2

Specify the checkout directory as "C:\development\cel", select "Revision", and paste the current CEL revision number: CEL_SOURCE_REV_HEAD

PlaneShift

Lastly, download PlaneShift source code:

Right-click on the development directory and select "SVN Checkout".
Enter the following as the URL:

https://planeshift.svn.sourceforge.net/svnroot/planeshift/stable

https://planeshift.svn.sourceforge.net/svnroot/planeshift/trunk

Updating Sources

If in the future you have the intentions to update cal3d, CS, CEL or PS because the team has decided to use another revision or because you feel like you want to update it, instead of doing a checkout you have simply to update. Please, remember that CS, and CEL must be the exact revision specified above (or near the top of this guide) while PS can be newer.

CS and CEL SVNs:
Right-click on the folder of the module you want and goto TortoiseSVN->"Update to Revision". Enter a new revsion number or select HEAD to get latest, there is a possibility that HEAD may not work with with PS so keep that in mind. Click ok, and the files will be updated.

PlaneShift
Right-click on the PlaneShift folder and click "SVN Update".

No guide yet. Try the Linux version for now.

Compile the Code

Cal3D

Since cal3d is a library in development we probably don't want to 'install' this one as root since there is a good possibility it will change in the future. Instead we will 'install' it into our working directory. This is done by using the --prefix option when we configure it.

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

/home/user/development/cal3d$ autoreconf --install --force
/home/user/development/cal3d$ ./configure --prefix=/home/user/development/cal3d
/home/user/development/cal3d$ make
/home/user/development/cal3d$ make install

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

/home/user/development/cal3d$ autoreconf --install --force
/home/user/development/cal3d$ ./configure --prefix=/home/user/development/cal3d
/home/user/development/cal3d$ make
/home/user/development/cal3d$ make install

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

/home/user/development/cal3d$ autoreconf --install --force
/home/user/development/cal3d$ ./configure --prefix=/home/user/development/cal3d
/home/user/development/cal3d$ make
/home/user/development/cal3d$ make install

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

/home/user/development/cal3d$ autoreconf --install --force
/home/user/development/cal3d$ ./configure --prefix=/home/user/development/cal3d
/home/user/development/cal3d$ make
/home/user/development/cal3d$ make install

Using a text editor open configure.in and remove the line

AM_USE_UNITTESTCPP

/home/user/development/cal3d$ autoreconf --install --force
/home/user/development/cal3d$ ./configure --prefix=/home/user/development/cal3d
/home/user/development/cal3d$ make
/home/user/development/cal3d$ make install

Because we did not install cal3d we need to make sure other things can find it. This is done using the LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/home/user/development/cal3d/src/cal3d/.libs/:$LD_LIBRARY_PATH

Crystal Space (CS)

Now we can build it and use the configure line to tell it where we installed the cal3d libraries. To do this, use the prefix line that was used for Cal3d above.

/home/user/development/cs$./configure --without-java --without-perl --without-python --without-lib3ds --with-cal3d=/home/user/development/cal3d

/home/user/development/cs$ jam -aq libs plugins cs-config walktest

/home/user/development/cs$ jam -aq libs staticplugins cs-config walktest_static
/home/user/development/cs$ ./configure --without-java --without-perl --without-python --without-lib3ds --with-cal3d=/home/user/development/cal3d

/home/user/development/cs$ jam -aq libs plugins cs-config walktest

/home/user/development/cs$ jam -aq libs staticplugins cs-config walktest_static
/home/user/development/cs$ ./configure --without-java --without-perl --without-python --without-lib3ds --with-cal3d=/home/user/development/cal3d

/home/user/development/cs$ jam -aq libs plugins cs-config walktest

/home/user/development/cs$ jam -aq libs staticplugins cs-config walktest_static
/home/user/development/cs$ ./configure --without-java --without-perl --without-python --without-lib3ds --with-cal3d=/home/user/development/cal3d

/home/user/development/cs$ jam -aq libs plugins cs-config walktest

/home/user/development/cs$ jam -aq libs staticplugins cs-config walktest_static
/home/user/development/cs$ ./configure --without-python --without-java --without-lib3ds --without-libaws --with-libcal3d=/home/user/development/cal3d

/home/user/development/cs$ jam -aq libs plugins cs-config walktest

/home/user/development/cs$ jam -aq libs staticplugins cs-config walktest_static

We should add the CRYSTAL environment variable to the .bashrc file so applications outside the Crystal Space tree know where to find the .so's.

export CRYSTAL=/home/user/development/cs

Crystal Entity Layer (CEL)

/home/user/development/cel$ ./configure --without-python
/home/user/development/cel$ jam -aq libs plugins cel-config
/home/user/development/cel$ jam -aq libs staticplugins cel-config

We should add the CEL environment variable to the .bashrc file so applications outside the CEL tree know where to find the .so's.

export CEL=/home/user/development/cel

PlaneShift

/home/user/development/planeshift$ ./autogen.sh
/home/user/development/planeshift$ ./configure --with-cal3d=/home/user/development/cal3d
/home/user/development/planeshift$ ./configure --enable-debug --with-cal3d=/home/user/development/cal3d
/home/user/development/planeshift$ jam -aq client
/home/user/development/planeshift$ jam -aq client_static

If you also want to build the server, do this as well:

/home/user/development/planeshift$ jam -aq server

/home/user/development/planeshift$ jam -aq server_static

If you want to build the extra tools, just do "jam -a".
No guide yet. Try the Linux version for now.

Run MSYS from the start menu to open the shell. Be aware that if you have MSYS opened already, you need to restart the console, otherwise many things won't be found during the build process. Make sure you run the export commands to set the environment variables again

Crystal Space (CS)

Switch to the Crystal Space source dir using 'cd /c/development/cs'. Configure to debug mode and jam. (if you wish to build in optimized mode, just run configure without any arguments) If you chose to build cal3d, rather than use it from the CS win libs, you can specify its location with: --with-cal3d=/c/development/cal3d/

./configure --without-java --without-perl --without-python --without-lib3ds
jam -aq libs plugins cs-config walktest
jam -aq libs staticplugins cs-config walktest_static

This will build all the needed libraries and plugins, as well as the standard test application.
After everything compiles, try running "walktest.exe" in /c/development/cs to check that everything is ok.

Crystal Entity Layer (CEL)

Change your working directory to CEL's, and do:

./configure --without-python
jam -aq libs plugins cel-config
jam -aq libs staticplugins cel-config

You can test this build by running the demo application "celtst.exe" in /c/development/cel to check that everything is ok.

PlaneShift

If you chose to build cal3d, rather than use it from the CS win libs, you can specify its location after the configure command with: --with-cal3d=/c/development/cal3d/
Change your working directory to PS's, and do:

./autogen.sh
./configure
./configure --enable-debug

Sometimes when compiling with GCC it says the list of linker flags for CEL is too long. Many of the flags are just duplicates and can be removed. The box below can be used to do it for you automatically.


You must paste the content of the file Jamconfig (all of it, no need to find the right line) and click "Fix flags", then just copy it back to the file.

jam -aq client
jam -aq client_static

If you're building the server, you also need to configure with your MySQL location:

./autogen.sh
./configure --enable-debug --with-mysqlclient=/c/mysql

jam -aq server

jam -aq server_static

If you want to build the extra tools, just do "jam -a".

This should compile PlaneShift.

Setup MSVC Environment

Note for MSVC 2005 (also known as Visual Studio 8.0, MSVC 8.0 or Visual Studio .NET 2005) (Full Edition Only): Make sure the "Show all settings" checkbox is checked in Tools->Options before continuing.
If you have MSVC 2003, you might know it as MSVC 7.1, Visual Studio 7.1 or Visual Studio .NET 2003. Here we will add all the directories containing all the include and libraries files that we will need to use for compiling PlaneShift.
Under Tools->Options in you MSVC look on the left hand side for the Projects folder. Under Projects choose "VC++ Directories". In the "Show Directories for" choose "Include Files". Click the new folder icon and add the following directories, one by one:

C:\development\CS\include
C:\development\CS\include\csutil\win32
C:\development\cel\include
C:\mysql\include

In the "Show Directories for" choose "Library Files". Click the new folder icon to add the following directories:

C:\mysql\lib\opt

Crystal Space (CS)

If you have MSVC 7.0 open C:\development\CS\mk\msvc7\wkstypical.sln
If you have MSVC 7.1 open C:\development\CS\mk\msvc71\wkstypical.sln
If you have MSVC 8.0 open C:\development\CS\mk\msvc8\wkstypical.sln
If you have MSVC 7.0 open C:\development\CS\mk\msvc7\wksstatic.sln
If you have MSVC 7.1 open C:\development\CS\mk\msvc71\wksstatic.sln
If you have MSVC 8.0 open C:\development\CS\mk\msvc8\wksstatic.sln

Make sure that your specific 'msvc' folder has the 'read only' box unchecked (right click on the folder and select Properties, 'read only' is one of the attributes in the General tab) before continuing.

Go into the 'Build' menu, and select 'configuration manager'. Change the 'Active Solution Configuration' to 'Release(static libs)'.
Right click on the solution and select 'Build Solution'. To test the build of CS, run walktest.exe in C:\development\CS.
If you encounter any errors, check you have done everything correctly, and then if the problem persists, you can ask for help in the CS IRC channel:
irc.freenode.net #crystalspace

Crystal Entity Layer (CEL)

If you have MSVC 7.0 open C:\development\cel\msvc\7\wkscel.sln
If you have MSVC 7.1 open C:\development\cel\msvc\71\wkscel.sln
If you have MSVC 8.0 open C:\development\cel\msvc\8\wkscel.sln
If you have MSVC 7.0 open C:\development\cel\msvc\7\wksstatic.sln
If you have MSVC 7.1 open C:\development\cel\msvc\71\wksstatic.sln
If you have MSVC 8.0 open C:\development\cel\msvc\8\wksstatic.sln

Make sure that your specific 'msvc' folder has the 'read only' box unchecked before continuing.

Build the solution.
Just ignore any Python errors.

PlaneShift

Under Tools->Options in you MSVC look on the left hand side for the Projects folder. Under Projects choose "VC++ Directories". In the Show Directories for: choose "Library Files". Click the new folder icon to add the following directories:

C:\development\CS\out\releaseX\libs
C:\development\cel\out\releaseX\libs

You have to change X (in the path concerning CS and cel libraries) to these values, depending from the version you have of MSVC:

7 for MSVC 7
71 for Visual Studio .NET 2003/MSVC 7.1
8 for Visual Studio .NET 2005/MSVC 8

If you have MSVC.NET 7.0 open C:\development\planeshift\mk\msvc7\wkspstypical.sln
If you have MSVC.NET 2003/VC 7.1 open C:\development\planeshift\mk\msvc71\wkspstypical.sln
If you have MSVC.NET 2005/VC 8.0 open c:\development\PlaneShift\mk\msvc8\wkspstypical.sln
If you have MSVC.NET 7.0 open C:\development\planeshift\mk\msvc7\wkspsstatic.sln
If you have MSVC.NET 2003/VC 7.1 open C:\development\planeshift\mk\msvc71\wkspsstatic.sln
If you have MSVC.NET 2005/VC 8.0 open c:\development\planeshift\mk\msvc8\wkspsstatic.sln

Do the following if you put mysql somewhere else than C:\mysql:
Right-click plgdbmysql, under properties->linker->general, change the "C:\mysql\lib\opt" in Additional Library Directories to whatever your location of mysql is.

Build solution.

Note: You might have to copy a few DLL files from other build directories to your PlaneShift directory if you get problems. You usually need to move libz-cs.dll, and libmySQL.dll.

For Mingw you need to copy also these files to the PlaneShift directory:
C:\msys\1.0\local\bin\libpng12-0.dll
C:\development\cs\cg.dll
C:\development\cs\cgGL.dll
C:\MinGW\bin\libjpeg-62.dll

or by command-line:
cp /c/msys/1.0/local/bin/libpng12-0.dll
cp /c/development/cs/cg.dll
cp /c/development/cs/cgGL.dll
cp /c/MinGW/bin/libjpeg-62.dll

Setting Up For Debugging

Now before you can debug the programs, you need to change some properties of the project.
For each application you are interested in debugging (e.g. apppsclient):
Right-Click on the project.
Under properties->debugging change:
Command to: C:\development\planeshift\(name).exe
Working directory to: C:\development\planeshift\
You should be good to go now.

Get PS Art

You can choose to run your local client and server with the official artwork or with the SVN one.

The SVN artwork is rather incomplete and it doesn't contain any fancy piece of art. It is however necessary to have if you want to run your client. If you want to fetch this art, you need to collect it from SVN and put it in a art subdirectory in your PlaneShift directory.

/home/user/development/planeshift$ svn co https://planeshift.svn.sourceforge.net/svnroot/planeshift/art

https://planeshift.svn.sourceforge.net/svnroot/planeshift/art

The official released artwork for PlaneShift is not included in SVN. There are two ways to get it: you can either get the data from a PlaneShift release or use the PlaneShift updater.
It's suggested, if you have a release of PlaneShift installed, to get the data from it, saving download time and bandwidth.

From a PlaneShift installation

If you have previously downloaded a release package, you can use it to get the data. The data is in the "art" and "data" directories. The only thing that should not be copied is the "data/gui" directory, because the contents downloaded from the SVN are usually more recent and updated.

Get the Server Running

Optional section

Copy Dictionary Files

Simply copy the dictionary files from your \WordNet\2.1\dict folder to the \planeshift\data\dict folder.

Simply copy the dictionary files from your /usr/share/wordnet folder to the /home/user/development/planeshift/data/dict folder.

Create the Database

Check if MySQL is running.

Also, you should use a Command Prompt in DOS for the MySQL client commands.
You can start your MySQL server in this way:

# chmod 755 /etc/rc.d/rc.mysqld

# /etc/rc.d/rc.mysqld start

Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.

# /etc/init.d/mysql start

Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.

# /etc/init.d/mysql start

Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.

# /etc/init.d/mysql start

Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.

# /etc/init.d/mysql start

Then login to the MySQL client using (default username with no password):

$ mysql -u username -ppassword

The default username is root with no password.
If you wish to put a password on the root account you can $ mysqladmin -u root password "newpwd"

Start a command prompt (Start->Run and then type "cmd") and type:

C:\mysql\bin\mysqld --console

Start another command prompt and then login to the MySQL client using (the default username is root with no password):

C:\mysql\bin\mysql -u root

How to create a new PS database:

mysql> create database planeshift;
mysql> GRANT ALL PRIVILEGES ON planeshift.* TO planeshift@localhost IDENTIFIED BY 'planeshift';
mysql> quit

$ cd home/development/planeshift/src/server/database/mysql/
home/development/planeshift/src/server/database/mysql/$ mysql -u planeshift -pplaneshift

cd c:\development\planeshift\src\server\database\mysql\
C:\mysql\bin\mysql -u planeshift -pplaneshift

mysql> source create_all.sql;
mysql> quit

The database PlaneShift has now been created for PlaneShift to use.

Sometimes it is convenient to use another database name, user or password for development. In this case the file psserver.cfg has to be updated with the changed values. To change the database name the file create_all.sql also has to be modified.

NOTE: If you have upgraded MySQL server to 4.1 or superior (while the client is still 4.0) please write this in your MySQL console:

UPDATE planeshift@localhost SET Password = OLD_PASSWORD('planeshift');

Running the Server

Go to your PlaneShift directory (C:\development\planeshift) and run psserver, this will start the server.
Note: psserver requires the DOS Command Prompt to run. psclient does not.
Go to your PlaneShift directory (C:\development\planeshift) and run psserver. This will start the server.
Go to your PlaneShift directory (home/user/development/planeshift) and run psserver, this will start the server. If you have a script to start your server or load maps you can use

./psserver --run=/this/script_name

Go to your PlaneShift directory (home/user/development/planeshift) and run psserver, this will start the server.
Once the server has been started, you should see a "PS Server:" prompt. Not always does the prompt show PS Server: on first start but this is ok as long as you have gotten no errors so far.

Note: If you get any problems with psserver, make sure you have the latest version of MySQL 5.0 and that your libMySQL.dll file in windows\system32 is the same as the one in mysql\lib\opt.

Type the following to load the correct map and spawn all items and NPCs:

PS Server: loadmap npcroom1
PS Server: loadmap npcroom2
PS Server: loadmap npcroom_corr
PS Server: loadmap podium
PS Server: spawn
PS Server: ready

Additional maps can be listed with the "maplist" command, and loaded via the "loadmap" command. To see a list of all available psserver commands, type "help". You can shut down the server with "quit".

You should now be able to start psclient and log in. The server is localhost on port 13331, if your server is located somewhere else or you want to connect to somebody's else server, you need to modify the servers list.

The servers list is located in C:\development\planeshift\data\servers.xml.

The servers list is located in home/user/development/planeshift/data/servers.xml.

The servers list is located in home/user/development/planeshift/data/servers.xml.

The following accounts are in the SVN DB:

Username Password Access Group
vengeance keith full GM (30)
acraig andrew normal (0)
guest guest full GM (30)
dev1 andrew full GM (30)
dev2 andrew full GM (30)
gm1 andrew GM2 (22)
gm2 andrew GM6 (26)
player1 andrew normal (0)
player2 andrew normal (0)
player3 andrew normal (0)
player4 andrew normal (0)

To perform server actions while logged in, as a GM character, first execute the /admin command. You will be given the list of available commands for your account's security group. When logged in with this account, you can view the in-game help to obtain the full list of available commands and syntax. If you loaded any maps other than the test map "npcroom", you may teleport to them by using the command: "/teleport me map [mapname]"

Mini Scripts

Optional section

You might want to create some script so that you don't have to manually type in the environment variables every time. In this way you can also have multiple versions of CS + CEL coexisting peacefully.

$ echo \#\!/bin/sh > PlaneShiftserver.sh
$ echo "export CRYSTAL=$PWD/cs/" >> PlaneShiftserver.sh
$ echo "export CEL=$PWD/cel/" >> PlaneShiftserver.sh
$ echo "export CSCONFPATH=$PWD/cel/" >> PlaneShiftserver.sh
$ echo "cd $PWD/PlaneShift" >> PlaneShiftserver.sh
$ echo "./psserver \$@" >> PlaneShiftserver.sh
$ chmod +x PlaneShiftserver.sh

$ echo \#\!/bin/sh > PlaneShiftclient.sh
$ echo "export CRYSTAL=$PWD/cs/" >> PlaneShiftclient.sh
$ echo "export CEL=$PWD/cel/" >> PlaneShiftclient.sh
$ echo "export CSCONFPATH=$PWD/cel" >> PlaneShiftclient.sh
$ echo "cd $PWD/PlaneShift/" >> PlaneShiftclient.sh
$ echo "./psclient \$@" >> PlaneShiftclient.sh
$ chmod +x PlaneShiftclient.sh

Mounting External Art

Optional section

If you plan to do development work, or would just like to not need to copy over most of the art, you can mount the data straight from its existing location. This is highly recommended for developers using the internal SVN art.

Mount the VFS Paths

Open up the vfs.cfg file in the PlaneShift dir. Find the list of mount points (VFS.Mount.* lines) and add a mount for each custom dir you wish to use. For this example, I will mount a pre-installed package. Using the VFS syntax key at the top, add a mount as follows:

VFS.Mount.bins = $/development$/PSbins$/

I have named the mount "bins" and the dir I am using is at "/development/PSbins/".

On Windows this will be equivalent to C:\development\PSbins\

Use the Mounts

Open the cfg file of the PS application you want to use a mount. To continue the above example, I can set the SVN build client to use the installed package's maps by editing the PlaneShift.Mount.zipmapdir line in psclient.cfg:

PlaneShift.Mount.zipmapdir = /bins/art/world/

If you wish the server and NPC client to use these as well, modify/add that line to their cfg files too.

You can use the same mount as many times as needed, using different sub-dirs:

PlaneShift.Mount.npcszip = /bins/art/npcs.zip
PlaneShift.Mount.weaponzip = /bins/art/things/weapons.zip

PS mounts such as PlaneShift.Mount.characterszip take a VFS path to a ZIP file, as opposed to a dir. If you wish to mount from an uncompressed dir, you need to add a slash to the end of the path:

On Windows it will be a backslash, not a forwardslash.

PlaneShift.Mount.characterszip = /svn/planeshift/art/characters.zip\

On Linux it will be a forwardslash.

PlaneShift.Mount.characterszip = /svn/planeshift/art/characters.zip/

On Mac it will be a forwardslash.

PlaneShift.Mount.characterszip = /svn/planeshift/art/characters.zip/

Mount List

You can use the above method to easily mount most art. The full list of mounts used is as follows:

Planeshift.Mount.zipmapdir
Planeshift.Mount.characterszip
Planeshift.Mount.npcszip
Planeshift.Mount.weaponzip
Planeshift.Mount.itemzip
Planeshift.Mount.azurezip
Planeshift.Mount.bluezip
Planeshift.Mount.brownzip
Planeshift.Mount.crystalzip
Planeshift.Mount.darkzip
Planeshift.Mount.redzip
Planeshift.Mount.potionszip
Planeshift.Mount.moneyzip
Planeshift.Mount.bookszip
Planeshift.Mount.shieldszip
Planeshift.Mount.toolszip
Planeshift.Mount.naturalreszip
Planeshift.Mount.foodzip
Planeshift.Mount.helmszip
Planeshift.Mount.jewelryzip
Planeshift.GUI.Skin.Base
Planeshift.GUI.Skin.Dir

Note that the first and last mount to a directory, while the others must mount to a ZIP file unless the trailing slash is added as stated above. Also note that this isn't everything; you will still have to copy some files from the package or updater, namely your data dir and all art not mounted. This includes effects, music, sounds, apps.zip, soundlib.xml, etc. However, these things change less often than the above, and mounting the main portion of the art makes keeping things in sync much easier.

Getting Help

If you have trouble getting any of this to work, please feel free to contact us and we will do our best to help.
There is an IRC channel dedicated to providing help with building PlaneShift:

Server: irc.freenode.net
Channel: #PlaneShift-build