1{ lib, stdenv
2, fetchurl
3, python3
4, pkg-config
5, readline
6, libxslt
7, docbook-xsl-nons
8, docbook_xml_dtd_42
9, fixDarwinDylibNames
10, wafHook
11}:
12
13stdenv.mkDerivation rec {
14 pname = "talloc";
15 version = "2.3.3";
16
17 src = fetchurl {
18 url = "mirror://samba/talloc/${pname}-${version}.tar.gz";
19 sha256 = "sha256-a+lbI2i9CvHEzXqIFG62zuoY5Gw//JMwv2JitA0diqo=";
20 };
21
22 nativeBuildInputs = [
23 pkg-config
24 fixDarwinDylibNames
25 python3
26 wafHook
27 docbook-xsl-nons
28 docbook_xml_dtd_42
29 ];
30
31 buildInputs = [
32 python3
33 readline
34 libxslt
35 ];
36
37 wafPath = "buildtools/bin/waf";
38
39 wafConfigureFlags = [
40 "--enable-talloc-compat1"
41 "--bundled-libraries=NONE"
42 "--builtin-libraries=replace"
43 ];
44
45 # python-config from build Python gives incorrect values when cross-compiling.
46 # If python-config is not found, the build falls back to using the sysconfig
47 # module, which works correctly in all cases.
48 PYTHON_CONFIG = "/invalid";
49
50 # this must not be exported before the ConfigurePhase otherwise waf whines
51 preBuild = lib.optionalString stdenv.hostPlatform.isMusl ''
52 export NIX_CFLAGS_LINK="-no-pie -shared";
53 '';
54
55 postInstall = ''
56 ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc.c.[0-9]*.o
57 '';
58
59 meta = with lib; {
60 description = "Hierarchical pool based memory allocator with destructors";
61 homepage = "https://tdb.samba.org/";
62 license = licenses.gpl3;
63 platforms = platforms.all;
64 };
65}