commit:     aebffaa19773d23d9766b3eae5a45c46fdd0831d
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 11 21:33:33 2015 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Wed Nov 11 21:34:53 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aebffaa1

dev-libs/libxslt: apply several upstream patches, bug #558822

Apply security fixes, bug #558822 as well as patches from upstream as listed
in debian package.

Also rework python detection with AM_PATH_PYTHON for easier multiple python
support in the future. Handle examples like in libxml2.

Package-Manager: portage-2.2.24

 ...bxslt-1.1.28-attribute-type-preprocessing.patch |  29 +++
 .../libxslt-1.1.28-broken-fprintf-parameters.patch |  52 +++++
 .../libxslt-1.1.28-disable-static-modules.patch    |  33 +++
 .../files/libxslt-1.1.28-exslt-str-replace.patch   |  42 ++++
 .../files/libxslt-1.1.28-fix-quoting-xlocale.patch |  47 ++++
 ...bxslt-1.1.28-seed-pseudo-random-generator.patch |  60 +++++
 .../files/libxslt-1.1.28-simplify-python.patch     | 251 +++++++++++++++++++++
 dev-libs/libxslt/libxslt-1.1.28-r5.ebuild          | 145 ++++++++++++
 8 files changed, 659 insertions(+)

diff --git 
a/dev-libs/libxslt/files/libxslt-1.1.28-attribute-type-preprocessing.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-attribute-type-preprocessing.patch
new file mode 100644
index 0000000..fbcd7ea
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-attribute-type-preprocessing.patch
@@ -0,0 +1,29 @@
+From 7ca19df892ca22d9314e95d59ce2abdeff46b617 Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veill...@redhat.com>
+Date: Thu, 29 Oct 2015 19:33:23 +0800
+Subject: Fix for type confusion in preprocessing attributes
+
+CVE-2015-7995 http://www.openwall.com/lists/oss-security/2015/10/27/10
+We need to check that the parent node is an element before dereferencing
+its namespace
+---
+ libxslt/preproc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/libxslt/preproc.c b/libxslt/preproc.c
+index 0eb80a0..7f69325 100644
+--- a/libxslt/preproc.c
++++ b/libxslt/preproc.c
+@@ -2249,7 +2249,8 @@ xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr 
inst) {
+       } else if (IS_XSLT_NAME(inst, "attribute")) {
+           xmlNodePtr parent = inst->parent;
+ 
+-          if ((parent == NULL) || (parent->ns == NULL) ||
++          if ((parent == NULL) ||
++              (parent->type != XML_ELEMENT_NODE) || (parent->ns == NULL) ||
+               ((parent->ns != inst->ns) &&
+                (!xmlStrEqual(parent->ns->href, inst->ns->href))) ||
+               (!xmlStrEqual(parent->name, BAD_CAST "attribute-set"))) {
+-- 
+cgit v0.11.2
+

diff --git 
a/dev-libs/libxslt/files/libxslt-1.1.28-broken-fprintf-parameters.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-broken-fprintf-parameters.patch
new file mode 100644
index 0000000..de242f9
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-broken-fprintf-parameters.patch
@@ -0,0 +1,52 @@
+From 90e8b9066d877e040e791bbf206db0e5653e017a Mon Sep 17 00:00:00 2001
+From: Daniel Veillard <veill...@redhat.com>
+Date: Wed, 30 Jan 2013 17:31:37 +0100
+Subject: Fix a couple of places where (f)printf parameters were broken
+
+As reported by Thomas Jarosch <thomas.jaro...@intra2net.com>
+---
+ python/libxslt.c    | 10 +++++-----
+ xsltproc/xsltproc.c |  2 +-
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/python/libxslt.c b/python/libxslt.c
+index 6a4f1c3..8dd6c78 100644
+--- a/python/libxslt.c
++++ b/python/libxslt.c
+@@ -356,15 +356,15 @@ libxslt_xsltRegisterExtModuleElement(PyObject *self 
ATTRIBUTE_UNUSED,
+     PyObject *pyobj_element_f;
+     PyObject *pyobj_precomp_f;
+ 
+-#ifdef DEBUG_EXTENSIONS
+-    printf("libxslt_xsltRegisterExtModuleElement called\n",
+-         name, ns_uri);
+-#endif
+-
+     if (!PyArg_ParseTuple(args, (char *)"szOO:registerExtModuleElement",
+                         &name, &ns_uri, &pyobj_precomp_f, &pyobj_element_f))
+         return(NULL);
+ 
++#ifdef DEBUG_EXTENSIONS
++    printf("libxslt_xsltRegisterExtModuleElement called: %s %s\n",
++         name, ns_uri);
++#endif
++
+     if ((name == NULL) || (pyobj_element_f == NULL) || (pyobj_precomp_f == 
NULL)) {
+       py_retval = libxml_intWrap(-1);
+       return(py_retval);
+diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c
+index 35f37e8..dfd6d31 100644
+--- a/xsltproc/xsltproc.c
++++ b/xsltproc/xsltproc.c
+@@ -319,7 +319,7 @@ static void endTimer(char *format, ...)
+     va_start(ap, format);
+     vfprintf(stderr,format,ap);
+     va_end(ap);
+-    fprintf(stderr, " was not timed\n", msec);
++    fprintf(stderr, " was not timed\n");
+ #else
+   /* We don't have gettimeofday, time or stdarg.h, what crazy world is
+    * this ?!
+-- 
+cgit v0.11.2
+

diff --git a/dev-libs/libxslt/files/libxslt-1.1.28-disable-static-modules.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-disable-static-modules.patch
new file mode 100644
index 0000000..b30a084
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-disable-static-modules.patch
@@ -0,0 +1,33 @@
+From 06c9dba42097b06a18c81bb54a8da8b2bfaf991d Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <e...@gentoo.org>
+Date: Wed, 11 Nov 2015 20:01:14 +0100
+Subject: [PATCH 3/3] Disable static module for python module
+
+---
+ python/Makefile.am | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/python/Makefile.am b/python/Makefile.am
+index cc13c62..62afd1b 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -27,6 +27,7 @@ python_PYTHON = libxslt.py
+ pyexec_LTLIBRARIES = libxsltmod.la
+ 
+ libxsltmod_la_CPPFLAGS = \
++      -shared \
+       -I$(top_srcdir)/libxslt \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/libexslt \
+@@ -34,7 +35,7 @@ libxsltmod_la_CPPFLAGS = \
+ libxsltmod_la_SOURCES = libxslt.c types.c
+ nodist_libxsltmod_la_SOURCES = libxslt-py.c
+ libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS)
+-libxsltmod_la_LDFLAGS =  $(WIN32_EXTRA_LDFLAGS) $(PYTHON_LDFLAGS) -module 
-avoid-version
++libxsltmod_la_LDFLAGS =  $(WIN32_EXTRA_LDFLAGS) $(PYTHON_LDFLAGS) -module 
-avoid-version -shared
+ 
+ libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
+       cat $(srcdir)/libxsl.py libxsltclass.py > $@
+-- 
+2.6.3
+

diff --git a/dev-libs/libxslt/files/libxslt-1.1.28-exslt-str-replace.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-exslt-str-replace.patch
new file mode 100644
index 0000000..b0efa6a
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-exslt-str-replace.patch
@@ -0,0 +1,42 @@
+From ae49d7a73b043bccb7631e7d9577bcaa0bbf8528 Mon Sep 17 00:00:00 2001
+From: Nick Wellnhofer <wellnho...@aevum.de>
+Date: Mon, 1 Jul 2013 21:10:10 +0800
+Subject: EXSLT function str:replace() is broken as-is
+
+the str:replace() function is no longer usable without a transform
+context. I take it from the bug report that it is not supposed to be used
+from plain XPath but only from XSLT according to the EXSLT specification.
+
+However, the previous implementation used to work in XPath and is still
+registered on an xmlXPathContext by the exsltStrXpathCtxtRegister()
+function. When called from plain XPath, it results in a memory error in
+line 526 (exsltStrReturnString()) of strings.c because xsltCreateRVT()
+returns NULL as an error indicator due to a NULL transform context being
+passed in, which was the return value from xsltXPathGetTransformContext() a
+bit further up (and the code doesn't validate that).
+
+Since fixing the function looks impossible, best is to remove it.
+---
+ libexslt/strings.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/libexslt/strings.c b/libexslt/strings.c
+index 045cc14..c0c7a18 100644
+--- a/libexslt/strings.c
++++ b/libexslt/strings.c
+@@ -838,11 +838,7 @@ exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const 
xmlChar *prefix)
+         && !xmlXPathRegisterFuncNS(ctxt,
+                                    (const xmlChar *) "concat",
+                                    (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+-                                   exsltStrConcatFunction)
+-        && !xmlXPathRegisterFuncNS(ctxt,
+-                                   (const xmlChar *) "replace",
+-                                   (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
+-                                   exsltStrReplaceFunction)) {
++                                   exsltStrConcatFunction)) {
+         return 0;
+     }
+     return -1;
+-- 
+cgit v0.11.2
+

diff --git a/dev-libs/libxslt/files/libxslt-1.1.28-fix-quoting-xlocale.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-fix-quoting-xlocale.patch
new file mode 100644
index 0000000..1acdb2e
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-fix-quoting-xlocale.patch
@@ -0,0 +1,47 @@
+From 0a1a5f8c67c90637f0ea3fdc9ec35280d54878d8 Mon Sep 17 00:00:00 2001
+From: Nick Wellnhofer <wellnho...@aevum.de>
+Date: Tue, 30 Jul 2013 13:57:28 +0200
+Subject: Fix quoting of xlocale test program in configure.in
+
+Double square brackets aren't needed anymore, probably due to the
+changes in commit a2cd8a03.
+---
+ configure.in | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index fc8d5a8..dcbd971 100644
+--- a/configure.in
++++ b/configure.in
+@@ -196,21 +196,21 @@ typedef locale_t xsltLocale;
+ #endif
+ ]],[[
+     xsltLocale locale;
+-    const char *src[[2]] = { "\xc3\x84rger", "Zeppelin" };
+-    char *dst[[2]];
++    const char *src[2] = { "\xc3\x84rger", "Zeppelin" };
++    char *dst[2];
+     size_t len, r;
+     int i;
+ 
+     locale = newlocale(LC_COLLATE_MASK, "en_US.utf8", NULL);
+     if (locale == NULL) exit(1);
+     for (i=0; i<2; ++i) {
+-        len = strxfrm_l(NULL, src[[i]], 0, locale) + 1;
+-        dst[[i]] = malloc(len);
+-        if(dst[[i]] == NULL) exit(1);
+-        r = strxfrm_l(dst[[i]], src[[i]], len, locale);
++        len = strxfrm_l(NULL, src[i], 0, locale) + 1;
++        dst[i] = malloc(len);
++        if(dst[i] == NULL) exit(1);
++        r = strxfrm_l(dst[i], src[i], len, locale);
+         if(r >= len) exit(1);
+     }
+-    if (strcmp(dst[[0]], dst[[1]]) >= 0) exit(1);
++    if (strcmp(dst[0], dst[1]) >= 0) exit(1);
+ 
+     exit(0);
+     return(0);
+-- 
+cgit v0.11.2
+

diff --git 
a/dev-libs/libxslt/files/libxslt-1.1.28-seed-pseudo-random-generator.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-seed-pseudo-random-generator.patch
new file mode 100644
index 0000000..580fb29
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-seed-pseudo-random-generator.patch
@@ -0,0 +1,60 @@
+From 3fcf11ead6ad226227b0a3ef4cc6565b8d5857ff Mon Sep 17 00:00:00 2001
+From: Nils Werner <werne...@iis.fraunhofer.de>
+Date: Thu, 24 Jan 2013 19:44:03 +0100
+Subject: Initialize pseudo random number generator with current time or
+ optional command line parameter
+
+---
+ xsltproc/xsltproc.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/xsltproc/xsltproc.c b/xsltproc/xsltproc.c
+index dfd6d31..45adf5d 100644
+--- a/xsltproc/xsltproc.c
++++ b/xsltproc/xsltproc.c
+@@ -514,6 +514,7 @@ static void usage(const char *name) {
+     printf("\t--maxdepth val : increase the maximum depth (default %d)\n", 
xsltMaxDepth);
+     printf("\t--maxvars val : increase the maximum variables (default %d)\n", 
xsltMaxVars);
+     printf("\t--maxparserdepth val : increase the maximum parser depth\n");
++    printf("\t--seed-rand val : initialize pseudo random number generator 
with specific seed\n");
+ #ifdef LIBXML_HTML_ENABLED
+     printf("\t--html: the input document is(are) an HTML file(s)\n");
+ #endif
+@@ -556,6 +557,7 @@ main(int argc, char **argv)
+         return (1);
+     }
+ 
++    srand(time(NULL));
+     xmlInitMemory();
+ 
+     LIBXML_TEST_VERSION
+@@ -750,6 +752,15 @@ main(int argc, char **argv)
+                 if (value > 0)
+                     xmlParserMaxDepth = value;
+             }
++        } else if ((!strcmp(argv[i], "-seed-rand")) ||
++                   (!strcmp(argv[i], "--seed-rand"))) {
++            int value;
++
++            i++;
++            if (sscanf(argv[i], "%d", &value) == 1) {
++                if (value > 0)
++                    srand(value);
++            }
+         } else if ((!strcmp(argv[i],"-dumpextensions"))||
+                       (!strcmp(argv[i],"--dumpextensions"))) {
+               dumpextensions++;
+@@ -786,6 +797,10 @@ main(int argc, char **argv)
+             (!strcmp(argv[i], "--maxparserdepth"))) {
+             i++;
+             continue;
++        } else if ((!strcmp(argv[i], "-seed-rand")) ||
++            (!strcmp(argv[i], "--seed-rand"))) {
++            i++;
++            continue;
+         } else if ((!strcmp(argv[i], "-o")) ||
+                    (!strcmp(argv[i], "-output")) ||
+                    (!strcmp(argv[i], "--output"))) {
+-- 
+cgit v0.11.2
+

diff --git a/dev-libs/libxslt/files/libxslt-1.1.28-simplify-python.patch 
b/dev-libs/libxslt/files/libxslt-1.1.28-simplify-python.patch
new file mode 100644
index 0000000..678b002
--- /dev/null
+++ b/dev-libs/libxslt/files/libxslt-1.1.28-simplify-python.patch
@@ -0,0 +1,251 @@
+From 6fb632732a28fc5c5c8f20a7be8ded759acd8994 Mon Sep 17 00:00:00 2001
+From: Gilles Dartiguelongue <e...@gentoo.org>
+Date: Wed, 11 Nov 2015 17:49:07 +0100
+Subject: [PATCH] Simplify python setup in autoconf
+
+AM_PATH_PYTHON does most of the job without using pkg-config as expected
+from the rest of the autoconf script.
+---
+ Makefile.am        |  14 +++++--
+ configure.in       | 119 ++++++++++++++---------------------------------------
+ python/Makefile.am |  30 ++++----------
+ 3 files changed, 49 insertions(+), 114 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index e357f19..c396913 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2,9 +2,13 @@ SUBDIRS = \
+       libxslt \
+       libexslt \
+       xsltproc \
+-      doc \
+-      $(PYTHON_SUBDIR) \
+-      tests
++      doc
++
++if WITH_PYTHON
++SUBDIRS += python
++endif
++
++SUBDIRS += tests
+ 
+ DIST_SUBDIRS = libxslt libexslt xsltproc python doc tests
+ 
+@@ -51,7 +55,9 @@ tests: dummy
+       @echo '## Running the regression test suite'
+       @(cd tests ; $(MAKE) tests)
+       @(cd xsltproc ; $(MAKE) tests)
+-      @(if [ "$(PYTHON_SUBDIR)" != "" ] ; then cd python ; $(MAKE) tests ; fi)
++if WITH_PYTHON
++      @(cd python ; $(MAKE) tests)
++endif
+ 
+ valgrind:
+       @echo '## Running the regression tests under Valgrind'
+diff --git a/configure.in b/configure.in
+index e84ad4f..27c0e0e 100644
+--- a/configure.in
++++ b/configure.in
+@@ -291,90 +291,37 @@ dnl
+ dnl check for python
+ dnl
+ 
+-PYTHON_VERSION=
+-PYTHON_INCLUDES=
+-PYTHON_SITE_PACKAGES=
+-pythondir=
+-AC_ARG_WITH(python, [  --with-python[=DIR]    Build Python bindings if found])
+-if test "$with_python" != "no" ; then
+-    if test -x "$with_python/bin/python"
+-    then
+-        echo Found python in $with_python/bin/python
+-        PYTHON="$with_python/bin/python"
+-    else
+-      if test -x "$with_python"
+-      then
+-          echo Found python in $with_python
+-          PYTHON="$with_python"
+-      else
+-            if test -x "$PYTHON"
+-            then
+-                echo Found python in environment PYTHON=$PYTHON
+-                with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+-          else
+-              AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 
python2.1 python2.0 python1.6 python1.5)
+-          fi
+-      fi
+-    fi
+-    if test "$PYTHON" != ""
+-    then
+-        echo "PYTHON is pointing at $PYTHON"
+-        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+-      echo Found Python version $PYTHON_VERSION
+-      LIBXML2_PYTHON=`$PYTHON -c "try : import libxml2 ; print 1
+-except: print 0"`
+-      if test "$LIBXML2_PYTHON" = "1"
+-      then
+-          echo Found libxml2-python module
+-      else
+-          echo Warning: Missing libxml2-python
+-      fi
+-    fi
+-    if test "$PYTHON_VERSION" != ""
+-    then
+-      if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
+-         -d $with_python/lib/python$PYTHON_VERSION/site-packages
+-      then
+-          PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
+-          
PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+-      else
+-          if test -r $prefix/include/python$PYTHON_VERSION/Python.h
+-          then
+-              PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
+-              
PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+-          else
+-              if test -r /usr/include/python$PYTHON_VERSION/Python.h
+-              then
+-                  PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
+-                  
PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+-              else
+-                  echo could not find python$PYTHON_VERSION/Python.h
+-              fi
+-          fi
+-          if test ! -d "$PYTHON_SITE_PACKAGES"
+-          then
+-                  PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import 
sysconfig; print sysconfig.get_python_lib()"`
+-          fi
+-      fi
+-        PYTHON_LIBS=`python$PYTHON_VERSION-config --libs`
+-    fi
+-    if test "$with_python" != ""
+-    then
+-        pythondir='$(PYTHON_SITE_PACKAGES)'
+-    else
+-        pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+-    fi
+-fi
+-AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
+-if test "$PYTHON_INCLUDES" != ""
+-then
+-    PYTHON_SUBDIR=python
+-else
+-    PYTHON_SUBDIR=
+-fi
+-AC_SUBST(pythondir)
+-AC_SUBST(PYTHON_SUBDIR)
+-AC_SUBST(PYTHON_LIBS)
++AC_ARG_WITH([python],
++    AS_HELP_STRING([--with-python], [Build Python bindings if found])
++)
++
++AS_IF([test "$with_python" = "yes"],
++      [AM_PATH_PYTHON
++       AC_PATH_TOOL([PYTHON_CONFIG], [python$PYTHON_VERSION-config], [no])
++       AS_IF([test "$PYTHON_CONFIG" = "no"],
++             [AC_PATH_TOOL([PYTHON_CONFIG], [python-config], [no])])
++       AS_IF([test "$PYTHON_CONFIG" != "no"],
++             [PYTHON_CFLAGS=`$PYTHON_CONFIG --cflags`
++              PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
++              PYTHON_LIBS=`$PYTHON_CONFIG --libs`],
++             [AC_MSG_ERROR([Missing python development files.])])
++       AC_MSG_CHECKING([libxml2 module in $PYTHON])
++         LIBXML2_PYTHON=`$PYTHON -c "import sys;
++try:
++    import libxml2
++    sys.stdout.write('1')
++except:
++    sys.stdout.write('0')"`
++       AS_IF([test "$LIBXML2_PYTHON" = "1"],
++             [AC_MSG_RESULT([yes])],
++             [AC_MSG_RESULT([no])
++              AC_MSG_WARN([libxml2 python module not found, expect runtime 
errors])])
++      ])
++
++AM_CONDITIONAL([WITH_PYTHON], [test "$PYTHON" != ""])
++AC_SUBST([PYTHON_CFLAGS])
++AC_SUBST([PYTHON_LDFLAGS])
++AC_SUBST([PYTHON_LIBS])
+ 
+ AC_ARG_WITH(crypto, [  --with-crypto           Add crypto support to exslt 
(on)])
+ WITH_CRYPTO=0
+@@ -644,10 +591,6 @@ AC_SUBST(PYTHONSODV)
+ AC_SUBST(XML_CONFIG)
+ AC_SUBST(LIBXML_LIBS)
+ AC_SUBST(LIBXML_CFLAGS)
+-AC_SUBST(PYTHON)
+-AC_SUBST(PYTHON_VERSION)
+-AC_SUBST(PYTHON_INCLUDES)
+-AC_SUBST(PYTHON_SITE_PACKAGES)
+ 
+ XSLT_LIBDIR='-L${libdir}'
+ XSLT_INCLUDEDIR='-I${includedir}'
+diff --git a/python/Makefile.am b/python/Makefile.am
+index fa58b78..cc13c62 100644
+--- a/python/Makefile.am
++++ b/python/Makefile.am
+@@ -5,9 +5,9 @@ SUBDIRS= . tests
+ 
+ AM_CFLAGS = $(LIBXML_CFLAGS)
+ 
+-DOCS_DIR = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)
++docsdir = $(datadir)/doc/libxslt-python-$(LIBXSLT_VERSION)
+ # libxsltclass.txt is generated
+-DOCS = TODO
++dist_docs_DATA = TODO
+ 
+ EXTRA_DIST =                  \
+       libxslt.c               \
+@@ -16,43 +16,29 @@ EXTRA_DIST =                       \
+       libxml_wrap.h           \
+       libxslt_wrap.h          \
+       libxsl.py               \
+-      libxslt-python-api.xml  \
+-      $(DOCS)
+-
+-libxsltmod_la_LDFLAGS =  $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
++      libxslt-python-api.xml
+ 
+ if WITH_PYTHON
+ mylibs = \
+       $(top_builddir)/libxslt/libxslt.la \
+       $(top_builddir)/libexslt/libexslt.la
+ 
+-all-local: libxslt.py
+-
+-python_LTLIBRARIES = libxsltmod.la
++python_PYTHON = libxslt.py
++pyexec_LTLIBRARIES = libxsltmod.la
+ 
+ libxsltmod_la_CPPFLAGS = \
+-      -I$(PYTHON_INCLUDES) \
+       -I$(top_srcdir)/libxslt \
+       -I$(top_srcdir) \
+-      -I../libexslt
++      -I$(top_srcdir)/libexslt \
++      $(PYTHON_CFLAGS)
+ libxsltmod_la_SOURCES = libxslt.c types.c
+ nodist_libxsltmod_la_SOURCES = libxslt-py.c
+ libxsltmod_la_LIBADD = $(mylibs) $(PYTHON_LIBS)
++libxsltmod_la_LDFLAGS =  $(WIN32_EXTRA_LDFLAGS) $(PYTHON_LDFLAGS) -module 
-avoid-version
+ 
+ libxslt.py: $(srcdir)/libxsl.py libxsltclass.py
+       cat $(srcdir)/libxsl.py libxsltclass.py > $@
+ 
+-install-data-local:
+-      $(MKDIR_P) $(DESTDIR)$(pythondir)
+-      $(INSTALL) -m 0644 libxslt.py $(DESTDIR)$(pythondir)
+-      $(MKDIR_P) $(DESTDIR)$(DOCS_DIR)
+-      @(for doc in $(DOCS) ; \
+-         do $(INSTALL) -m 0644 $(srcdir)/$$doc $(DESTDIR)$(DOCS_DIR) ; done)
+-
+-uninstall-local:
+-      rm -f $(DESTDIR)$(pythondir)/libxslt.py
+-      rm -rf $(DESTDIR)$(DOCS_DIR)
+-
+ GENERATE = generator.py
+ API_DESC = $(top_srcdir)/doc/libxslt-api.xml $(srcdir)/libxslt-python-api.xml
+ GENERATED= libxsltclass.py \
+-- 
+2.6.3
+

diff --git a/dev-libs/libxslt/libxslt-1.1.28-r5.ebuild 
b/dev-libs/libxslt/libxslt-1.1.28-r5.ebuild
new file mode 100644
index 0000000..e25e7f2
--- /dev/null
+++ b/dev-libs/libxslt/libxslt-1.1.28-r5.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="xml"
+
+inherit autotools eutils python-r1 toolchain-funcs multilib-minimal
+
+DESCRIPTION="XSLT libraries and tools"
+HOMEPAGE="http://www.xmlsoft.org/";
+SRC_URI="ftp://xmlsoft.org/${PN}/${P}.tar.gz";
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd 
~x86-freebsd ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~x86-linux 
~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris 
~x64-solaris ~x86-solaris"
+IUSE="crypt debug examples python static-libs"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="
+       >=dev-libs/libxml2-2.9.1-r5:2[${MULTILIB_USEDEP}]
+       crypt?  ( >=dev-libs/libgcrypt-1.5.3:0=[${MULTILIB_USEDEP}] )
+       python? (
+               ${PYTHON_DEPS}
+               dev-libs/libxml2:2[python,${PYTHON_USEDEP}] )
+       abi_x86_32? (
+               !<=app-emulation/emul-linux-x86-baselibs-20131008-r20
+               !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+       )
+"
+DEPEND="${RDEPEND}"
+
+MULTILIB_CHOST_TOOLS=(
+       /usr/bin/xslt-config
+)
+
+src_prepare() {
+       DOCS=( AUTHORS ChangeLog FEATURES NEWS README TODO )
+
+       # https://bugzilla.gnome.org/show_bug.cgi?id=684621
+       epatch "${FILESDIR}"/${PN}.m4-${PN}-1.1.26.patch
+
+       # use AC_PATH_TOOL for libgcrypt-config for sane cross-compile and 
multilib support
+       # https://bugzilla.gnome.org/show_bug.cgi?id=725635
+       # same for xml2-config
+       # https://bugs.gentoo.org/show_bug.cgi?id=518728
+       epatch "${FILESDIR}"/${PN}-1.1.28-AC_PATH_TOOL.patch
+
+       # Apply patches from master found in debian
+       epatch \
+               "${FILESDIR}"/${PN}-1.1.28-broken-fprintf-parameters.patch \
+               "${FILESDIR}"/${PN}-1.1.28-exslt-str-replace.patch \
+               "${FILESDIR}"/${PN}-1.1.28-fix-quoting-xlocale.patch \
+               "${FILESDIR}"/${PN}-1.1.28-seed-pseudo-random-generator.patch
+
+       # Fix null pointer dereference, from master
+       # https://bugs.gentoo.org/show_bug.cgi?id=558822
+       epatch "${FILESDIR}"/${PN}-1.1.28-attribute-type-preprocessing.patch
+
+       # Simplify python setup
+       epatch "${FILESDIR}"/${PN}-1.1.28-simplify-python.patch
+       epatch "${FILESDIR}"/${PN}-1.1.28-disable-static-modules.patch
+
+       mv configure.{in,ac} || die
+
+       eautoreconf
+       # If eautoreconf'd with new autoconf, then epunt_cxx is not necessary
+       # and it is propably otherwise too if upstream generated with new
+       # autoconf
+#      epunt_cxx
+       # But Prefix always needs elibtoolize if not eautoreconf'd.
+#      elibtoolize
+}
+
+multilib_src_configure() {
+       libxslt_configure() {
+               ECONF_SOURCE="${S}" econf \
+                       --with-html-dir="${EPREFIX}"/usr/share/doc/${PF} \
+                       --with-html-subdir=html \
+                       $(use_with crypt crypto) \
+                       $(use_with debug) \
+                       $(use_with debug mem-debug) \
+                       $(use_enable static-libs static) \
+                       "$@"
+       }
+
+       libxslt_py_configure() {
+               mkdir -p "${BUILD_DIR}" || die # ensure python build dirs exist
+               run_in_build_dir libxslt_configure --with-python
+       }
+
+       libxslt_configure --without-python # build python bindings separately
+
+       if multilib_is_native_abi && use python; then
+               python_foreach_impl libxslt_py_configure
+       fi
+}
+
+multilib_src_compile() {
+       default
+       multilib_is_native_abi && use python && libxslt_foreach_py_emake all
+}
+
+multilib_src_test() {
+       default
+       multilib_is_native_abi && use python && libxslt_foreach_py_emake test
+}
+
+multilib_src_install() {
+       # "default" does not work here - docs are installed by 
multilib_src_install_all
+       emake DESTDIR="${D}" install
+
+       if multilib_is_native_abi && use python; then
+               libxslt_foreach_py_emake \
+                       DESTDIR="${D}" \
+                       docsdir="${EPREFIX}"/usr/share/doc/${PF}/python \
+                       
EXAMPLE_DIR="${EPREFIX}"/usr/share/doc/${PF}/python/examples \
+                       install
+               python_foreach_impl python_optimize
+       fi
+}
+
+multilib_src_install_all() {
+       einstalldocs
+
+       if ! use examples; then
+               rm -rf "${ED}"/usr/share/doc/${PF}/examples
+               rm -rf "${ED}"/usr/share/doc/${PF}/python/examples
+       fi
+
+       prune_libtool_files --modules
+}
+
+libxslt_foreach_py_emake() {
+       libxslt_py_emake() {
+               pushd "${BUILD_DIR}/python" > /dev/null || die
+               emake "$@"
+               popd > /dev/null
+       }
+       local native_builddir=${BUILD_DIR}
+       python_foreach_impl libxslt_py_emake top_builddir="${native_builddir}" 
"$@"
+}

Reply via email to