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