nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 python3,
6 pkg-config,
7 readline,
8 tdb,
9 talloc,
10 tevent,
11 popt,
12 libxslt,
13 docbook-xsl-nons,
14 docbook_xml_dtd_42,
15 cmocka,
16 wafHook,
17 buildPackages,
18 libxcrypt,
19 testers,
20}:
21
22stdenv.mkDerivation (finalAttrs: {
23 pname = "ldb";
24 version = "2.9.2";
25
26 src = fetchurl {
27 url = "mirror://samba/ldb/ldb-${finalAttrs.version}.tar.gz";
28 hash = "sha256-0VWIQALHnbscPYZC+LEBPy5SCzru/W6WQSrexbjWy8A=";
29 };
30
31 outputs = [
32 "out"
33 "dev"
34 ];
35
36 nativeBuildInputs = [
37 pkg-config
38 python3
39 wafHook
40 libxslt
41 docbook-xsl-nons
42 docbook_xml_dtd_42
43 tdb
44 tevent
45 ];
46
47 buildInputs = [
48 python3
49 readline # required to build python
50 tdb
51 talloc
52 tevent
53 popt
54 cmocka
55 libxcrypt
56 ];
57
58 # otherwise the configure script fails with
59 # PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make!
60 preConfigure = ''
61 export PKGCONFIG="$PKG_CONFIG"
62 export PYTHONHASHSEED=1
63 '';
64
65 wafPath = "buildtools/bin/waf";
66
67 wafConfigureFlags = [
68 "--bundled-libraries=NONE"
69 "--builtin-libraries=replace"
70 "--without-ldb-lmdb"
71 ]
72 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
73 "--cross-compile"
74 "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}"
75 ];
76
77 # python-config from build Python gives incorrect values when cross-compiling.
78 # If python-config is not found, the build falls back to using the sysconfig
79 # module, which works correctly in all cases.
80 PYTHON_CONFIG = "/invalid";
81
82 # https://reviews.llvm.org/D135402
83 NIX_LDFLAGS = lib.optional (
84 stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17"
85 ) "--undefined-version";
86
87 stripDebugList = [
88 "bin"
89 "lib"
90 "modules"
91 ];
92
93 passthru.tests.pkg-config = testers.hasPkgConfigModules {
94 package = finalAttrs.finalPackage;
95 };
96
97 meta = {
98 broken = stdenv.hostPlatform.isDarwin;
99 description = "LDAP-like embedded database";
100 homepage = "https://ldb.samba.org/";
101 license = lib.licenses.lgpl3Plus;
102 pkgConfigModules = [ "ldb" ];
103 platforms = lib.platforms.all;
104 };
105})