Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 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, 15}: 16 17stdenv.mkDerivation rec { 18 pname = "talloc"; 19 version = "2.4.3"; 20 21 src = fetchurl { 22 url = "mirror://samba/talloc/${pname}-${version}.tar.gz"; 23 sha256 = "sha256-3EbEC59GuzTdl/5B9Uiw6LJHt3qRhXZzPFKOg6vYVN0="; 24 }; 25 26 nativeBuildInputs = [ 27 pkg-config 28 python3 29 wafHook 30 docbook-xsl-nons 31 docbook_xml_dtd_42 32 ] 33 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 34 fixDarwinDylibNames 35 ]; 36 37 buildInputs = [ 38 python3 39 readline 40 libxslt 41 libxcrypt 42 ]; 43 44 # otherwise the configure script fails with 45 # PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make! 46 preConfigure = '' 47 export PKGCONFIG="$PKG_CONFIG" 48 export PYTHONHASHSEED=1 49 ''; 50 51 wafPath = "buildtools/bin/waf"; 52 53 wafConfigureFlags = [ 54 "--enable-talloc-compat1" 55 "--bundled-libraries=NONE" 56 "--builtin-libraries=replace" 57 ] 58 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 59 "--cross-compile" 60 "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" 61 ]; 62 63 # python-config from build Python gives incorrect values when cross-compiling. 64 # If python-config is not found, the build falls back to using the sysconfig 65 # module, which works correctly in all cases. 66 PYTHON_CONFIG = "/invalid"; 67 68 # https://reviews.llvm.org/D135402 69 NIX_LDFLAGS = lib.optional ( 70 stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17" 71 ) "--undefined-version"; 72 73 # this must not be exported before the ConfigurePhase otherwise waf whines 74 preBuild = lib.optionalString stdenv.hostPlatform.isMusl '' 75 export NIX_CFLAGS_LINK="-no-pie -shared"; 76 ''; 77 78 postInstall = '' 79 ${stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc.c.[0-9]*.o 80 ''; 81 82 meta = with lib; { 83 description = "Hierarchical pool based memory allocator with destructors"; 84 homepage = "https://tdb.samba.org/"; 85 license = licenses.gpl3; 86 platforms = platforms.all; 87 maintainers = [ maintainers.matthiasbeyer ]; 88 }; 89}