Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 17.09 70 lines 2.2 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.5"; 14 15 src = fetchurl { 16 url = "http://xmlsoft.org/sources/${name}.tar.gz"; 17 sha256 = "0f6d5nkvcfx8yqis2dwrnv6qaj0nhiifz49y657vmrwwxvnc2ca0"; 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.isDarwin; 40 41 crossAttrs = lib.optionalAttrs (hostPlatform.libc == "msvcrt") { 42 # creating the DLL is broken ATM 43 dontDisableStatic = true; 44 configureFlags = configureFlags ++ [ "--disable-shared" ]; 45 46 # libiconv is a header dependency - propagating is enough 47 propagatedBuildInputs = [ findXMLCatalogs libiconv ]; 48 }; 49 50 preInstall = lib.optionalString pythonSupport 51 ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"''; 52 installFlags = lib.optionalString pythonSupport 53 ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"''; 54 55 postFixup = '' 56 moveToOutput bin/xml2-config "$dev" 57 moveToOutput lib/xml2Conf.sh "$dev" 58 moveToOutput share/man/man1 "$bin" 59 ''; 60 61 passthru = { inherit version; pythonSupport = pythonSupport; }; 62 63 meta = { 64 homepage = http://xmlsoft.org/; 65 description = "An XML parsing library for C"; 66 license = lib.licenses.mit; 67 platforms = lib.platforms.unix; 68 maintainers = [ lib.maintainers.eelco ]; 69 }; 70}