Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 84 lines 2.8 kB view raw
1{ stdenv, lib, fetchurl, fetchpatch 2, zlib, xz, python2, findXMLCatalogs, libiconv 3, buildPlatform, hostPlatform 4, pythonSupport ? buildPlatform == hostPlatform 5, icuSupport ? false, icu ? null 6}: 7 8let 9 python = python2; 10 11in stdenv.mkDerivation rec { 12 name = "libxml2-${version}"; 13 version = "2.9.7"; 14 15 src = fetchurl { 16 url = "http://xmlsoft.org/sources/${name}.tar.gz"; 17 sha256 = "034hylzspvkm0p4bczqbf8q05a7r2disr8dz725x4bin61ymwg7n"; 18 }; 19 20 patches = [ 21 (fetchpatch { 22 name = "CVE-2018-14567_CVE-2018-9251.patch"; 23 url = https://gitlab.gnome.org/GNOME/libxml2/commit/2240fbf5912054af025fb6e01e26375100275e74.patch; 24 sha256 = "1xpqsfkzhrqasza51c821mnds5l317djrz8086fmzpyf68vld03h"; 25 }) 26 (fetchpatch { 27 name = "CVE-2018-14404.patch"; 28 url = https://gitlab.gnome.org/GNOME/libxml2/commit/a436374994c47b12d5de1b8b1d191a098fa23594.patch; 29 sha256 = "19vp7p32vrninnfa7vk9ipw7n4cl1gg16xxbhjy2d0kwp1crvzqh"; 30 }) 31 ]; 32 33 outputs = [ "bin" "dev" "out" "man" "doc" ] 34 ++ lib.optional pythonSupport "py"; 35 propagatedBuildOutputs = "out bin" + lib.optionalString pythonSupport " py"; 36 37 buildInputs = lib.optional pythonSupport python 38 # Libxml2 has an optional dependency on liblzma. However, on impure 39 # platforms, it may end up using that from /usr/lib, and thus lack a 40 # RUNPATH for that, leading to undefined references for its users. 41 ++ lib.optional stdenv.isFreeBSD xz; 42 43 propagatedBuildInputs = [ zlib findXMLCatalogs ] ++ lib.optional icuSupport icu; 44 45 configureFlags = 46 lib.optional pythonSupport "--with-python=${python}" 47 ++ lib.optional icuSupport "--with-icu" 48 ++ [ "--exec_prefix=$dev" ]; 49 50 enableParallelBuilding = true; 51 52 doCheck = (stdenv.hostPlatform == stdenv.buildPlatform) && !stdenv.isDarwin && 53 hostPlatform.libc != "musl"; 54 55 crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") { 56 # creating the DLL is broken ATM 57 dontDisableStatic = true; 58 configureFlags = configureFlags ++ [ "--disable-shared" ]; 59 60 # libiconv is a header dependency - propagating is enough 61 propagatedBuildInputs = [ findXMLCatalogs libiconv ]; 62 }; 63 64 preInstall = lib.optionalString pythonSupport 65 ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"''; 66 installFlags = lib.optionalString pythonSupport 67 ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"''; 68 69 postFixup = '' 70 moveToOutput bin/xml2-config "$dev" 71 moveToOutput lib/xml2Conf.sh "$dev" 72 moveToOutput share/man/man1 "$bin" 73 ''; 74 75 passthru = { inherit version; pythonSupport = pythonSupport; }; 76 77 meta = { 78 homepage = http://xmlsoft.org/; 79 description = "An XML parsing library for C"; 80 license = lib.licenses.mit; 81 platforms = lib.platforms.unix; 82 maintainers = [ lib.maintainers.eelco ]; 83 }; 84}