Version 1/35 - Next ยป - Current version
rti, 05/11/2010 07:55 pm


Installing Luabind and Linux, Mac OS X, ...

Since luabind is not available from macports (I think certain Linux Distributions do not provide it too), here the short summary how to install luabind on a Unix like system :)

Preparing

To build luabind, you need liblua. Install it, for example on a Mac using macports:

sudo port install lua

Getting the source

While writing this, the most current version is 0.9. Get it!

wget http://sunet.dl.sourceforge.net/project/luabind/luabind/0.9/luabind-0.9.tar.gz

Extract the source

tar zxf luabind-0.9.tar.gz

Building

Since bjam might be annoying and complicated, use this small build script. Put it in the luabind root directory.

This script is configured for a Mac OS X having lua installed in /opt/local (using macports).
Please adjust LUA_INCLUDE_DIR, LUA_LIBRARY_DIR and LIB_EXTENSION if you have a different setup.

#!/bin/sh

LUA_INCLUDE_DIR=/opt/local/include
LUA_LIBRARY_DIR=/opt/local/lib
LIB_EXTENSION=dylib

rm -rf build
mkdir -p build/src

for i in src/*.cpp
do 
    gcc -I$LUA_INCLUDE_DIR -I. -fPIC -c $i -o build/$i.o
done

gcc -shared -o build/libluabind.$LIB_EXTENSION build/src/*.o \
    -L$LUA_LIBRARY_DIR -lstdc++ -llua

Installing

To install the thing, just copy lib and header into the preferred path. For example:

sudo cp -r luabind /usr/local/include
sudo cp build/libluabind.* /usr/local/lib

Thats all

Hope that works for you.
Have fun!