diff --git a/ldns-1.8-python-dirs.patch b/ldns-1.8-python-dirs.patch new file mode 100644 index 0000000..035d029 --- /dev/null +++ b/ldns-1.8-python-dirs.patch @@ -0,0 +1,325 @@ +From 61a166ef79b74d50e4151844a2c33dfa2b8f7e53 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= +Date: Tue, 3 Jan 2023 20:09:00 +0100 +Subject: [PATCH] Update python configuration, support platform site dir + +Update to the most recent ax_python_devel.m4 from autoconf-archive +2022.09.03. It reports two separate directories, one for platform +independent files, another for platform specific files. + +Make sure native code library installs into platform site directory. +Python modules can be installed into common site directory. Should work +on python 3.12, which removes distutils module completely. +--- + ldns-1.8.3/Makefile.in | 13 ++- + ldns-1.8.3/ax_python_devel.m4 | 147 +++++++++++++++++++++++++++------- + 2 files changed, 127 insertions(+), 33 deletions(-) + +diff --git a/ldns-1.8.3/Makefile.in b/ldns-1.8.3/Makefile.in +index 57957d0..e70602d 100644 +--- a/ldns-1.8.3/Makefile.in ++++ b/ldns-1.8.3/Makefile.in +@@ -21,6 +21,7 @@ PERL = @PERL@ + swig = @swig@ + swigpy_flags = -python @SWIGPY3@ + python_site = @PYTHON_SITE_PKG@ ++python_platform_site = @PYTHON_PLATFORM_SITE_PKG@ + pyldns_inst = @PYLDNSINST@ + pyldns_uninst = @PYLDNSUNINST@ + pyldnsx_inst = @PYLDNSXINST@ +@@ -324,7 +325,7 @@ ldns_wrapper.lo: $(pywrapdir)/ldns_wrapper.c ldns/config.h + $(COMP_LIB) -I./include/ldns $(LIBSSL_CPPFLAGS) $(PYTHON_CPPFLAGS) $(PYTHON_X_CFLAGS) -c $(pywrapdir)/ldns_wrapper.c -o $@ + + _ldns.la: ldns_wrapper.lo libldns.la +- $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) -module -version-info $(version_info) -no-undefined -o $@ ldns_wrapper.lo -rpath $(python_site) -L. -L.libs $(LIB) $(PYTHON_LIBS) $(LIBS) ++ $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) -module -version-info $(version_info) -no-undefined -o $@ ldns_wrapper.lo -rpath $(python_platform_site) -L. -L.libs $(LIB) $(PYTHON_LIBS) $(LIBS) + + $(p5_dns_ldns_dir)/Makefile: $(p5_dns_ldns_dir)/Makefile.PL + BUILDDIR=`pwd`; cd $(p5_dns_ldns_dir); LD_LIBRARY_PATH="$$BUILDDIR/.libs:$$LD_LIBRARY_PATH" DYLD_LIBRARY_PATH="$$BUILDDIR/.libs:$$DYLD_LIBRARY_PATH" $(PERL) Makefile.PL LIBS="-L$$BUILDDIR/.libs -lldns" INC="-I$$BUILDDIR" +@@ -414,15 +415,19 @@ uninstall-lib: + + install-pyldns: @PYLDNS@ + $(INSTALL) -m 755 -d $(DESTDIR)$(python_site)/ldns +- $(INSTALL) -c -m 644 $(pywrapdir)/ldns.py $(DESTDIR)$(python_site)/ldns.py +- $(LIBTOOL) --mode=install cp _ldns.la $(DESTDIR)$(python_site) +- $(LIBTOOL) --mode=finish $(DESTDIR)$(python_site) ++ $(INSTALL) -m 755 -d $(DESTDIR)$(python_platform_site) ++ $(INSTALL) -c -m 644 $(pywrapdir)/ldns.py $(DESTDIR)$(python_platform_site)/ldns.py ++ $(LIBTOOL) --mode=install cp _ldns.la $(DESTDIR)$(python_platform_site) ++ $(LIBTOOL) --mode=finish $(DESTDIR)$(python_platform_site) + + uninstall-pyldns: + rm -f $(DESTDIR)$(python_site)/ldns/* ++ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(python_platform_site)/_ldns.la ++ rm -f $(DESTDIR)$(python_platform_site)/ldns.py + test ! -d $(DESTDIR)$(python_site)/ldns || rmdir $(DESTDIR)$(python_site)/ldns || echo "ok, dir already gone" + + install-pyldnsx: ++ $(INSTALL) -m 755 -d $(DESTDIR)$(python_site) + $(INSTALL) -c -m 644 $(pyldnsxwrapdir)/ldnsx.py $(DESTDIR)$(python_site)/ldnsx.py + + uninstall-pyldnsx: +diff --git a/ldns-1.8.3/ax_python_devel.m4 b/ldns-1.8.3/ax_python_devel.m4 +index aff04f6..780584e 100644 +--- a/ldns-1.8.3/ax_python_devel.m4 ++++ b/ldns-1.8.3/ax_python_devel.m4 +@@ -67,7 +67,7 @@ + # modified version of the Autoconf Macro, you may extend this special + # exception to the GPL to apply to your modified version as well. + +-#serial 21 ++#serial 32 + + AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL]) + AC_DEFUN([AX_PYTHON_DEVEL],[ +@@ -112,15 +112,39 @@ to something else than an empty string. + fi + + # +- # if the macro parameter ``version'' is set, honour it ++ # If the macro parameter ``version'' is set, honour it. ++ # A Python shim class, VPy, is used to implement correct version comparisons via ++ # string expressions, since e.g. a naive textual ">= 2.7.3" won't work for ++ # Python 2.7.10 (the ".1" being evaluated as less than ".3"). + # + if test -n "$1"; then + AC_MSG_CHECKING([for a version of Python $1]) +- ac_supports_python_ver=`$PYTHON -c "import sys; \ +- ver = sys.version.split ()[[0]]; \ ++ cat << EOF > ax_python_devel_vpy.py ++class VPy: ++ def vtup(self, s): ++ return tuple(map(int, s.strip().replace("rc", ".").split("."))) ++ def __init__(self): ++ import sys ++ self.vpy = tuple(sys.version_info) ++ def __eq__(self, s): ++ return self.vpy == self.vtup(s) ++ def __ne__(self, s): ++ return self.vpy != self.vtup(s) ++ def __lt__(self, s): ++ return self.vpy < self.vtup(s) ++ def __gt__(self, s): ++ return self.vpy > self.vtup(s) ++ def __le__(self, s): ++ return self.vpy <= self.vtup(s) ++ def __ge__(self, s): ++ return self.vpy >= self.vtup(s) ++EOF ++ ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \ ++ ver = ax_python_devel_vpy.VPy(); \ + print (ver $1)"` ++ rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py* + if test "$ac_supports_python_ver" = "True"; then +- AC_MSG_RESULT([yes]) ++ AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([this package requires Python $1. +@@ -135,16 +159,25 @@ variable to configure. See ``configure --help'' for reference. + # + # Check if you have distutils, else fail + # +- AC_MSG_CHECKING([for the distutils Python package]) +- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` ++ AC_MSG_CHECKING([for the sysconfig Python package]) ++ ac_sysconfig_result=`$PYTHON -c "import sysconfig" 2>&1` + if test $? -eq 0; then + AC_MSG_RESULT([yes]) ++ IMPORT_SYSCONFIG="import sysconfig" + else + AC_MSG_RESULT([no]) +- AC_MSG_ERROR([cannot import Python module "distutils". ++ ++ AC_MSG_CHECKING([for the distutils Python package]) ++ ac_sysconfig_result=`$PYTHON -c "from distutils import sysconfig" 2>&1` ++ if test $? -eq 0; then ++ AC_MSG_RESULT([yes]) ++ IMPORT_SYSCONFIG="from distutils import sysconfig" ++ else ++ AC_MSG_ERROR([cannot import Python module "distutils". + Please check your Python installation. The error was: +-$ac_distutils_result]) +- PYTHON_VERSION="" ++$ac_sysconfig_result]) ++ PYTHON_VERSION="" ++ fi + fi + + # +@@ -152,10 +185,19 @@ $ac_distutils_result]) + # + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CPPFLAGS"; then +- python_path=`$PYTHON -c "import distutils.sysconfig; \ +- print (distutils.sysconfig.get_python_inc ());"` +- plat_python_path=`$PYTHON -c "import distutils.sysconfig; \ +- print (distutils.sysconfig.get_python_inc (plat_specific=1));"` ++ if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then ++ # sysconfig module has different functions ++ python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ ++ print (sysconfig.get_path ('include'));"` ++ plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ ++ print (sysconfig.get_path ('platinclude'));"` ++ else ++ # old distutils way ++ python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ ++ print (sysconfig.get_python_inc ());"` ++ plat_python_path=`$PYTHON -c "$IMPORT_SYSCONFIG; \ ++ print (sysconfig.get_python_inc (plat_specific=1));"` ++ fi + if test -n "${python_path}"; then + if test "${plat_python_path}" != "${python_path}"; then + python_path="-I$python_path -I$plat_python_path" +@@ -179,7 +221,7 @@ $ac_distutils_result]) + + # join all versioning strings, on some systems + # major/minor numbers could be in different list elements +-from distutils.sysconfig import * ++from sysconfig import * + e = get_config_var('VERSION') + if e is not None: + print(e) +@@ -190,7 +232,7 @@ EOD` + ac_python_version=$PYTHON_VERSION + else + ac_python_version=`$PYTHON -c "import sys; \ +- print (sys.version[[:3]])"` ++ print ("%d.%d" % sys.version_info[[:2]])"` + fi + fi + +@@ -202,8 +244,8 @@ EOD` + ac_python_libdir=`cat< - 1.8.3-3 - Use recent autoconf python detection (#2155003) +- Install python modules into separate directories * Fri Sep 30 2022 Petr Menšík - 1.8.3-2 - Update License tag to SPDX identifier