nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 python3
25 wafHook
26 docbook-xsl-nons
27 docbook_xml_dtd_42
28 ] ++ lib.optionals stdenv.isDarwin [
29 fixDarwinDylibNames
30 ];
31
32 buildInputs = [
33 python3
34 readline
35 libxslt
36 ];
37
38 wafPath = "buildtools/bin/waf";
39
40 wafConfigureFlags = [
41 "--enable-talloc-compat1"
42 "--bundled-libraries=NONE"
43 "--builtin-libraries=replace"
44 ];
45
46 # python-config from build Python gives incorrect values when cross-compiling.
47 # If python-config is not found, the build falls back to using the sysconfig
48 # module, which works correctly in all cases.
49 PYTHON_CONFIG = "/invalid";
50
51 # this must not be exported before the ConfigurePhase otherwise waf whines
52 preBuild = lib.optionalString stdenv.hostPlatform.isMusl ''
53 export NIX_CFLAGS_LINK="-no-pie -shared";
54 '';
55
56 postInstall = ''
57 ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc.c.[0-9]*.o
58 '';
59
60 meta = with lib; {
61 description = "Hierarchical pool based memory allocator with destructors";
62 homepage = "https://tdb.samba.org/";
63 license = licenses.gpl3;
64 platforms = platforms.all;
65 };
66}