<h1>The Amalgamation Build</h1>

See also: [building]

This library supports the creation of a so-called "amalgamation build", a practice adopted from the sqlite project which compounds the sources and headers into a form which can easily be dropped into client-side projects.

To create the amalgamation you need a working build environment (GNU Make and friends):

<nowiki><pre>
make amal
Generating dependencies...
Creating ../libfossil.h...
Creating ../libfossil.c...
Trying GCC C89...
Trying GCC C99...
Trying tcc...
Man, that was FAST!
Trying clang...


It will try to compile it with various compilers if they are found in
the search path.

The output is these three files:

   *  <tt>libfossil-config.h</tt> holds a basic set of configuration options. This file can/should be tweaked for the target platform. The default options set there are, by design, conservative. That said, the conservative options "should" work just fine for all modern platforms.
   *  <tt>libfossil.h</tt> contains header files. It <tt>#include</tt>s <tt>libfossil-config.h</tt>.
   *  <tt>libfossil.c</tt> contains all of the sources. It <tt>#include</tt>s <tt>libfossil.h</tt>.

The C++ build also has an amalgamation build which requires this amalgamation. To build it, run <tt>make amal</tt> from the <tt>cpp</tt> directory.

To use the amalgamation, simply:

   *  Make sure you have zlib and sqlite3 libraries and headers installed. They are preinstalled on any modern Unix system, though a newer sqlite3 <em>might</em> be required (which version is unknown - development typically happens against the sqlite3 trunk). Optionally, you can link in a self-compiled <tt>sqlite3.o</tt>.
   *  <tt>#include "libfossil.h"
   *  Compile <tt>libfossil.c</tt>
   *  Link your app with <tt>libfossil.o</tt>, zlib, and sqlite3. On Unix: <tt>-lz -lsqlite3 -ldl -lpthread</tt>. and <tt>libpthread</tt> is required by sqlite3 in some configurations.

Regarding the sqlite3 dependency: currently this library tries to work
with whatever sqlite3 version is installed, but if it at some point
requires features of relatively new versions then clients may need to
use the amalgamation]
when building this code. The main makefile will use those two files
(sqlite3.c and sqlite3.h) automatically if they are found in the
dir the build tree, but it does <em>not</em> include them in the Amalgamation build.