From: James McCoy <jamessan@debian.org>
Date: Wed, 1 Aug 2018 20:44:36 -0400
Subject: python-builds

Build for multiple python versions.  Patch from Matthias Klose
<doko@debian.org> via Ubuntu.  Mostly, rename libsvn_swig_py to
libsvn_swig_py2.x.

Submitted upstream: http://svn.haxx.se/dev/archive-2008-05/0361.shtml
---
 Makefile.in             |  1 +
 build.conf              | 18 +++++++++---------
 build/ac-macros/swig.m4 |  8 +++++---
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 3e5b392..5340eb0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -148,6 +148,7 @@ BOOST_TEST_CPPFLAGS = @BOOST_CPPFLAGS@ -DBOOST_TEST_DYN_LINK -DBOOST_TEST_NO_MAI
 BOOST_TEST_LDFLAGS = @BOOST_LDFLAGS@ @BOOST_UNIT_TEST_FRAMEWORK_LIB@
 
 SWIG = @SWIG@
+PYTHON_INCLUDES = @PYTHON_INCLUDES@
 SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ @SVN_PY3C_INCLUDES@ -I$(SWIG_SRC_DIR)/python/libsvn_swig_py
 SWIG_PY_COMPILE = @SWIG_PY_COMPILE@
 SWIG_PY_LINK = @SWIG_PY_LINK@
diff --git a/build.conf b/build.conf
index d1d09cd..d1a5748 100644
--- a/build.conf
+++ b/build.conf
@@ -499,7 +499,7 @@ external-project = svn_locale
 type = swig
 path = subversion/bindings/swig
 sources = core.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_diff libsvn_subr apr
 description = Subversion core library bindings
 
@@ -507,7 +507,7 @@ description = Subversion core library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_client.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_client libsvn_subr apr
 nonlibs = swig_core
 description = Subversion client library bindings
@@ -516,7 +516,7 @@ description = Subversion client library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_delta.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_delta libsvn_subr apr
 nonlibs = swig_core
 description = Subversion delta library bindings
@@ -525,7 +525,7 @@ description = Subversion delta library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_diff.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_diff libsvn_subr apr
 nonlibs = swig_core
 description = Subversion diff library bindings
@@ -534,7 +534,7 @@ description = Subversion diff library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_fs.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_fs libsvn_subr apr
 nonlibs = swig_core
 description = Subversion FS library bindings
@@ -543,7 +543,7 @@ description = Subversion FS library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_ra.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_ra libsvn_subr apr
 nonlibs = swig_core
 description = Subversion RA library bindings
@@ -552,7 +552,7 @@ description = Subversion RA library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_repos.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_repos libsvn_subr apr
 nonlibs = swig_core
 description = Subversion repository library bindings
@@ -561,13 +561,13 @@ description = Subversion repository library bindings
 type = swig
 path = subversion/bindings/swig
 sources = svn_wc.i
-libs = libsvn_swig_py libsvn_swig_perl libsvn_swig_ruby
+libs = libsvn_swig_py$(PYVER) libsvn_swig_perl libsvn_swig_ruby
        libsvn_wc libsvn_subr apr
 nonlibs = swig_core
 description = Subversion WC library bindings
 
 # SWIG utility library for Python modules
-[libsvn_swig_py]
+[libsvn_swig_py$(PYVER)]
 type = swig_lib
 lang = python
 path = subversion/bindings/swig/python/libsvn_swig_py
diff --git a/build/ac-macros/swig.m4 b/build/ac-macros/swig.m4
index 167007d..246170a 100644
--- a/build/ac-macros/swig.m4
+++ b/build/ac-macros/swig.m4
@@ -105,7 +105,6 @@ AC_DEFUN(SVN_FIND_SWIG,
   fi
 ])
 
-
 AC_DEFUN(SVN_DETERMINE_SWIG_OPTS,
 [
   m4_ifndef([SVN_RELEASE_MODE],
@@ -128,7 +127,8 @@ suitable Python interpreter is not found."
         AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[
         ac_cv_python_includes="`$SWIG_PY_PYTHON ${abs_srcdir}/build/get-py-info.py --includes`"
         ])
-        SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) $ac_cv_python_includes"
+        PYTHON_INCLUDES="$ac_cv_python_includes"
+        SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) \$(PYTHON_INCLUDES)"
 
         if test "$ac_cv_python_includes" = "none"; then
           SWIG_PY_ERRMSG="no distutils found"
@@ -390,7 +390,8 @@ suitable Python interpreter is not found."
       AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[
         ac_cv_python_includes="`$SWIG_PY_PYTHON ${abs_srcdir}/build/get-py-info.py --includes`"
       ])
-      SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) $ac_cv_python_includes"
+      PYTHON_INCULDES="$ac_cv_python_includes"
+      SWIG_PY_INCLUDES="\$(SWIG_INCLUDES) \$(PYTHON_INCLUDES)"
 
       if test "$ac_cv_python_includes" = "none"; then
         SWIG_PY_ERRMSG="no distutils found"
@@ -583,6 +584,7 @@ int main()
     fi
   ])
   AC_SUBST(SWIG)
+  AC_SUBST(PYTHON_INCLUDES)
   AC_SUBST(SWIG_PY_INCLUDES)
   AC_SUBST(SWIG_PY_COMPILE)
   AC_SUBST(SWIG_PY_LINK)
