Section Navigation

Building Code

Building projects require little more than just downloading and building them, expect on Windows, where you will need to get a working building environment up and running first.'s build system is based on that used by Mozilla.

Setting up a Windows build environment

The build system makes use of a number of Unix utilities, and the best way to install these is with Cygwin. Download setup.exe and run it. Make sure to install the make, diffutils, patchutils and cvs packages, along with the normal defaults.

If you don't already have a working Visual C++ installation, then first, download and install Visual C++ Express Edition (after selling your soul for a Microsoft Passport). At the moment the code does not work with Visual C++ 6.0, although this will be fixed at some point.

Setting up a Unix build environment builds have been tested on FreeBSD, Linux and Mac OS X. These all come with the tools needed (except FreeBSD where you'll need the gmake port installed - cd /usr/ports/devel/gmake && make install clean).

Doing an initial checkout of the source code

Once you have a working build environment then you can start. First, check out the makefile which controls the entire process, using CVS:

cvs co openpave/ 

At this point you could download all projects and build them by just running:

cd openpave && gmake -f

Setting up an OPCONFIG file

If you are planning on doing anything more serious than but browsing the code, you should create an opconfig file. Particularly, this allows you to control which of the projects are checkout and built. You can copy and paste the example below, saving it either in the directory where you run the checkout command above, the openpave directory it created, or in your home directory. The file should be named "opconfig". If you wish to name it something else set the environment variable OPCONFIG to the full path and filename of the file.

# Options for
mk_add_options OP_PROJECTS=test,libop,fem3d
mk_add_options OP_MAKE_ARGS="--no-print-directory"
mk_add_options OP_OBJDIR=@TOPSRCDIR@/op-dbg

# Options for 'configure' (same as command-line options).
ac_add_options --disable-debug
ac_add_options --enable-optimize="-O3 -march=pentium3"

The following mk_add_options are available:

Comma separated list of projects to build. See the top of for options.
Additional arguments for CVS.
Additional arguments for CVS checkout (default is -P).
Check out at a particular date.
Check out files with a particular tag.
A directory to build in rather than muck up the source tree.
If set, run autoconf locally. For when you're planning on editing
Additional arguments to pass to make.

The following ac_add_options are available, along with a number of options normally available for a autoconf build (see configure --help):

--enable-debug=flags / --disable-debug
Enable or disable debug, or set special debug compiler flags.
Enable linking with Microsoft debug runtime libraries (for easier debugging on Windows).
--enable-optimize=flags / --disable-debug
Enable or disable optimization, or set special compiler flags.

In addition, the following environment variables affect the build:

Controls the path and filename used for opconfig.
Controls the CVS root used for checkouts. If you have an account you can set this to once you have set up SSH access.
Sets the name of autoconf. requires autoconf 2.13, which is called autoconf-2.13 on FreeBSD and Cygwin. This is only used if OP_AUTOCONF is set.
CC and CXX
Set the names of the C and C++ compilers respectively.

Building projects

Finally, the commands to checkout the source code and build it are:

cd openpave && gmake -f checkout

cd openpave && gmake -f build

These will automatically pick up the options you set, and should result in working output. At the moment, the build system does not support installing the built projects, but will soon.

Example scripts

Below are some example scripts and batch files which might help. The first two are for Unix, and the second two for Windows.

# save me as and chmod +x me.
export OPCONFIG=$PWD/opconfig
if [ ! -f openpave/ ]; then
	cvs co openpave/
cd openpave
gmake -f checkout
# save me as and chmod +x me.
export OPCONFIG=$PWD/opconfig
cd openpave
gmake -f build
rem save me as op-co.bat
cd C:\source

"c:\Program Files\PuTTY\pageant.exe" "C:\Documents and Settings\Jeremy Lea\.ssh\id_dsa.ppk"

set HOME=C:\source
set PATH=C:\source\cygwin\bin;
set OPCONFIG=C:\source\opconfig

cvs checkout openpave/
cd openpave
make -f checkout
cd ..
rem save me as op-build.bat
cd C:\Source

set HOME=C:\source
set PATH=C:\source\cygwin\bin;
set OPCONFIG=C:\source\opconfig
set AUTOCONF=autoconf-2.13
rem call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"
call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86

cd openpave
make -f build
cd ..