at 18.03-beta 71 lines 2.3 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 outputs = [ "bin" "dev" "out" "man" "doc" ] 21 ++ lib.optional pythonSupport "py"; 22 propagatedBuildOutputs = "out bin" + lib.optionalString pythonSupport " py"; 23 24 buildInputs = lib.optional pythonSupport python 25 # Libxml2 has an optional dependency on liblzma. However, on impure 26 # platforms, it may end up using that from /usr/lib, and thus lack a 27 # RUNPATH for that, leading to undefined references for its users. 28 ++ lib.optional stdenv.isFreeBSD xz; 29 30 propagatedBuildInputs = [ zlib findXMLCatalogs ] ++ lib.optional icuSupport icu; 31 32 configureFlags = 33 lib.optional pythonSupport "--with-python=${python}" 34 ++ lib.optional icuSupport "--with-icu" 35 ++ [ "--exec_prefix=$dev" ]; 36 37 enableParallelBuilding = true; 38 39 doCheck = (stdenv.hostPlatform == stdenv.buildPlatform) && !stdenv.isDarwin && 40 hostPlatform.libc != "musl"; 41 42 crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") { 43 # creating the DLL is broken ATM 44 dontDisableStatic = true; 45 configureFlags = configureFlags ++ [ "--disable-shared" ]; 46 47 # libiconv is a header dependency - propagating is enough 48 propagatedBuildInputs = [ findXMLCatalogs libiconv ]; 49 }; 50 51 preInstall = lib.optionalString pythonSupport 52 ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"''; 53 installFlags = lib.optionalString pythonSupport 54 ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"''; 55 56 postFixup = '' 57 moveToOutput bin/xml2-config "$dev" 58 moveToOutput lib/xml2Conf.sh "$dev" 59 moveToOutput share/man/man1 "$bin" 60 ''; 61 62 passthru = { inherit version; pythonSupport = pythonSupport; }; 63 64 meta = { 65 homepage = http://xmlsoft.org/; 66 description = "An XML parsing library for C"; 67 license = lib.licenses.mit; 68 platforms = lib.platforms.unix; 69 maintainers = [ lib.maintainers.eelco ]; 70 }; 71}