at 16.09-beta 68 lines 2.3 kB view raw
1{ stdenv, lib, fetchurl, zlib, xz, python, findXMLCatalogs, libiconv, fetchpatch 2, supportPython ? (! stdenv ? cross) }: 3 4stdenv.mkDerivation rec { 5 name = "libxml2-${version}"; 6 version = "2.9.4"; 7 8 src = fetchurl { 9 url = "http://xmlsoft.org/sources/${name}.tar.gz"; 10 sha256 = "0g336cr0bw6dax1q48bblphmchgihx9p1pjmxdnrd6sh3qci3fgz"; 11 }; 12 13 # https://bugzilla.gnome.org/show_bug.cgi?id=766834#c5 14 postPatch = "patch -R < " + fetchpatch { 15 name = "schemas-validity.patch"; 16 url = "https://git.gnome.org/browse/libxml2/patch/?id=f6599c5164"; 17 sha256 = "0i7a0nhxwkxx6dkm8917qn0bsfn1av6ghg2f4dxanxi4bn4b1jjn"; 18 }; 19 20 outputs = [ "bin" "dev" "out" "doc" ] 21 ++ lib.optional supportPython "py"; 22 propagatedBuildOutputs = "out bin" + lib.optionalString supportPython " py"; 23 24 buildInputs = lib.optional supportPython 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 ]; 31 32 configureFlags = lib.optional supportPython "--with-python=${python}" 33 ++ [ "--exec_prefix=$dev" ]; 34 35 enableParallelBuilding = true; 36 37 doCheck = !stdenv.isDarwin; 38 39 crossAttrs = lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { 40 # creating the DLL is broken ATM 41 dontDisableStatic = true; 42 configureFlags = configureFlags ++ [ "--disable-shared" ]; 43 44 # libiconv is a header dependency - propagating is enough 45 propagatedBuildInputs = [ findXMLCatalogs libiconv ]; 46 }; 47 48 preInstall = lib.optionalString supportPython 49 ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"''; 50 installFlags = lib.optionalString supportPython 51 ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"''; 52 53 postFixup = '' 54 moveToOutput bin/xml2-config "$dev" 55 moveToOutput lib/xml2Conf.sh "$dev" 56 moveToOutput share/man/man1 "$bin" 57 ''; 58 59 passthru = { inherit version; pythonSupport = supportPython; }; 60 61 meta = { 62 homepage = http://xmlsoft.org/; 63 description = "An XML parsing library for C"; 64 license = "bsd"; 65 platforms = lib.platforms.unix; 66 maintainers = [ lib.maintainers.eelco ]; 67 }; 68}