libfossil  Artifact Content

Artifact acea781344fc8997e8918716a5cf203f8e199cd6:

Wiki page [AmalgamationBuild] by stephan 2014-11-07 15:14:42.
D 2014-11-07T15:14:42.273
L AmalgamationBuild
P a89e9880d14c1a816d811f9306db5d9c362e166f
U stephan
W 2548
<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):

[stephan@host:~/libfossil/src]$ 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>. <br/><tt>libdl</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 [|sqlite3 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 <tt>src/</tt>
dir the build tree, but it does <em>not</em> include them in the Amalgamation build.
Z 5ba8cd7b1afea0aa4bf786b2aedd39e7