InstallingLuabind

Version 6 (TomH, 07/01/2010 10:22 am)

1 2 rti
h1. Installing Luabind on Linux, Mac OS X, ...
2 1 rti
3 1 rti
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 :)
4 1 rti
5 4 tnxgalaxy
h2. Installing lua
6 1 rti
7 1 rti
To build luabind, you need liblua. Install it, for example on a Mac using macports:
8 1 rti
<pre>
9 1 rti
sudo port install lua
10 1 rti
</pre>
11 4 tnxgalaxy
On Ubuntu 10.04:
12 4 tnxgalaxy
<pre>
13 4 tnxgalaxy
sudo apt-get install liblua5.1-0-dev
14 4 tnxgalaxy
</pre>
15 1 rti
16 6 TomH
On CentOS 5+
17 6 TomH
18 6 TomH
<pre>
19 6 TomH
yum install lua
20 6 TomH
</pre>
21 6 TomH
22 1 rti
h2. Getting the source
23 1 rti
24 1 rti
While writing this, the most current version is 0.9. Get it!
25 4 tnxgalaxy
On Mac OS X:
26 1 rti
<pre>
27 4 tnxgalaxy
curl -O http://sunet.dl.sourceforge.net/project/luabind/luabind/0.9/luabind-0.9.tar.gz
28 4 tnxgalaxy
</pre>
29 4 tnxgalaxy
30 4 tnxgalaxy
On Linux:
31 4 tnxgalaxy
<pre>
32 1 rti
wget http://sunet.dl.sourceforge.net/project/luabind/luabind/0.9/luabind-0.9.tar.gz
33 1 rti
</pre>
34 1 rti
35 1 rti
h2. Extract the source
36 1 rti
37 1 rti
<pre>
38 1 rti
tar zxf luabind-0.9.tar.gz
39 1 rti
</pre>
40 1 rti
41 4 tnxgalaxy
h2. Building and installing
42 1 rti
43 5 tnxgalaxy
h3. On Ubuntu 10.04:
44 1 rti
45 4 tnxgalaxy
install boost build:
46 4 tnxgalaxy
<pre>
47 4 tnxgalaxy
sudo apt-get install boost-build libboost1.40-dev
48 4 tnxgalaxy
</pre>
49 4 tnxgalaxy
50 4 tnxgalaxy
and compile / install with the following command:
51 4 tnxgalaxy
<pre>
52 4 tnxgalaxy
sudo bjam --prefix=/usr/local install
53 4 tnxgalaxy
</pre>
54 1 rti
55 5 tnxgalaxy
h3. On Mac OS X:
56 5 tnxgalaxy
57 5 tnxgalaxy
Bjam might be annoying and complicated, use this small build script. Put it in the luabind root directory.
58 4 tnxgalaxy
59 1 rti
This script is configured for a Mac OS X having lua and boost installed in /opt/local (using macports).
60 1 rti
Please adjust LUA_INCLUDE_DIR, LUA_LIBRARY_DIR and LIB_EXTENSION if you have a different setup.
61 1 rti
<pre>
62 1 rti
#!/bin/sh
63 1 rti
64 1 rti
LUA_INCLUDE_DIR=/opt/local/include
65 1 rti
LUA_LIBRARY_DIR=/opt/local/lib
66 1 rti
LIB_EXTENSION=dylib
67 1 rti
68 1 rti
rm -rf build
69 1 rti
mkdir -p build/src
70 1 rti
71 1 rti
for i in src/*.cpp
72 1 rti
do 
73 1 rti
	gcc -I$LUA_INCLUDE_DIR -I. -fPIC -c $i -o build/$i.o
74 1 rti
done
75 1 rti
76 1 rti
gcc -shared -o build/libluabind.$LIB_EXTENSION build/src/*.o \
77 1 rti
	-L$LUA_LIBRARY_DIR -lstdc++ -llua
78 1 rti
</pre>
79 1 rti
80 1 rti
To install the thing, just copy lib and header into the preferred path. For example:
81 1 rti
82 1 rti
<pre>
83 1 rti
sudo cp -r luabind /usr/local/include
84 1 rti
sudo cp build/libluabind.* /usr/local/lib
85 1 rti
</pre>
86 1 rti
87 1 rti
h2. Thats all
88 1 rti
89 1 rti
Hope that works for you. 
90 1 rti
Have fun!