diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-05-05 11:49:03 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-05-05 11:49:03 +0200 |
commit | 375bc8def7c17506bc10f3b6193635f05d5ccc40 (patch) | |
tree | 6af7662b245e7998bd18ae20d9e74922c489fb6d /pkgs/development/libraries/libxml2/default.nix | |
parent | 2f75c6845981b38a698cf1a9f620145877c80956 (diff) | |
parent | 7f9ccc628403ed88844a4436da3b2944be5560a4 (diff) | |
download | nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.gz nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.bz2 nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.lz nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.xz nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.zst nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.zip |
Merge staging into closure-size
Diffstat (limited to 'pkgs/development/libraries/libxml2/default.nix')
-rw-r--r-- | pkgs/development/libraries/libxml2/default.nix | 70 |
1 files changed, 42 insertions, 28 deletions
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 153096ee45c..0d70a6502fe 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -1,49 +1,63 @@ -{ stdenv, fetchurl, zlib, xz, python ? null, pythonSupport ? true, findXMLCatalogs }: +{ stdenv, fetchurl, findXMLCatalogs -assert pythonSupport -> python != null; +# Optional Dependencies +, icu ? null, python ? null, readline ? null, zlib ? null, xz ? null +}: #TODO: share most stuff between python and non-python builds, perhaps via multiple-output let - version = "2.9.2"; + 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"; 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 = 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 ]; + buildInputs = [ optIcu optPython optReadline optZlib optXz ]; + propagatedBuildInputs = [ findXMLCatalogs ]; - passthru = { inherit pythonSupport version; }; + 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) + ]; enableParallelBuilding = true; - meta = { + meta = with stdenv.lib; { homepage = http://xmlsoft.org/; description = "An XML parsing library for C"; - license = "bsd"; - platforms = stdenv.lib.platforms.unix; - maintainers = [ stdenv.lib.maintainers.eelco ]; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ eelco wkennington ]; }; -} // 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 -}) - + passthru = { + inherit version; + pythonSupport = python != null; + }; +} |