| About | Downloads | Documents | Links |

Building Gema

| Introduction | Building on Unix | Building on Windows |

1. Introduction

 This document describes how to build and install gema tools both on Unix and Windows platforms. It should be enough to follow the instruction in the sections below to have everything up and running.

   If something goes wrong, and details included here (and in the scripts) would not be enough to help you to fix your problem, please report the problem using SourceForge bug tracking subsystem (you don't need to log in as a SourceForge user) or sending an e-mail to Remo Dentato.

2. Building on a Unix platform

Gema has been built and tested on many Unix platforms. The following table summarize the ones we are aware of. Please let us know if you experienced other platforms.

OS Vers. Architecture Distribution Compiler
Linux 2.4 x86 Debian 2.2 gcc 3.2.2
Linux 2.4 x86 Redhat 9.0 gcc 3.2.2
Linux 2.4 x86 Mandrake 9.0 gcc 3.2.2
Linux 2.4 AMD64 (*) Suse 8 ES gcc 3.2.2
Linux 2.4 Alpha Debian 3.0 gcc 2.95.4
FreeBSD 4.8 x86   gcc 2.95.4
NetBSD 1.6.1 x86   gcc 2.95.3
Solaris 9 R220   gcc 3.2.2
MacOS X 10.1 PC-G4 SERVER Edition gcc 2.95.2
MacOS X 10.2 PC-G4 SERVER Edition gcc 2.95.2
AIX       cc
HP-UX       cc
SunOs       acc
mingw+msys   x86   gcc 3.2
(*) On AMD64 a bug has been reported that affects the usage of gel.getvar() and gel.setvar().

  2.1 The building process

  Assuming that your working directory is ~/works/gema, you start the building process with:

~/works/gema> cd src
~/works/gema/src> ./gbuild

  The gbuild script, when executed with no argument, configures the environment appropriately for your system, then compiles gema and tries to compile gel and gua if it finds the Lua libraries.

. Upon a successful compilation, the testsuite is launched to verify that everything went well.

  Ad hoc configurations may be made at the beginning of the gbuild script. For example, the path to Lua libraries and includes should be set here.

  Other options for gbuild are:

Performs the configuration step only. If this step does not work for your system you can set up all the variables in the gbuild script and set the NOAUTO variable to 1.
Copy the executables and libraries to the direcotry specified by the INSTALLDIR variable.
Clean up directories removing temporary files generated during the building process.
Configure, compile and execute tests (equivalent to specifying no option at all).
Only builds gema.
Only builds gel.
Only builds gua.
Executes the testsuites.


  2.2 Building Lua

  To have gel and gua compiled, you need Lua libraries already installed on your system.

  If you don't have it, it's very easy to get it work. Just download the latest distribution from http://www.lua.org, and follow the provided instructions.

  Do not forget to modify the values of LUAINCPATH and LUALIBPATH in the gbuild script to make them point to the right directories.

3. Building on a MS Windows platform

  Various combinations of compilers and Windows versions have been tested:

Compiler vers WinXP Win2K Win98
mingw+msys+gcc 3.2   X X X
Borland C++ 5.5 X X  
Borland C++ 5.6     X
Microsoft Visual C++ 6.0     X
lcc-win32 3.6   X X
lcc-win32 3.8 X    
Digital Mars C++ 8.38.n X    
Open Watcom 1.2 X    

  The build process has not been tested on WinNT nor WinME but it is likely to work. Changing the scripts so to use a different compiler should not be too difficult.

  3.1 The building process

   If you use mingw and msys please refer to the section 2.1 since the process is exactly the same as the one for Unix systems. The only difference is that the options gema, gel and gua become gema.exe, gel.exe and gua.exe.

   For the other tested compilers, the only prerequisite is that your compiler is properly set and can be invoked from the command line prompt. For example, if you use Microsoft VC, the vcvars32.bat should have been launched beforehand.

  Also be sure to have enough "environment memory" in your console, all tests have been performed with at least 4096K available.

 Assuming the environment has been set properly and that your working directory is D:\works\gema, you start the building process with:

D:\works\gema> cd src
D:\works\gema\src> gbuild

  Everything will be rebuilt, and the tests will be executed. After that, copy the exe files in a directory that is in your path.

  To have the Lua bindings (libgel.lib, gel.exe and gua.exe) compiled, you need to specify where the Lua libraries and includes are, setting the LUALIBPATH and LUAINCPATH appropriately.

  If the building scripts are unable to find them, they make an attempt to guess their location. If this step also fail, the Lua bindings won't be built. See next section for some more detail.

  Options for gbuild.bat may be shown at the command line using gbuild /?

 gbuild [all] Build gema, gel and gua. Perform tests at the end.
 gbuild gema Build only gema.
 gbuild lua Recompile also lua libraries (if source found).
 gbuild config Only do the configuration step.
 gbuild clean Delete all the temporary files.
 gbuild test Only perform testsuite
 gbuild -test Do not perform testsuite
 gbuild install Copy gema, gel and gua into "C:\WINDOWS".
 gbuild uninstall Delete gema, gel and gua from "C:\WINDOWS".

  3.2 Building Lua

  The gbuild script assumes that the lua static libraries are named liblua.lib and liblualib.lib. If the Makefile that comes with Lua does not work for you, you can use the following command:

D:\works\gema\src> gbuild lua

the lbuild.bat script will do all that is required for building Lua following the same logic as the Unix shell script build that comes with the Lua distribution.

  To make it work, you have to specify the directory where you uncompressed the Lua tarball (for example d:\works\Lua-5.0.2) in the LUAHOME variable inside the gbuild.bat script.

  Note that the process may not work if Lua souce files are on a different volume than the gema source file, the easiest option is to have the gema sourcetree and the Lua sourcetree under the same directory (in our examples d:\works).