zoss/Compiling/MacOSX

Compiling ZOSS on Mac OS X

Work in progress and incomplete. I started with the Gentoo instructions but I've not fully converted everything to Mac OS X.

These instructions assume Mac OS X 10.5 and XCode 3.1 but probably will work on Mac OS X 10.6 + XCode 3.2.

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.

Dependencies

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

libxml2

Lua

I use  Lua-5.1.3-Intel.dmg but if you're planning on doing any development using Zen Engine + Lua, you might consider using  Stella, which is an IDE for Lua. (stella is rather outdated, and does not run in OSX. any reference to it should be removed)

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

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

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.

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/ogre-build
cd ~/dev/ogre-build
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

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