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