summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-01 21:38:03 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-04 14:54:51 +0200
commiteae17c3743bd8ea710308db7fad4602c97ff7893 (patch)
treea14c30a2301bd5444d7e931ec06c4ed292ec4b1b /pkgs
parent16f87d772f68840b342285f550565e74850ef42d (diff)
downloadnixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.tar
nixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.tar.gz
nixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.tar.bz2
nixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.tar.lz
nixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.tar.xz
nixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.tar.zst
nixlib-eae17c3743bd8ea710308db7fad4602c97ff7893.zip
Revert "libxml2: Refactor and fix library propagation"
This reverts commit 287ec76b8fb2f670b068266d77edc8714d0d06df.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/libxml2/default.nix70
-rw-r--r--pkgs/top-level/all-packages.nix4
2 files changed, 30 insertions, 44 deletions
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index 0d70a6502feb..153096ee45c0 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -1,63 +1,49 @@
-{ stdenv, fetchurl, findXMLCatalogs
+{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true, findXMLCatalogs }:
 
-# Optional Dependencies
-, icu ? null, python ? null, readline ? null, zlib ? null, xz ? null
-}:
+assert pythonSupport -> python != null;
 
 #TODO: share most stuff between python and non-python builds, perhaps via multiple-output
 
 let
-  mkFlag = trueStr: falseStr: cond: name: val:
-    if cond == null then null else
-      "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
-  mkEnable = mkFlag "enable-" "disable-";
-  mkWith = mkFlag "with-" "without-";
-  mkOther = mkFlag "" "" true;
-
-  shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
-
-  optIcu = shouldUsePkg icu;
-  optPython = shouldUsePkg python;
-  optReadline = shouldUsePkg readline;
-  optZlib = shouldUsePkg zlib;
-  optXz = shouldUsePkg xz;
-
-  sitePackages = if optPython == null then null else
-    "\${out}/lib/${python.libPrefix}/site-packages";
+  version = "2.9.2";
 in
-stdenv.mkDerivation rec {
+
+stdenv.mkDerivation (rec {
   name = "libxml2-${version}";
-  version = "2.9.2";
 
   src = fetchurl {
     url = "http://xmlsoft.org/sources/${name}.tar.gz";
     sha256 = "1g6mf03xcabmk5ing1lwqmasr803616gb2xhn7pll10x2l5w6y2i";
   };
 
-  buildInputs = [ optIcu optPython optReadline optZlib optXz ];
-  propagatedBuildInputs = [ findXMLCatalogs ];
+  buildInputs = stdenv.lib.optional pythonSupport python
+    # Libxml2 has an optional dependency on liblzma.  However, on impure
+    # platforms, it may end up using that from /usr/lib, and thus lack a
+    # RUNPATH for that, leading to undefined references for its users.
+    ++ (stdenv.lib.optional stdenv.isFreeBSD xz);
+
+  propagatedBuildInputs = [ zlib findXMLCatalogs ];
 
-  configureFlags = [
-    (mkWith (optIcu != null)      "icu"                optIcu)
-    (mkWith (optPython != null)   "python"             optPython)
-    (mkWith (optPython != null)   "python-install-dir" sitePackages)
-    (mkWith (optReadline != null) "readline"           optReadline)
-    (mkWith (optZlib != null)     "zlib"               optZlib)
-    (mkWith (optXz != null)       "lzma"               optXz)
-  ];
+  passthru = { inherit pythonSupport version; };
 
   enableParallelBuilding = true;
 
-  meta = with stdenv.lib; {
+  meta = {
     homepage = http://xmlsoft.org/;
     description = "An XML parsing library for C";
-    license = licenses.mit;
-    platforms = platforms.unix;
-    maintainers = with maintainers; [ eelco wkennington ];
+    license = "bsd";
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.eelco ];
   };
 
-  passthru = {
-    inherit version;
-    pythonSupport = python != null;
-  };
-}
+} // stdenv.lib.optionalAttrs pythonSupport {
+  configureFlags = "--with-python=${python}";
+
+  # this is a pair of ugly hacks to make python stuff install into the right place
+  preInstall = ''substituteInPlace python/libxml2mod.la --replace "${python}" "$out"'';
+  installFlags = ''pythondir="$(out)/lib/${python.libPrefix}/site-packages"'';
+
+} // stdenv.lib.optionalAttrs (!pythonSupport) {
+  configureFlags = "--with-python=no"; # otherwise build impurity bites us
+})
+
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a599eb12d5f6..853965959fc7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7259,11 +7259,11 @@ let
   libxmi = callPackage ../development/libraries/libxmi { };
 
   libxml2 = callPackage ../development/libraries/libxml2 {
-    python = null;
+    pythonSupport = false;
   };
 
   libxml2Python = lowPrio (libxml2.override {
-    inherit python;
+    pythonSupport = true;
   });
 
   libxmlxx = callPackage ../development/libraries/libxmlxx { };