treewide: use `addBinToPathHook`, minor cleanups (#379187)
[NixPkgs.git] / pkgs / by-name / ta / talloc / package.nix
blob2a9395a1c41ad59b1d02a212b04855341650ea0a
2   lib,
3   stdenv,
4   fetchurl,
5   python3,
6   pkg-config,
7   readline,
8   libxslt,
9   libxcrypt,
10   docbook-xsl-nons,
11   docbook_xml_dtd_42,
12   fixDarwinDylibNames,
13   wafHook,
14   buildPackages,
17 stdenv.mkDerivation rec {
18   pname = "talloc";
19   version = "2.4.2";
21   src = fetchurl {
22     url = "mirror://samba/talloc/${pname}-${version}.tar.gz";
23     sha256 = "sha256-hez55GXiD5j5lQpS6aQR4UMgvFVfolfYdpe356mx2KY=";
24   };
26   nativeBuildInputs =
27     [
28       pkg-config
29       python3
30       wafHook
31       docbook-xsl-nons
32       docbook_xml_dtd_42
33     ]
34     ++ lib.optionals stdenv.hostPlatform.isDarwin [
35       fixDarwinDylibNames
36     ];
38   buildInputs = [
39     python3
40     readline
41     libxslt
42     libxcrypt
43   ];
45   # otherwise the configure script fails with
46   # PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make!
47   preConfigure = ''
48     export PKGCONFIG="$PKG_CONFIG"
49     export PYTHONHASHSEED=1
50   '';
52   wafPath = "buildtools/bin/waf";
54   wafConfigureFlags =
55     [
56       "--enable-talloc-compat1"
57       "--bundled-libraries=NONE"
58       "--builtin-libraries=replace"
59     ]
60     ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
61       "--cross-compile"
62       "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}"
63     ];
65   # python-config from build Python gives incorrect values when cross-compiling.
66   # If python-config is not found, the build falls back to using the sysconfig
67   # module, which works correctly in all cases.
68   PYTHON_CONFIG = "/invalid";
70   # this must not be exported before the ConfigurePhase otherwise waf whines
71   preBuild = lib.optionalString stdenv.hostPlatform.isMusl ''
72     export NIX_CFLAGS_LINK="-no-pie -shared";
73   '';
75   postInstall = ''
76     ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc.c.[0-9]*.o
77   '';
79   meta = with lib; {
80     description = "Hierarchical pool based memory allocator with destructors";
81     homepage = "https://tdb.samba.org/";
82     license = licenses.gpl3;
83     platforms = platforms.all;
84     maintainers = [ maintainers.matthiasbeyer ];
85   };