1{ lib, stdenv
2, fetchurl
3, pkg-config
4, wafHook
5, python3
6, readline
7, libxslt
8, libxcrypt
9, docbook-xsl-nons
10, docbook_xml_dtd_45
11}:
12
13stdenv.mkDerivation rec {
14 pname = "tdb";
15 version = "1.4.9";
16
17 src = fetchurl {
18 url = "mirror://samba/tdb/${pname}-${version}.tar.gz";
19 hash = "sha256-CsImBz46LbhkjaevdEy5X1B2alL+6wAdVYsrMht0p2U=";
20 };
21
22 nativeBuildInputs = [
23 python3
24 pkg-config
25 wafHook
26 libxslt
27 docbook-xsl-nons
28 docbook_xml_dtd_45
29 ];
30
31 buildInputs = [
32 python3
33 readline # required to build python
34 libxcrypt
35 ];
36
37 # otherwise the configure script fails with
38 # PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make!
39 preConfigure = ''
40 export PKGCONFIG="$PKG_CONFIG"
41 export PYTHONHASHSEED=1
42 '';
43
44 wafPath = "buildtools/bin/waf";
45
46 wafConfigureFlags = [
47 "--bundled-libraries=NONE"
48 "--builtin-libraries=replace"
49 ];
50
51 postFixup = if stdenv.isDarwin
52 then ''install_name_tool -id $out/lib/libtdb.dylib $out/lib/libtdb.dylib''
53 else null;
54
55 # python-config from build Python gives incorrect values when cross-compiling.
56 # If python-config is not found, the build falls back to using the sysconfig
57 # module, which works correctly in all cases.
58 PYTHON_CONFIG = "/invalid";
59
60 meta = with lib; {
61 description = "The trivial database";
62 longDescription = ''
63 TDB is a Trivial Database. In concept, it is very much like GDBM,
64 and BSD's DB except that it allows multiple simultaneous writers
65 and uses locking internally to keep writers from trampling on each
66 other. TDB is also extremely small.
67 '';
68 homepage = "https://tdb.samba.org/";
69 license = licenses.lgpl3Plus;
70 platforms = platforms.all;
71 };
72}