| 1 | = Building the Source= |
| 2 | |
| 3 | Once you have [wiki:0aGettingSource obtained the source of OML] or the applications, you can build them as follows. |
| 4 | |
| 5 | OML is know to build successfully on the following systems: |
| 6 | * Linux |
| 7 | * !ArchLinux (packages available) |
| 8 | * Debian (packages available) |
| 9 | * Fedora Core (packages available) |
| 10 | * Angstrom |
| 11 | * Mac OS X (PPC and Intel) |
| 12 | |
| 13 | == Prerequisites == |
| 14 | Before you can build OML from source, you will need to install its dependencies. Here is a list of them: |
| 15 | |
| 16 | * GNULib -- source-code components from GNU |
| 17 | * libxml2 -- XML parser |
| 18 | * libsqlite3 -- SQLite database C API |
| 19 | * libpthread -- POSIX Threads |
| 20 | * libpopt -- Popt options parsing library (maintained at http://rpm5.org). |
| 21 | * libtool, pkg-config |
| 22 | * ruby |
| 23 | * libpq (optional, for PostgreSQS backend support) |
| 24 | * asciidoc, texinfo (optional, for the documentation, including man pages) |
| 25 | * doxygen (optional, for the code documentation) |
| 26 | * CHECK (optional, for tests) |
| 27 | |
| 28 | 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: |
| 29 | {{{ |
| 30 | $ sudo apt-get install libxml2-dev libsqlite3-dev libpopt-dev pkg-config libtool asciidoc texinfo doxygen ruby |
| 31 | }}} |
| 32 | The pthread library is installed by default on modern operating systems. |
| 33 | 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). |
| 34 | {{{ |
| 35 | $ sudo apt-get asciidoc texinfo doxygen |
| 36 | }}} |
| 37 | 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: |
| 38 | {{{ |
| 39 | $ sudo apt-get install check python ruby sqlite3 |
| 40 | }}} |
| 41 | If you don't have it installed, OML will still build, but running make check will not do anything. |
| 42 | On Fedora Core, you would need to run: |
| 43 | {{{ |
| 44 | $ sudo yum install libxml2-devel sqlite-devel popt-devel make autoconf automake libtool check pkgconfig python ruby asciidoc texinfo doxygen |
| 45 | }}} |
| 46 | Under MacOS X (tested on 10.5 PPC), with Mac Ports, you need to do following to install OML's dependencies: |
| 47 | {{{ |
| 48 | $ sudo port install libtool libxml2 popt sqlite3 |
| 49 | $ sudo port install ruby # Recommended, as Ruby on OS X 10.5 is ancient |
| 50 | $ sudo port install asciidoc texinfo texlive-latex doxygen # If you want to build the documentation |
| 51 | }}} |
| 52 | 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. |
| 53 | If you follow the above instructions and still find that there are missing libraries when you try to build, please let us know. |
| 54 | |
| 55 | == Building == |
| 56 | 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. |
| 57 | |
| 58 | == From a clone == |
| 59 | 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. |
| 60 | |
| 61 | 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: |
| 62 | {{{ |
| 63 | $ sudo apt-get install autoconf automake libtool pkg-config gnulib |
| 64 | }}} |
| 65 | |
| 66 | 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: |
| 67 | {{{ |
| 68 | $ ./autogen.sh |
| 69 | }}} |
| 70 | == From a source tarball == |
| 71 | |
| 72 | To create the Makefiles, the only step needed is to run the configure script. The simplest way to do this is: |
| 73 | {{{ |
| 74 | $ ./configure |
| 75 | }}} |
| 76 | You can then do |
| 77 | {{{ |
| 78 | $ make |
| 79 | $ make check |
| 80 | $ make install |
| 81 | }}} |
| 82 | 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: |
| 83 | {{{ |
| 84 | $ ./configure --prefix=/alternate/install/path |
| 85 | $ make |
| 86 | $ make check |
| 87 | $ make install |
| 88 | }}} |
| 89 | 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. |
| 90 | |
| 91 | == Compiling PostgreSQL support == |
| 92 | 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. |
| 93 | {{{ |
| 94 | $ ./configure --with-pgsql-inc=/usr/include/postgresql |
| 95 | }}} |
| 96 | Other options, if needed, include --with-pgsql[=PREFIX] and --with-pgsql-lib=[PATH]. The rest (non PostgreSQL-related) can be found with |
| 97 | $ ./configure --help |
| 98 | == VPATH builds == |
| 99 | 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: |
| 100 | {{{ |
| 101 | $ mkdir build |
| 102 | $ cd build |
| 103 | $ ../configure [possible options] |
| 104 | $ make |
| 105 | $ make check |
| 106 | $ make install |
| 107 | }}} |
| 108 | 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. |
| 109 | |
| 110 | You can then proceed to modify the code and contribute your changes, if you so please. |
| 111 | |
| 112 | == Cleaning the build system == |
| 113 | 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: |
| 114 | {{{ |
| 115 | $ ./autoclean.sh |
| 116 | }}} |
| 117 | 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. |