Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 13}: 14 15stdenv.mkDerivation rec { 16 pname = "talloc"; 17 version = "2.4.2"; 18 19 src = fetchurl { 20 url = "mirror://samba/talloc/${pname}-${version}.tar.gz"; 21 sha256 = "sha256-hez55GXiD5j5lQpS6aQR4UMgvFVfolfYdpe356mx2KY="; 22 }; 23 24 nativeBuildInputs = [ 25 pkg-config 26 python3 27 wafHook 28 docbook-xsl-nons 29 docbook_xml_dtd_42 30 ] ++ lib.optionals stdenv.isDarwin [ 31 fixDarwinDylibNames 32 ]; 33 34 buildInputs = [ 35 python3 36 readline 37 libxslt 38 libxcrypt 39 ]; 40 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 ''; 47 48 wafPath = "buildtools/bin/waf"; 49 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 ]; 58 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"; 63 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 ''; 68 69 postInstall = '' 70 ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc.c.[0-9]*.o 71 ''; 72 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 }; 80}