Merge pull request #20251 from FRidh/xslt

libxml2 and libxslt python bindings
This commit is contained in:
Frederik Rietdijk 2016-11-08 17:11:29 +01:00 committed by GitHub
commit cb5687a346
4 changed files with 32 additions and 14 deletions

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchurl, zlib, xz, python2, findXMLCatalogs, libiconv, fetchpatch { stdenv, lib, fetchurl, zlib, xz, python2, findXMLCatalogs, libiconv, fetchpatch
, supportPython ? (! stdenv ? cross) }: , pythonSupport ? (! stdenv ? cross) }:
let let
python = python2; python = python2;
@ -28,10 +28,10 @@ in stdenv.mkDerivation rec {
}; };
outputs = [ "bin" "dev" "out" "doc" ] outputs = [ "bin" "dev" "out" "doc" ]
++ lib.optional supportPython "py"; ++ lib.optional pythonSupport "py";
propagatedBuildOutputs = "out bin" + lib.optionalString supportPython " py"; propagatedBuildOutputs = "out bin" + lib.optionalString pythonSupport " py";
buildInputs = lib.optional supportPython python buildInputs = lib.optional pythonSupport python
# Libxml2 has an optional dependency on liblzma. However, on impure # Libxml2 has an optional dependency on liblzma. However, on impure
# platforms, it may end up using that from /usr/lib, and thus lack a # platforms, it may end up using that from /usr/lib, and thus lack a
# RUNPATH for that, leading to undefined references for its users. # RUNPATH for that, leading to undefined references for its users.
@ -39,7 +39,7 @@ in stdenv.mkDerivation rec {
propagatedBuildInputs = [ zlib findXMLCatalogs ]; propagatedBuildInputs = [ zlib findXMLCatalogs ];
configureFlags = lib.optional supportPython "--with-python=${python}" configureFlags = lib.optional pythonSupport "--with-python=${python}"
++ [ "--exec_prefix=$dev" ]; ++ [ "--exec_prefix=$dev" ];
enableParallelBuilding = true; enableParallelBuilding = true;
@ -55,9 +55,9 @@ in stdenv.mkDerivation rec {
propagatedBuildInputs = [ findXMLCatalogs libiconv ]; propagatedBuildInputs = [ findXMLCatalogs libiconv ];
}; };
preInstall = lib.optionalString supportPython preInstall = lib.optionalString pythonSupport
''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"''; ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"'';
installFlags = lib.optionalString supportPython installFlags = lib.optionalString pythonSupport
''pythondir="$(py)/lib/${python.libPrefix}/site-packages"''; ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"'';
postFixup = '' postFixup = ''
@ -66,7 +66,7 @@ in stdenv.mkDerivation rec {
moveToOutput share/man/man1 "$bin" moveToOutput share/man/man1 "$bin"
''; '';
passthru = { inherit version; pythonSupport = supportPython; }; passthru = { inherit version; pythonSupport = pythonSupport; };
meta = { meta = {
homepage = http://xmlsoft.org/; homepage = http://xmlsoft.org/;

View File

@ -1,4 +1,9 @@
{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs }: { stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs
, pythonSupport ? true, python2
}:
assert pythonSupport -> python2 != null;
assert pythonSupport -> libxml2.pythonSupport;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libxslt-1.1.29"; name = "libxslt-1.1.29";
@ -10,26 +15,33 @@ stdenv.mkDerivation rec {
patches = stdenv.lib.optional stdenv.isSunOS ./patch-ah.patch; patches = stdenv.lib.optional stdenv.isSunOS ./patch-ah.patch;
outputs = [ "bin" "dev" "out" "doc" ]; outputs = [ "bin" "dev" "out" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2.dev ] ++ stdenv.lib.optionals pythonSupport [ libxml2.py python2 ];
propagatedBuildInputs = [ findXMLCatalogs ]; propagatedBuildInputs = [ findXMLCatalogs ];
configureFlags = [ configureFlags = [
"--without-python"
"--without-crypto" "--without-crypto"
"--without-debug" "--without-debug"
"--without-mem-debug" "--without-mem-debug"
"--without-debugger" "--without-debugger"
]; ] ++ stdenv.lib.optional pythonSupport "--with-python=${python2}";
postFixup = '' postFixup = ''
moveToOutput bin/xslt-config "$dev" moveToOutput bin/xslt-config "$dev"
moveToOutput lib/xsltConf.sh "$dev" moveToOutput lib/xsltConf.sh "$dev"
moveToOutput share/man/man1 "$bin" moveToOutput share/man/man1 "$bin"
'' + stdenv.lib.optionalString pythonSupport ''
mkdir -p $py/nix-support
echo ${libxml2.py} >> $py/nix-support/propagated-native-build-inputs
moveToOutput lib/python2.7 "$py"
''; '';
passthru = {
inherit pythonSupport;
};
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://xmlsoft.org/XSLT/; homepage = http://xmlsoft.org/XSLT/;
description = "A C library and tools to do XSL transformations"; description = "A C library and tools to do XSL transformations";

View File

@ -10,7 +10,7 @@ with pkgs; rec {
libxml2 = (pkgs.libxml2.override { libxml2 = (pkgs.libxml2.override {
stdenv = emscriptenStdenv; stdenv = emscriptenStdenv;
supportPython = false; pythonSupport = false;
}).overrideDerivation }).overrideDerivation
(old: { (old: {
buildInputs = old.buildInputs ++ [ autoreconfHook pkgconfig zlib nodejs ]; buildInputs = old.buildInputs ++ [ autoreconfHook pkgconfig zlib nodejs ];

View File

@ -13447,6 +13447,12 @@ in {
clblas = pkgs.clblas-cuda; clblas = pkgs.clblas-cuda;
}; };
libxml2 = if isPy3k then throw "libxml2 not supported for interpreter ${python.executable}" else
(pkgs.libxml2.override{pythonSupport=true; python2=python;}).py;
libxslt = if isPy3k then throw "libxslt not supported for interpreter ${python.executable}" else
(pkgs.libxslt.override{pythonSupport=true; python2=python; inherit (self) libxml2;}).py;
limnoria = buildPythonPackage rec { limnoria = buildPythonPackage rec {
name = "limnoria-${version}"; name = "limnoria-${version}";
version = "2016.05.06"; version = "2016.05.06";