On 2020/05/12 23:17, Branko Čibej wrote:
> On 12.05.2020 15:05, Yasuhito FUTATSUKI wrote:
>> On 2020/05/12 20:14, Daniel Shahaf wrote:
>>> As Yasuhito said, passing PYTHON=none is not a satisfactory workaround
>>> since it breaks «make check». Hence, I proposed adding a dedicated
>>> knob. Do you see a better solution?
>> One of the solutions is to make an other variable to specifiy
>> Python path for SWIG Python bindings, like TARGET_PYTHON or more
>> good name. (I tried it for the purpose to enable build Python 2 and
>> Python 3 bindings in a same build tree[1], though it used bad names
>> for this purpose, PYTHON2 and PYTHON3)
>>
>> Additionally I think it is nice to add argument like
>> --with-swig-python(=bindings target python path)|--without-swig-python
>> --with-swig-ruby(=bindings targe ruby path)|--without-swig-ruby
>> --with-swig-perl(=bindings target perl path)|--without-swig-perl
>>
>> I think symmetricalness of those options/variables are important,
>> but I have no idea how to resolve of asymmetric of PERL, PYTHON,
>> and RUBY variables.
>
>
> Can we just say that it was a mistake to look at the environment (e.g.,
> PERL=none) instead of configure arguments (--without-swig-perl)? I agree
> that adding the proposed flags to configure is the correct solution. We
> could also add a warning for usage of PERL=none and RUBY=none, pointing
> users to the new options instead.
Then I make a patch as a starting point. Could anyone please refine
or rewrite this?
Thanks,
--
Yasuhito FUTATSUKI <[email protected]>/<[email protected]>
configure: Add new option to specify path to swig bindings targets
Before this commit, we could not distinct Python processor for using
as a part of build/test system and for a target of language bindings.
So we've introduced new variable "SWIG_PY_PYTHON" for a target of
the SWIG Python bindings and configure option to specify it.
Also, for the symmetricalness we've introduced "SWIG_PL_PERL" and
"SWIG_RB_RUBY" for the Perl and Ruby SWIG bindings, and options
to specify them.
* configure.ac ():
- Use variables "SWIG_PL_PERL", "SWIG_PY_PYTHON", "SWIG_RB_RUBY" for
target of SWIG Perl, Python, Ruby bindings instead of "PERL",
"PYTHON", "RUBY".
- introduce --with-swig-perl, --with-swig-python, --with-swig-ruby
options for setting variable "SWIG_PL_PERL", "SWIG_PY_PYTHON",
"SWIG_RB_RUBY".
* Makefile.in, build/ac-macros/swig.m4 ():
Use variables "SWIG_PL_PERL", "SWIG_PY_PYTHON", "SWIG_RB_RUBY" for
target of SWIG Perl, Python, Ruby bindings instead of "PERL",
"PYTHON", "RUBY".
* subversion/bindings/swig/INSTALL
(BUILDING SWIG BINDINGS FOR SVN ON UNIX step 2):
- Describe how to specify the path to the target language interpreters
with new introduced options, instead of using environment variable.
- fix the name of glue libraries.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 1878200)
+++ Makefile.in (working copy)
@@ -356,7 +356,7 @@
$(INSTALL_DATA) "$$i" $(DESTDIR)$(swig_pydir); \
done; \
fi; \
- $(PYTHON) -c 'import compileall; \
+ $(SWIG_PY_PYTHON) -c 'import compileall; \
compileall.compile_dir("$(DESTDIR)$(swig_pydir)", 1, "$(swig_pydir)"); \
compileall.compile_dir("$(DESTDIR)$(swig_pydir_extra)", 1, \
"$(swig_pydir_extra)");'
@@ -396,7 +396,8 @@
HTTPD_WHITELIST = @HTTPD_WHITELIST@
PYTHON = @PYTHON@
-PERL = @PERL@
+SWIG_PY_PYTHON = @SWIG_PY_PYTHON@
+SWIG_PL_PERL = @SWIG_PL_PERL@
JDK = @JDK@
JAVA = @JAVA@
@@ -412,7 +413,7 @@
javahl_tests_CLASSPATH=$(JAVA_CLASSPATH)
javahl_compat_tests_CLASSPATH=$(JAVA_CLASSPATH)
-RUBY = @RUBY@
+SWIG_RB_RUBY = @SWIG_RB_RUBY@
RUBY_MAJOR = @RUBY_MAJOR@
RUBY_MINOR = @RUBY_MINOR@
RDOC = @RDOC@
@@ -881,13 +882,13 @@
./config.status subversion/bindings/swig/perl/native/Makefile.PL
$(SWIG_PL_DIR)/native/Makefile: libsvn_swig_perl
$(SWIG_PL_DIR)/native/Makefile.PL
- cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL PREFIX=$(prefix)
+ cd $(SWIG_PL_DIR)/native; $(SWIG_PL_PERL) Makefile.PL PREFIX=$(prefix)
# There is a "readlink -f" command on some systems for the same purpose,
# but it's not as portable (e.g. Mac OS X doesn't have it). These should
# only be used where Python/Perl are known to be available.
READLINK_PY=$(PYTHON) -c 'import sys,os; print(os.path.realpath(sys.argv[1]))'
-READLINK_PL=$(PERL) -e 'use Cwd; print Cwd::realpath(shift)'
+READLINK_PL=$(SWIG_PL_PERL) -e 'use Cwd; print Cwd::realpath(shift)'
swig-pl: autogen-swig-pl $(SWIG_PL_DIR)/native/Makefile
if test "`$(READLINK_PL) $(SWIG_PL_DIR)`" != "`$(READLINK_PL)
$(SWIG_PL_SRC_DIR)`"; then \
@@ -943,7 +944,7 @@
check-swig-py: swig-py
$(TEST_SHLIB_VAR_SWIG_PY) \
cd $(SWIG_PY_DIR); \
- $(PYTHON) $(SWIG_PY_SRC_DIR)/tests/run_all.py
+ $(SWIG_PY_PYTHON) $(SWIG_PY_SRC_DIR)/tests/run_all.py
EXTRACLEAN_SWIG_PY=rm -rf $(SWIG_PY_DIR)/svn_*.c $(SWIG_PY_DIR)/core.c \
$(SWIG_PY_DIR)/[a-z]*.py
@@ -968,7 +969,7 @@
$(TEST_SHLIB_VAR_SWIG_RB) \
cd $(SWIG_RB_DIR); \
check_rb() { \
- $(RUBY) -I $(SWIG_RB_SRC_DIR) $(SWIG_RB_SRC_DIR)/test/run-test.rb
"$$@"; \
+ $(SWIG_RB_RUBY) -I $(SWIG_RB_SRC_DIR)
$(SWIG_RB_SRC_DIR)/test/run-test.rb "$$@"; \
}; \
if check_rb --help 2>&1 | grep -q -- --collector; then \
check_rb --collector=dir --verbose=$(SWIG_RB_TEST_VERBOSE); \
Index: build/ac-macros/swig.m4
===================================================================
--- build/ac-macros/swig.m4 (revision 1878200)
+++ build/ac-macros/swig.m4 (working copy)
@@ -104,11 +104,11 @@
SWIG_PY_LINK="none"
SWIG_PY_OPTS="none"
SWIG_PY_ERRMSG="check config.log for details"
- if test "$PYTHON" != "none"; then
+ if test "$SWIG_PY_PYTHON" != "none"; then
AC_MSG_NOTICE([Configuring python swig binding])
AC_CACHE_CHECK([for Python includes], [ac_cv_python_includes],[
- ac_cv_python_includes="`$PYTHON ${abs_srcdir}/build/get-py-info.py
--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"
@@ -137,17 +137,17 @@
AC_MSG_WARN([py3c library not found; disabling python swig bindings])
else
AC_CACHE_CHECK([for compiling Python extensions],
[ac_cv_python_compile],[
- ac_cv_python_compile="`$PYTHON ${abs_srcdir}/build/get-py-info.py
--compile`"
+ ac_cv_python_compile="`$SWIG_PY_PYTHON
${abs_srcdir}/build/get-py-info.py --compile`"
])
SWIG_PY_COMPILE="$ac_cv_python_compile $CFLAGS"
AC_CACHE_CHECK([for linking Python extensions], [ac_cv_python_link],[
- ac_cv_python_link="`$PYTHON ${abs_srcdir}/build/get-py-info.py
--link`"
+ ac_cv_python_link="`$SWIG_PY_PYTHON
${abs_srcdir}/build/get-py-info.py --link`"
])
SWIG_PY_LINK="$ac_cv_python_link"
AC_CACHE_CHECK([for linking Python libraries], [ac_cv_python_libs],[
- ac_cv_python_libs="`$PYTHON ${abs_srcdir}/build/get-py-info.py
--libs`"
+ ac_cv_python_libs="`$SWIG_PY_PYTHON
${abs_srcdir}/build/get-py-info.py --libs`"
])
SWIG_PY_LIBS="`SVN_REMOVE_STANDARD_LIB_DIRS($ac_cv_python_libs)`"
@@ -159,7 +159,7 @@
# have the SWIG-generated files.
AC_CACHE_CHECK([for Python >= 3], [ac_cv_python_is_py3],[
ac_cv_python_is_py3="no"
- $PYTHON -c 'import sys; sys.exit(0x3000000 > sys.hexversion)' &&
\
+ $SWIG_PY_PYTHON -c 'import sys; sys.exit(0x3000000 >
sys.hexversion)' && \
ac_cv_python_is_py3="yes"
])
@@ -195,15 +195,15 @@
fi
SWIG_PL_ERRMSG="check config.log for details"
- if test "$PERL" != "none"; then
+ if test "$SWIG_PL_PERL" != "none"; then
AC_MSG_CHECKING([perl version])
dnl Note that the q() bit is there to avoid unbalanced brackets
dnl which m4 really doesn't like.
- PERL_VERSION="`$PERL -e 'q([[); print $]] * 1000000,$/;'`"
+ PERL_VERSION="`$SWIG_PL_PERL -e 'q([[); print $]] * 1000000,$/;'`"
AC_MSG_RESULT([$PERL_VERSION])
if test "$PERL_VERSION" -ge "5008000"; then
- SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$PERL -MExtUtils::Embed -e ccopts`"
- SWIG_PL_LINK="`$PERL -MExtUtils::Embed -e ldopts`"
+ SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$SWIG_PL_PERL -MExtUtils::Embed -e
ccopts`"
+ SWIG_PL_LINK="`$SWIG_PL_PERL -MExtUtils::Embed -e ldopts`"
SWIG_PL_LINK="`SVN_REMOVE_STANDARD_LIB_DIRS($SWIG_PL_LINK)`"
dnl SWIG Perl bindings successfully configured, clear the error message
@@ -216,13 +216,13 @@
SWIG_RB_COMPILE="none"
SWIG_RB_LINK="none"
SWIG_RB_ERRMSG="check config.log for details"
- if test "$RUBY" != "none"; then
+ if test "$SWIG_RB_RUBY" != "none"; then
if test x"$SWIG_VERSION" = x"3""00""008"; then
# Use a local variable to escape the '#' sign.
ruby_swig_issue_602='https://subversion.apache.org/docs/release-notes/1.11#ruby-swig-issue-602'
AC_MSG_WARN([Ruby bindings are known not to support swig 3.0.8; see
$ruby_swig_issue_602])
fi
- rbconfig="$RUBY -rrbconfig -e "
+ rbconfig="$SWIG_RB_RUBY -rrbconfig -e "
for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \
rubyhdrdir rubyarchhdrdir sitedir sitelibdir sitearchdir
libdir
@@ -261,7 +261,7 @@
SWIG_RB_COMPILE="$SWIG_RB_COMPILE -Wno-int-to-pointer-cast"
AC_CACHE_CHECK([how to link Ruby extensions], [svn_cv_ruby_link],[
- svn_cv_ruby_link="`$RUBY -e 'ARGV.shift; print ARGV.join(%q( ))' \
+ svn_cv_ruby_link="`$SWIG_RB_RUBY -e 'ARGV.shift; print ARGV.join(%q( ))'
\
$rbconfig_LDSHARED`"
svn_cv_ruby_link="$rbconfig_CC $svn_cv_ruby_link"
svn_cv_ruby_link="$svn_cv_ruby_link -shrext .$rbconfig_DLEXT"
Index: configure.ac
===================================================================
--- configure.ac (revision 1878200)
+++ configure.ac (working copy)
@@ -1272,19 +1272,19 @@
# Scripting and Bindings languages
-# Python: Used for testsuite, and bindings
+# Python: Used for testsuite
AC_ARG_VAR([PYTHON], [Python interpreter command])
PYTHON="`$abs_srcdir/build/find_python.sh`"
if test -z "$PYTHON"; then
- AC_MSG_WARN([Python 2.7 or later is required to run the testsuite])
- AC_MSG_WARN([or to use the Subversion Python bindings])
+ AC_MSG_WARN([Python 2.7 or later is required to run the testsuite.])
AC_MSG_WARN([])
AC_MSG_WARN([If you have a suitable Python installed, but not on the])
AC_MSG_WARN([PATH, set the environment variable PYTHON to the full path])
AC_MSG_WARN([to the Python executable, and re-run configure])
+ PYTHON=none
fi
-AC_PATH_PROGS(PYTHON, "$PYTHON", none)
+AC_SUBST(PYTHON)
# The minimum version for the JVM runtime for our Java bytecode.
JAVA_OLDEST_WORKING_VER='1.8'
@@ -1291,16 +1291,95 @@
# SVN_CHECK_JDK sets $JAVA_CLASSPATH
SVN_CHECK_JDK($JAVA_OLDEST_WORKING_VER)
-AC_PATH_PROG(PERL, perl, none)
+AC_ARG_WITH(swig_perl,
+[AS_HELP_STRING([[--with-swig-perl[=PATH|auto|no]|--without-swig-perl]],
+ [specify path to SWIG bindings target Perl [default=auto]])],
+[],
+[
+if test "$PERL" = "no" -o "$PERL" = "none"; then
+ with_swig_perl=no
+ AC_MSG_WARN([Disabling build of SWIG Perl bindings by setting "none" to])
+ AC_MSG_WARN([PERL envirionment variable is deprecated.])
+ AC_MSG_WARN([])
+ AC_MSG_WARN([Please use --without-swig-perl instead.])
+else
+ with_swig_perl=auto
+fi
+])
+case $with_swig_perl in
+ yes|auto|"")
+ AC_PATH_PROG(PERL, perl, none)
+ SWIG_PL_PERL="$PERL"
+ ;;
+ no|none)
+ SWIG_PL_PERL=none
+ ;;
+ *)
+ SWIG_PL_PERL="$with_swig_perl"
+ ;;
+esac
+AC_SUBST(SWIG_PL_PERL)
-if test -n "$RUBY"; then
- AC_PATH_PROG(RUBY, "$RUBY", none)
+# Python: as a target of SWIG Python bindings
+AC_ARG_WITH(swig_python,
+[AS_HELP_STRING([[--with-swig-python[=PATH|auto|no]|--without-swig-python]],
+ [specify path to SWIG bindings target Python [default=auto]])],
+[],
+[
+if test "$PYTHON" = "no" -o "$PYTHON" = "none"; then
+ with_swig_python=no
+ AC_MSG_WARN([Disabling build of SWIG Python bindings by setting "none" to])
+ AC_MSG_WARN([PYTHON envirionment variable is deprecated.])
+ AC_MSG_WARN([])
+ AC_MSG_WARN([Please use --without-swig-python instead.])
else
- AC_PATH_PROGS(RUBY, ruby ruby1 ruby1.8 ruby18 ruby1.9 ruby19 ruby1.9.3
ruby193 ruby2 ruby2.0 ruby20 ruby2.1 ruby21 ruby2.2 ruby22 ruby2.3 ruby23
ruby2.4 ruby24, none)
+ with_swig_python=auto
fi
-if test "$RUBY" != "none"; then
+])
+case $with_swig_python in
+ yes|auto|"")
+ SWIG_PY_PYTHON="$PYTHON"
+ ;;
+ no|none)
+ SWIG_PY_PYTHON=none
+ ;;
+ *)
+ SWIG_PY_PYTHON="$with_swig_python"
+ ;;
+esac
+AC_SUBST(SWIG_PY_PYTHON)
+
+AC_ARG_WITH(swig_ruby,
+[AS_HELP_STRING([[--with-swig-ruby[=PATH|auto|no]|--without-swig-ruby]],
+ [specify path to SWIG bindings target Ruby [default=auto]])],
+[],
+[
+if test "$RUBY" = "no" -o "$RUBY" = "none"; then
+ with_swig_ruby=no
+ AC_MSG_WARN([Disabling build of SWIG Ruby bindings by setting "none" to])
+ AC_MSG_WARN([RUBY envirionment variable is deprecated.])
+ AC_MSG_WARN([])
+ AC_MSG_WARN([Please use --without-swig-ruby instead.])
+else
+ with_swig_ruby=auto
+fi
+])
+case $with_swig_ruby in
+ yes|auto|"")
+ AC_PATH_PROGS(RUBY, ruby ruby1 ruby1.8 ruby18 ruby1.9 ruby19 ruby1.9.3
ruby193 ruby2 ruby2.0 ruby20 ruby2.1 ruby21 ruby2.2 ruby22 ruby2.3 ruby23
ruby2.4 ruby24, none)
+ SWIG_RB_RUBY="$RUBY"
+ ;;
+ no|none)
+ SWIG_RB_RUBY=none
+ ;;
+ *)
+ SWIG_RB_RUBY="$with_swig_ruby"
+ ;;
+esac
+AC_SUBST(SWIG_RB_RUBY)
+if test "$SWIG_RB_RUBY" != "none"; then
AC_MSG_CHECKING([rb_hash_foreach])
- if "$RUBY" -r mkmf -e 'exit(have_func("rb_hash_foreach") ? 0 : 1)'
>/dev/null; then
+ if "$SWIG_RB_RUBY" -r mkmf -e 'exit(have_func("rb_hash_foreach") ? 0 : 1)'
>/dev/null; then
AC_MSG_RESULT([yes])
if test -n "$RDOC"; then
AC_PATH_PROG(RDOC, "$RDOC", none)
@@ -1308,17 +1387,17 @@
AC_PATH_PROGS(RDOC, rdoc rdoc1 rdoc1.8 rdoc18 rdoc1.9 rdoc19 rdoc1.9.3
rdoc193 rdoc2 rdoc2.0 rdoc20 rdoc2.1 rdoc21 rdoc2.2 rdoc22 rdoc2.3 rdoc23
rdoc2.4 rdoc24, none)
fi
AC_CACHE_CHECK([for Ruby major version], [svn_cv_ruby_major],[
- svn_cv_ruby_major="`$RUBY -rrbconfig -e 'print
RbConfig::CONFIG.fetch(%q(MAJOR))'`"
+ svn_cv_ruby_major="`$SWIG_RB_RUBY -rrbconfig -e 'print
RbConfig::CONFIG.fetch(%q(MAJOR))'`"
])
RUBY_MAJOR="$svn_cv_ruby_major"
AC_CACHE_CHECK([for Ruby minor version], [svn_cv_ruby_minor],[
- svn_cv_ruby_minor="`$RUBY -rrbconfig -e 'print
RbConfig::CONFIG.fetch(%q(MINOR))'`"
+ svn_cv_ruby_minor="`$SWIG_RB_RUBY -rrbconfig -e 'print
RbConfig::CONFIG.fetch(%q(MINOR))'`"
])
RUBY_MINOR="$svn_cv_ruby_minor"
AC_CACHE_CHECK([for Ruby teeny version], [svn_cv_ruby_teeny],[
- svn_cv_ruby_teeny="`$RUBY -rrbconfig -e 'major, minor, teeny =
RUBY_VERSION.split("."); print teeny;'`"
+ svn_cv_ruby_teeny="`$SWIG_RB_RUBY -rrbconfig -e 'major, minor, teeny =
RUBY_VERSION.split("."); print teeny;'`"
])
RUBY_TEENY="$svn_cv_ruby_teeny"
@@ -1327,13 +1406,13 @@
AC_SUBST(RUBY_TEENY)
if test \( "$RUBY_MAJOR" -eq "1" -a "$RUBY_MINOR" -gt "8" -a "$RUBY_TEENY"
-lt "3" \); then
# Disallow Ruby between 1.8.7 and 1.9.3
- RUBY="none"
+ SWIG_RB_RUBY="none"
AC_MSG_WARN([The detected Ruby is between 1.9 and 1.9.3])
AC_MSG_WARN([Only 1.8.x and 1.9.3 or later are supported at this time])
fi
else
AC_MSG_RESULT([no])
- RUBY="none"
+ SWIG_RB_RUBY="none"
AC_MSG_WARN([The detected Ruby is too old for Subversion to use])
AC_MSG_WARN([A Ruby which has rb_hash_foreach is required to use the])
AC_MSG_WARN([Subversion Ruby bindings])
Index: subversion/bindings/swig/INSTALL
===================================================================
--- subversion/bindings/swig/INSTALL (revision 1878200)
+++ subversion/bindings/swig/INSTALL (working copy)
@@ -145,18 +145,22 @@
It tries to detect SWIG near the very end of its output.
You can find it by running 'grep "^SWIG=" config.log'.
- Also make sure that the configure script sees the paths to the perl and/or
- python executable you used to configure SWIG as above. If it does not then
- you can specify the correct path by adding PYTHON=/path/to/python or
- PERL=/path/to/perl onto the command line for configure. For example:
- ./configure PYTHON=/usr/bin/python3.7 PERL=/usr/bin/perl5.28.2
+ Also make sure that the configure script sees the paths to the perl,
+ ruby, and/or python executable you used to configure SWIG as above.
+ If it does not then you can specify the correct path by specifying
+ --with-swig-python=/path/to/python, --with-swig-perl=/path/to/perl,
+ and/or --with-swig-ruby=/path/to/ruby to the command line for configure.
+ For example:
+ ./configure --with-swig-python=/usr/bin/python3.7 \
+ --with-swig-perl=/usr/bin/perl5.28.2 \
+ --with-swig-ruby=/usr/bin/ruby2.7
If Subversion's ./configure finds a SWIG that it's happy with, then
it will build special glue libraries to link svn to the swig bindings:
- libsvn_swig_py.so (for Python)
- libsvn_swig_perl.so (for Perl)
+ libsvn_swig_py-1.so (for Python)
+ libsvn_swig_perl-1.so (for Perl)
+ libsvn_swig_ruby-1.so (for Ruby)
-
Step 3: Install Specific Language Bindings
* Python