git.iko.soy/typeable/nixpkgs
on master help sign in
Revert "libxml2: Refactor and fix library propagation"
eae17c3Eelco Dolstra
pkgs/development/libraries/libxml2/default.nix+28−42
@@ -1,63 +1,49 @@
1−{ stdenv, fetchurl, findXMLCatalogs
1+{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true, findXMLCatalogs }:
2
2
3−# Optional Dependencies
3+assert pythonSupport -> python != null;
4−, icu ? null, python ? null, readline ? null, zlib ? null, xz ? null
5−}:
6
4
7#TODO: share most stuff between python and non-python builds, perhaps via multiple-output
5#TODO: share most stuff between python and non-python builds, perhaps via multiple-output
8
6
9let
7let
10− mkFlag = trueStr: falseStr: cond: name: val:
8+ version = "2.9.2";
11− if cond == null then null else
12− "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
13− mkEnable = mkFlag "enable-" "disable-";
14− mkWith = mkFlag "with-" "without-";
15− mkOther = mkFlag "" "" true;
16−
17− shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
18−
19− optIcu = shouldUsePkg icu;
20− optPython = shouldUsePkg python;
21− optReadline = shouldUsePkg readline;
22− optZlib = shouldUsePkg zlib;
23− optXz = shouldUsePkg xz;
24−
25− sitePackages = if optPython == null then null else
26− "\${out}/lib/${python.libPrefix}/site-packages";
27in
9in
10+
28−stdenv.mkDerivation rec {
11+stdenv.mkDerivation (rec {
29 name = "libxml2-${version}";
12 name = "libxml2-${version}";
30− version = "2.9.2";
31
13
32 src = fetchurl {
14 src = fetchurl {
33 url = "http://xmlsoft.org/sources/${name}.tar.gz";
15 url = "http://xmlsoft.org/sources/${name}.tar.gz";
34 sha256 = "1g6mf03xcabmk5ing1lwqmasr803616gb2xhn7pll10x2l5w6y2i";
16 sha256 = "1g6mf03xcabmk5ing1lwqmasr803616gb2xhn7pll10x2l5w6y2i";
35 };
17 };
36
18
37− buildInputs = [ optIcu optPython optReadline optZlib optXz ];
19+ buildInputs = stdenv.lib.optional pythonSupport python
20+ # Libxml2 has an optional dependency on liblzma. However, on impure
21+ # platforms, it may end up using that from /usr/lib, and thus lack a
22+ # RUNPATH for that, leading to undefined references for its users.
23+ ++ (stdenv.lib.optional stdenv.isFreeBSD xz);
24+
38− propagatedBuildInputs = [ findXMLCatalogs ];
25+ propagatedBuildInputs = [ zlib findXMLCatalogs ];
39
26
40− configureFlags = [
27+ passthru = { inherit pythonSupport version; };
41− (mkWith (optIcu != null) "icu" optIcu)
42− (mkWith (optPython != null) "python" optPython)
43− (mkWith (optPython != null) "python-install-dir" sitePackages)
44− (mkWith (optReadline != null) "readline" optReadline)
45− (mkWith (optZlib != null) "zlib" optZlib)
46− (mkWith (optXz != null) "lzma" optXz)
47− ];
48
28
49 enableParallelBuilding = true;
29 enableParallelBuilding = true;
50
30
51− meta = with stdenv.lib; {
31+ meta = {
52 homepage = http://xmlsoft.org/;
32 homepage = http://xmlsoft.org/;
53 description = "An XML parsing library for C";
33 description = "An XML parsing library for C";
54− license = licenses.mit;
34+ license = "bsd";
55− platforms = platforms.unix;
35+ platforms = stdenv.lib.platforms.unix;
56− maintainers = with maintainers; [ eelco wkennington ];
36+ maintainers = [ stdenv.lib.maintainers.eelco ];
57 };
37 };
58
38
59− passthru = {
39+} // stdenv.lib.optionalAttrs pythonSupport {
60− inherit version;
40+ configureFlags = "--with-python=${python}";
61− pythonSupport = python != null;
41+
62− };
42+ # this is a pair of ugly hacks to make python stuff install into the right place
43+ preInstall = ''substituteInPlace python/libxml2mod.la --replace "${python}" "$out"'';
44+ installFlags = ''pythondir="$(out)/lib/${python.libPrefix}/site-packages"'';
45+
46+} // stdenv.lib.optionalAttrs (!pythonSupport) {
47+ configureFlags = "--with-python=no"; # otherwise build impurity bites us
63−}
48+})
49+
pkgs/top-level/all-packages.nix+2−2
@@ -7259,11 +7259,11 @@ let
7259 libxmi = callPackage ../development/libraries/libxmi { };
7259 libxmi = callPackage ../development/libraries/libxmi { };
7260
7260
7261 libxml2 = callPackage ../development/libraries/libxml2 {
7261 libxml2 = callPackage ../development/libraries/libxml2 {
7262− python = null;
7262+ pythonSupport = false;
7263 };
7263 };
7264
7264
7265 libxml2Python = lowPrio (libxml2.override {
7265 libxml2Python = lowPrio (libxml2.override {
7266− inherit python;
7266+ pythonSupport = true;
7267 });
7267 });
7268
7268
7269 libxmlxx = callPackage ../development/libraries/libxmlxx { };
7269 libxmlxx = callPackage ../development/libraries/libxmlxx { };