Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-16.03 54 lines 1.9 kB view raw
1{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true, findXMLCatalogs, fetchpatch }: 2 3assert pythonSupport -> python != null; 4 5#TODO: share most stuff between python and non-python builds, perhaps via multiple-output 6 7stdenv.mkDerivation (rec { 8 name = "libxml2-${version}"; 9 version = "2.9.4"; 10 11 src = fetchurl { 12 url = "http://xmlsoft.org/sources/${name}.tar.gz"; 13 sha256 = "0g336cr0bw6dax1q48bblphmchgihx9p1pjmxdnrd6sh3qci3fgz"; 14 }; 15 16 # https://bugzilla.gnome.org/show_bug.cgi?id=766834#c5 17 postPatch = "patch -R < " + fetchpatch { 18 name = "schemas-validity.patch"; 19 url = "https://git.gnome.org/browse/libxml2/patch/?id=f6599c5164"; 20 sha256 = "0i7a0nhxwkxx6dkm8917qn0bsfn1av6ghg2f4dxanxi4bn4b1jjn"; 21 }; 22 23 outputs = [ "out" "doc" ]; 24 25 buildInputs = stdenv.lib.optional pythonSupport python 26 # Libxml2 has an optional dependency on liblzma. However, on impure 27 # platforms, it may end up using that from /usr/lib, and thus lack a 28 # RUNPATH for that, leading to undefined references for its users. 29 ++ stdenv.lib.optional stdenv.isFreeBSD xz; 30 31 propagatedBuildInputs = [ zlib findXMLCatalogs ]; 32 33 passthru = { inherit pythonSupport version; }; 34 35 enableParallelBuilding = true; 36 37 meta = { 38 homepage = http://xmlsoft.org/; 39 description = "An XML parsing library for C"; 40 license = "bsd"; 41 platforms = stdenv.lib.platforms.unix; 42 maintainers = [ stdenv.lib.maintainers.eelco ]; 43 }; 44 45} // stdenv.lib.optionalAttrs pythonSupport { 46 configureFlags = "--with-python=${python}"; 47 48 # this is a pair of ugly hacks to make python stuff install into the right place 49 preInstall = ''substituteInPlace python/libxml2mod.la --replace "${python}" "$out"''; 50 installFlags = ''pythondir="$(out)/lib/${python.libPrefix}/site-packages"''; 51 52} // stdenv.lib.optionalAttrs (!pythonSupport) { 53 configureFlags = "--with-python=no"; # otherwise build impurity bites us 54})