diff options
author | Sam James <sam@gentoo.org> | 2024-02-06 05:13:56 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-02-06 05:13:56 +0000 |
commit | c64d638808ee411e7aad895d4883a66801509328 (patch) | |
tree | 908b7ef7feed2c48f020f6fbb212aecbe1182b05 /net-libs | |
parent | net-libs/ldns: drop 1.8.0-r4, 1.8.1, 1.8.3 (diff) | |
download | gentoo-c64d638808ee411e7aad895d4883a66801509328.tar.gz gentoo-c64d638808ee411e7aad895d4883a66801509328.tar.bz2 gentoo-c64d638808ee411e7aad895d4883a66801509328.zip |
net-libs/ldns: fix build w/ swig-4.2.0
Closes: https://bugs.gentoo.org/921302
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'net-libs')
-rw-r--r-- | net-libs/ldns/files/ldns-1.8.3-swig-4.2.0.patch | 101 | ||||
-rw-r--r-- | net-libs/ldns/ldns-1.8.3-r2.ebuild | 91 |
2 files changed, 192 insertions, 0 deletions
diff --git a/net-libs/ldns/files/ldns-1.8.3-swig-4.2.0.patch b/net-libs/ldns/files/ldns-1.8.3-swig-4.2.0.patch new file mode 100644 index 000000000000..8165371d53bb --- /dev/null +++ b/net-libs/ldns/files/ldns-1.8.3-swig-4.2.0.patch @@ -0,0 +1,101 @@ +https://bugs.gentoo.org/921302 +https://github.com/NLnetLabs/ldns/pull/232 +https://github.com/NLnetLabs/ldns/pull/233 + +From daf38095763f758c77be538da25c267dc5cb73c8 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Fri, 26 Jan 2024 11:30:39 +0100 +Subject: [PATCH] SWIG_Python_str_AsChar removal in SWIG 4.2.0 + +The replacement, SWIG_PyUnicode_AsUTF8AndSize, has different +memory management requirements. +--- + contrib/python/ldns_rdf.i | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/contrib/python/ldns_rdf.i b/contrib/python/ldns_rdf.i +index 5d7448fd..60daf1a7 100644 +--- a/contrib/python/ldns_rdf.i ++++ b/contrib/python/ldns_rdf.i +@@ -56,7 +56,11 @@ + */ + %typemap(arginit, noblock=1) const ldns_rdf * + { ++#if SWIG_VERSION >= 0x040200 ++ PyObject *$1_bytes = NULL; ++#else + char *$1_str = NULL; ++#endif + } + + /* +@@ -66,11 +70,17 @@ + %typemap(in, noblock=1) const ldns_rdf * (void* argp, $1_ltype tmp = 0, int res) + { + if (Python_str_Check($input)) { ++ const char *argstr; ++#if SWIG_VERSION >= 0x040200 ++ argstr = SWIG_PyUnicode_AsUTF8AndSize($input, NULL, &$1_bytes); ++#else + $1_str = SWIG_Python_str_AsChar($input); +- if ($1_str == NULL) { ++ argstr = $1_str; ++#endif ++ if (argstr == NULL) { + %argument_fail(SWIG_TypeError, "char *", $symname, $argnum); + } +- tmp = ldns_dname_new_frm_str($1_str); ++ tmp = ldns_dname_new_frm_str(argstr); + if (tmp == NULL) { + %argument_fail(SWIG_TypeError, "char *", $symname, $argnum); + } +@@ -90,10 +100,17 @@ + */ + %typemap(freearg, noblock=1) const ldns_rdf * + { ++#if SWIG_VERSION >= 0x040200 ++ if ($1_bytes != NULL) { ++ /* Is not NULL only when a conversion form string occurred. */ ++ Py_XDECREF($1_bytes); ++ } ++#else + if ($1_str != NULL) { + /* Is not NULL only when a conversion form string occurred. */ + SWIG_Python_str_DelForPy3($1_str); /* Is a empty macro for Python < 3. */ + } ++#endif + } + + %nodefaultctor ldns_struct_rdf; /* No default constructor. */ + +From f91f61e10be595a6a46845112aaed7da24551bf9 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Fri, 26 Jan 2024 11:57:03 +0100 +Subject: [PATCH] 32-bit compatibility for Python SWIG bindings + +The ssize_t type can be int instead of long, and the pointer +types are incompatible. +--- + contrib/python/ldns.i | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/contrib/python/ldns.i b/contrib/python/ldns.i +index 881ba5e85..b4a740820 100644 +--- a/contrib/python/ldns.i ++++ b/contrib/python/ldns.i +@@ -99,12 +99,14 @@ + %typemap(in, noblock=1) (ssize_t) + { + int $1_res = 0; +- $1_res = SWIG_AsVal_long($input, &$1); ++ long val; ++ $1_res = SWIG_AsVal_long($input, &val); + if (!SWIG_IsOK($1_res)) { + SWIG_exception_fail(SWIG_ArgError($1_res), "in method '" + "$symname" "', argument " "$argnum" " of type '" + "$type""'"); + } ++ $1 = val; + } + + diff --git a/net-libs/ldns/ldns-1.8.3-r2.ebuild b/net-libs/ldns/ldns-1.8.3-r2.ebuild new file mode 100644 index 000000000000..15f1bf29756a --- /dev/null +++ b/net-libs/ldns/ldns-1.8.3-r2.ebuild @@ -0,0 +1,91 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..11} ) +inherit autotools python-single-r1 multilib-minimal + +DESCRIPTION="A library with the aim to simplify DNS programming in C" +HOMEPAGE="https://www.nlnetlabs.nl/projects/ldns/" +SRC_URI="https://www.nlnetlabs.nl/downloads/${PN}/${P}.tar.gz" + +LICENSE="BSD" +SLOT="0/3" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-macos ~x64-macos ~x64-solaris" +IUSE="doc examples python static-libs" +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" +RESTRICT="test" # missing test directory + +BDEPEND=" + python? ( dev-lang/swig ) + doc? ( app-text/doxygen ) +" +DEPEND=" + python? ( ${PYTHON_DEPS} ) + >=dev-libs/openssl-1.1.1l-r1:0=[${MULTILIB_USEDEP},static-libs?] + examples? ( net-libs/libpcap ) +" +RDEPEND=" + ${DEPEND} + !<net-dns/ldns-utils-1.8.0-r2 +" + +MULTILIB_CHOST_TOOLS=( + /usr/bin/ldns-config +) + +PATCHES=( + "${FILESDIR}/ldns-1.8.1-pkgconfig.patch" + "${FILESDIR}/${P}-docs.patch" + "${FILESDIR}/${P}-configure-strict.patch" + "${FILESDIR}/${PN}-1.8.3-swig-4.2.0.patch" +) + +pkg_setup() { + use python && python-single-r1_pkg_setup +} + +src_prepare() { + default + + # Drop after 1.8.3 + eautoreconf +} + +multilib_src_configure() { + ECONF_SOURCE="${S}" econf \ + $(use_enable static-libs static) \ + $(multilib_native_use_with python pyldns) \ + $(multilib_native_use_with python pyldnsx) \ + --with-ssl="${EPREFIX}"/usr \ + $(multilib_native_with drill) \ + $(multilib_native_use_with examples) \ + --disable-rpath +} + +multilib_src_compile() { + default + + if multilib_is_native_abi && use doc ; then + emake doxygen + fi +} + +multilib_src_install() { + default + + if multilib_is_native_abi && use doc ; then + dodoc -r doc/html + fi +} + +multilib_src_install_all() { + dodoc Changelog README* + + find "${D}" -name '*.la' -delete || die + use python && python_optimize + + insinto /usr/share/vim/vimfiles/ftdetect + doins libdns.vim +} |