Building the Source
Once you have obtained the source of OML or the applications, you can build them as follows.
OML is know to build successfully on the following systems:
- Linux
- ArchLinux (packages available)
- Debian (packages available)
- Fedora Core (packages available)
- Angstrom
- Mac OS X (PPC and Intel)
Prerequisites
Before you can build OML from source, you will need to install its dependencies. Here is a list of them:
- GNULib -- source-code components from GNU
- libxml2 -- XML parser
- libsqlite3 -- SQLite database C API
- libpthread -- POSIX Threads
- libpopt -- Popt options parsing library (maintained at http://rpm5.org).
- libtool, pkg-config
- ruby
- libpq (optional, for PostgreSQS backend support)
- asciidoc, texinfo (optional, for the documentation, including man pages)
- doxygen (optional, for the code documentation)
- CHECK (optional, for tests)
You'll need to install the development headers of the libraries as well as their standard package (usually a -dev or -devel version of the package on the relevant Linux distributions). The following command should install all these dependencies in Debian or Ubuntu:
$ sudo apt-get install libxml2-dev libsqlite3-dev libpopt-dev pkg-config libtool asciidoc texinfo doxygen ruby
The pthread library is installed by default on modern operating systems. If you want to build the UNIX man pages, you will need to have asciidoc, texinfo, and maybe doxygen installed (you'll need to pass the --enable-doxygen-doc flag to configure to enable the latter).
$ sudo apt-get asciidoc texinfo doxygen
If you want to run the OML test suite, you will also need the CHECK unit test framework installed, as well as python, ruby, and the SQLite3 command line client. On Debian/Ubuntu, you can install these packages with:
$ sudo apt-get install check python ruby sqlite3
If you don't have it installed, OML will still build, but running make check will not do anything. On Fedora Core, you would need to run:
$ sudo yum install libxml2-devel sqlite-devel popt-devel make autoconf automake libtool check pkgconfig python ruby asciidoc texinfo doxygen
Under MacOS X (tested on 10.5 PPC), with Mac Ports, you need to do following to install OML's dependencies:
$ sudo port install libtool libxml2 popt sqlite3 $ sudo port install ruby # Recommended, as Ruby on OS X 10.5 is ancient $ sudo port install asciidoc texinfo texlive-latex doxygen # If you want to build the documentation
OML should also build with Homebrew and Fink without any specific configuration, provided you properly install the dependencies, but this hasn't been thoroughly tested. If you follow the above instructions and still find that there are missing libraries when you try to build, please let us know.
Building
OML uses GNU Autoconf, Automake, and Libtool for its build system (collectively referred to as the "Autotools") to automate system detection and building. This requires an initial setup before being able to build OML from a Git clone, but most of this is not necessary if building from a source tarball.
From a clone
Before building it is needed to create the configure script, a lot of Makefile.in files (which are templates that configure uses to generate Makefiles) and other boilerplate files are required by the Autotools system. You must skip this step when building from a source tarball.
If you have cloned out the source repository and installed the prerequisite libraries, in order to build OML you must first configure the build system. It also relies on Gnulib for some generic build scripts. First make sure that you have the Autotools installed. On Debian/Ubuntu:
$ sudo apt-get install autoconf automake libtool pkg-config gnulib
Recent versions are preferred. DO NOT try to use autoconf-2.13, it is known to be badly broken. To create the build system, first generate the configure script as follows:
$ ./autogen.sh
From a source tarball
To create the Makefiles, the only step needed is to run the configure script. The simplest way to do this is:
$ ./configure
You can then do
$ make $ make check $ make install
The first line builds OML (including the client library liboml2, the oml2-server, oml2-proxy-server, and the bundled applications). The second line runs the test suite. All tests should pass. This step can usually be omitted, especially if you don't have the CHECK framework installed. The third line actually installs OML. The default install root is /usr/local/lib. To change this, use the --prefix option to configure. That is, run:
$ ./configure --prefix=/alternate/install/path $ make $ make check $ make install
This will install binaries under /alternate/install/path/bin, libraries under /alternate/install/path/lib, etc. Of course, change "/alternate/install/path" to whatever install prefix you want to install OML under.
Compiling PostgreSQL support
Some distributions (e.g., Debian-based) place PostgreSQL headers in a non-default location. The --with-pgsql-inc option can be used to point the configure script to them, and build the backend.
$ ./configure --with-pgsql-inc=/usr/include/postgresql
Other options, if needed, include --with-pgsql[=PREFIX] and --with-pgsql-lib=[PATH]. The rest (non PostgreSQL-related) can be found with $ ./configure --help
VPATH builds
If you prefer to keep your executables, object files, and other generated files in a separate tree, Automake supports "parallel" or "VPATH" builds using GNU Make's VPATH feature. For instance, to build in a subdirectory called `build', do the following:
$ mkdir build $ cd build $ ../configure [possible options] $ make $ make check $ make install
All the files generated by configure and make will be put under the build directory, leaving the source tree clean (except for the files generated by autoreconf). Automake recognizes that configure was run in a different directory to the root of the source tree, and adjusts its behaviour accordingly.
You can then proceed to modify the code and contribute your changes, if you so please.
Cleaning the build system
If you want to remove the binaries and rebuild from scratch, the usual `make clean' will work. If you want to regenerate the entire build system, the script autoclean.sh will remove all of the generated files for you:
$ ./autoclean.sh
This should remove most of the files that are auto-generated by the Autotools build system. This means you'll have to start the process above at the "./autogen.sh" step if you want to start building OML again.