D 2014-02-25T18:18:26.423 L building P c7d0008513cef88db0983a16dad6f8c0e649d9a5 U stephan W 2740

Building libfossil

See also: [AmalgamationBuild] libfossil's canonical build system is currently aimed at platforms hosting GNU Make 3.81 or newer (most relatively recent platforms have 3.81, though some name it 'gmake' instead of 'make'). Prerequisites: libfossil requires that zlib, both the library and headers, be installed at the system level (where they normally are). The first step is to configure the build tree, which generates some configuration and makefiles:
$ ./configure
Pass it the --help option for the list of options, but none are normally needed. To change the compiler, pass CC=compiler-name to the configuration script. It is currently known to build cleanly with gcc, clang, and tcc on x64 and i386 Linux. Note that the makefiles tweak the compiler flags for those particular compilers, and may need similar tweaks for other compilers (see config.make.in). When using clang it might be useful to pass CC='clang -fno-color-diagnostics' to disable color output. Normally clang detects that automatically, but it mis-detects when compiling from xemacs and the color codes break xemacs' understanding of the output. To build it:
$ make # or gmake
That will compile the library and [f-tools | a few sample/test/demo applications]. Be careful with them - some modify the repository (but never without being told to).

Running Tests

The majority of the library's functionality is either covered by unit tests or tested indirectly via unit tests. The remaining functionality (which cannot be easily tested without modifying the repo) is tested via [f-tools|various apps]. The most fundamental of the sanity tests is the aptly-named f-sanity, which can be used like this:
$ cd f-apps
$ make # or gmake
$ ./f-sanity
If that runs to completion, without triggering an exception, "the world is round." On Unix-like systems it should be possible to build the script bindings and run those unit tests:
$ cd th1ish
$ make # or gmake
$ make unit # runs the unit tests
$ make vg # runs the unit tests through valgrind,
          # complaining if it finds problems.
          # Also collects memory stats to a CSV file.

System vs. Local sqlite3

Because libfossil uses bleeding-edge features of sqlite3 (namely recursive queries), it includes its own copy of sqlite3 amalgamation. Once those features are widely out and about in the wild, we can revert the build process to use a system-level sqlite3. As of 20140201, it requires sqlite3 3.8.3+. Z b1ad78a605f772c9c8906f4c35f6492e