zoss/Compiling/Gentoo

Compiling ZOSS on Gentoo

These instructions assume you're starting with a Stage3 tarball using Gentoo Linux 2.6.30-gentoo-r5. I've tested this on x86_64 but not on a 32 bit system.

Personally, I put all of my development in ~/dev, but you can put it where it suits you. Just remember that when I use ~/dev, you'll need to change that directory to your development directory.

These installation instructions assume you know at least a little about Gentoo. The instructions are cursory, so use your judgment before installing anything and take care not to mess up your current installation.

Dependencies

ZOSS uses CMake and Lua for the build system, wxWidgets 2.9.0

Dependencies with ebuilds

I used the following settings in /etc/portage/package.use. You may want to alter these settings to more appropriately suit your needs.

dev-util/cmake -qt4
x11-libs/gtk+ -cups

You may already have some of these packages installed. Please don't blindly install them. Use emerge -pv first and take action appropriately.

emerge libxml2
emerge subversion
emerge cmake
emerge lua
emerge luafilesystem
emerge boost
emerge gtk+
emerge libsdl

TODO: luasocket is required by mudbot, but is masked by ~amd64. Give instructions for installing?

Other dependencies

Lua SVN

This requires subversion and lua from the previous step, but doesn't require cmake.

In a temporary directory:

wget http://luaforge.net/frs/download.php/4131/luasvn-0.4.0.tar.gz
gunzip luasvn-0.4.0.tar.gz
tar xvf luasvn-0.4.0.tar
cd luasvn-0.4.0/src

You need to edit the makefile so that APR and APR_UTIL point are apr-1 instead of apr-1.0:

-I/usr/include/apr-1

and change LIBS:

LIBS=-lsvn_client-1 -lsvn_repos-1

Edit luasvn.c and add apr_xlate.h

#include <svn_time.h>

#include <apr_xlate.h>

#include <lua.h>

Next:

make
sudo mkdir -p /usr/lib/lua/5.1
sudo mv svn.so /usr/lib/lua/5.1

Test:

lua
require("svn");
os.exit();

You shouldn't get any error messages.

wxWidgets 2.9.0

Download  wxWidgets-2.9.0.tar.gz.

Unzip and untar it to a temporary directory and then configure and compile it.

cd {tmpdir}
gunzip wxWidgets-2.9.0.tar.gz
tar xvf wxWidgets-2.9.0.tar
cd wxWidgets-2.9.0
./configure
make
sudo make install

This will install it to /usr/local. Before running CMake (explained later) you need to add an environment variable:

export wxWidgets_ROOT_DIR=/usr/local

Getting the ZOSS source code

mkdir -p ~/dev/Zen
cd ~/dev/Zen
svn co svn://www.indiezen.org/zoss/Setup/trunk Setup
lua Setup/Package/zpkg.lua svn co
lua Setup/Package/zpkg.lua svn switch stable

Note: This gives a segmentation fault, but as long as it checked out 16 projects then it should be correct.

The final command (zpkg svn switch stable) will switch to the appropriate stable branches. If you need to update your source code, make sure you do this:

cd ~/dev/Zen
svn up Setup
lua Setup/Package/zpkg.lua svn switch stable

Other dependencies

The build system won't build plugins that don't have the required dependencies installed.

Other dependencies include Ogre, CEGUI, OIS, Newton, MySQL, etc.

If you're wanting to compile the tutorials / examples, you will need to build the following:

  • ZOgre for OGRE rendering plugin
  • ZInput? for the OIS input plugin
  • ZCrazyEddie for the CEGUI Widget plugin
  • ZNewton for the Newton Game Dynamics plugin
  • ZLua for the Lua scripting plugin
  • ZTerrain? for the Terrain plugin
  • ZSky? for the Sky plugin

When you build ZOSS, these plugins will automatically be built if you have the appropriate dependencies installed.

OGRE, CEGUI, OIS

These instructions are incomplete.

These three libraries are the most commonly used for Zen Engine, so I'll lump them all together.

Currently, Zen Engine's ZOgre plugin uses the trunk / head of OGRE until OGRE 1.7 is released.

As su, install the following using Portage.

For OIS, you'll have to modify package.keywords to override ~amd64.

emerge libXaw
emerge free
emerge cegui
emerge ois

Build instructions:

cd ~/dev
svn co https://svn.ogre3d.org/svnroot/ogre/trunk ogre
mkdir ~/dev/build-ogre
cd ~/dev/build-ogre
ccmake ../ogre

The last command will present you with a Curses GUI. From here I recommend you follow  these instructions starting with "Running CMake". It provides you with a description of the CMake variables / options.

One thing I typically change is CMAKE_BUILD_TYPE I change to Optimized.

After you've configured Ogre and generated the project files, build it:

make
sudo make install

Generating the makefile / projects

Do not proceed with this step until you have successfully completed all previous steps, otherwise this step will fail.

The next of commands will generate Unix Makefiles. If you want other project types to be generated (CodeBlocks?, KDevelop, Eclipse CDT) then look at the CMake documentation.

mkdir -p ~/dev/build
cd ~/dev/build
cmake ../Zen/build/CMake

If you don't get any error messages then you're ready to do make.

Updating projects

After you download new dependencies to build new plugins, you'll have to re-run CMake. You should also do this after you've updated from Subversion.

cd ~/dev/build
cmake .
make

Sometimes that might not get everything. If you experience problems, delete everything in the ~/dev/build and regenerate it from scratch. Please be [i]very/i careful with rm -rf and make sure you're in the correct directory when you do pwd!

cd ~/dev/build
pwd
rm -rf *
cmake ../Zen/build/CMake