The libfossil Amalgamation Build
See also: building, download pre-built copies of the amalgamation
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:
$ ./configure ...
$ make amal
...
Amalgamation files:
-rw-rw-r-- 1 stephan stephan 1502299 Dec 21 17:06 ./libfossil.c
-rw-rw-r-- 1 stephan stephan 4273 Dec 21 15:16 ./libfossil-config.h
-rw-rw-r-- 1 stephan stephan 824290 Dec 21 17:06 ./libfossil.h
ccache cc -I. ... -o "../libfossil.o"
Reminder: it will need these sqlite3 files to build:
sqlite3.h, sqlite3ext.h, and optionally a local copy of sqlite3.c
The output is these three files in the top-most directory of the tree:
libfossil-config.h
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.
Optionally: if compiled with-DHAVE_CONFIG_H
,libfossil.h
will also includeconfig.h
(which the user is expected to provide).libfossil.h
contains all of the library's public header files. It#include
slibfossil-config.h
.libfossil.c
contains all of the library's sources and internal header files. It#include
slibfossil.h
.
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 might be required (which version is unknown - development typically happens against something close to the sqlite3 trunk). Optionally, you can link in a self-compiled
sqlite3.o
. #include "libfossil.h"
- Optionally tweak
libfossil-config.h
and/or provide aconfig.h
and compile with-DHAVE_CONFIG_H
. - Compile
libfossil.c
- Link your app with
libfossil.o
, zlib (-lz
), and sqlite3 (-lsqlite3
). Some additional libraries might, depending on its build options, be required by sqlite:-ldl -lpthread -lm
.
Regarding the sqlite3 dependency: this tree includes a copy of sqlite3.c
and sqlite3.h
in its extsrc
directory. Those versions are known to work with the library. The build can optionally use an external copy of sqlite3 (see ./configure --help
), but it will not work with arbitrarily old versions because libfossil frequently makes use of new features in the library. (Fossil itself is a testing ground for new SQLite features.)