From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A0B4015803E for ; Fri, 5 Jan 2024 11:35:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 90C2E2BC167; Fri, 5 Jan 2024 11:35:41 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7323B2BC167 for ; Fri, 5 Jan 2024 11:35:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 801C53430EC for ; Fri, 5 Jan 2024 11:35:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DC0E514A8 for ; Fri, 5 Jan 2024 11:35:38 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1704454502.e77bccc40c96e94bac5fe1ba796f02c3f00544c2.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: net-irc/znc/files/, net-irc/znc/ X-VCS-Repository: repo/gentoo X-VCS-Files: net-irc/znc/files/znc-1.8.2-fix-swig-2.patch net-irc/znc/znc-1.8.2-r2.ebuild X-VCS-Directories: net-irc/znc/files/ net-irc/znc/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: e77bccc40c96e94bac5fe1ba796f02c3f00544c2 X-VCS-Branch: master Date: Fri, 5 Jan 2024 11:35:38 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 87e6a9ff-cbb1-481a-8d89-337bf7de3549 X-Archives-Hash: e16b97693cc75d6732011862507f4ed7 commit: e77bccc40c96e94bac5fe1ba796f02c3f00544c2 Author: Alexey Sokolov asokolov org> AuthorDate: Fri Jan 5 08:58:49 2024 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jan 5 11:35:02 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e77bccc4 net-irc/znc: fix build with dev-lang/swig-4.2.0 Closes: https://bugs.gentoo.org/921230 Signed-off-by: Alexey Sokolov asokolov.org> Closes: https://github.com/gentoo/gentoo/pull/34654 Signed-off-by: Sam James gentoo.org> net-irc/znc/files/znc-1.8.2-fix-swig-2.patch | 123 +++++++++++++++++++++++++++ net-irc/znc/znc-1.8.2-r2.ebuild | 3 +- 2 files changed, 125 insertions(+), 1 deletion(-) diff --git a/net-irc/znc/files/znc-1.8.2-fix-swig-2.patch b/net-irc/znc/files/znc-1.8.2-fix-swig-2.patch new file mode 100644 index 000000000000..91d7f5657cbe --- /dev/null +++ b/net-irc/znc/files/znc-1.8.2-fix-swig-2.patch @@ -0,0 +1,123 @@ +From 3f4c1cce77cbe1337e5642e9e0e9d048c9e07370 Mon Sep 17 00:00:00 2001 +From: Alexey Sokolov +Date: Fri, 5 Jan 2024 02:19:55 +0000 +Subject: [PATCH] Fix build with SWIG 4.2.0 + +https://bugs.gentoo.org/921230 +--- + modules/modpython/codegen.pl | 88 ++++++++++++++++++++++++++---------- + 1 file changed, 65 insertions(+), 23 deletions(-) + +diff --git a/modules/modpython/codegen.pl b/modules/modpython/codegen.pl +index 1bc09806e0..bbcb148bed 100755 +--- a/modules/modpython/codegen.pl ++++ b/modules/modpython/codegen.pl +@@ -50,29 +50,6 @@ + ***************************************************************************/ + + namespace { +-/* template +- struct pyobj_to_ptr { +- CString m_sType; +- SvToPtr(const CString& sType) { +- m_sType = sType; +- } +- bool operator()(PyObject* py, T** result) { +- T* x = nullptr; +- int res = SWIG_ConvertPtr(sv, (void**)&x, SWIG_TypeQuery(m_sType.c_str()), 0); +- if (SWIG_IsOK(res)) { +- *result = x; +- return true; +- } +- DEBUG("modpython: "); +- return false; +- } +- }; +- +- CModule::EModRet SvToEModRet(PyObject* py, CModule::EModRet* result) { +- long int x = PyLong_AsLong(); +- return static_cast(SvUV(sv)); +- }*/ +- + inline swig_type_info* SWIG_pchar_descriptor(void) { + static int init = 0; + static swig_type_info* info = 0; +@@ -83,6 +60,70 @@ + return info; + } + ++// SWIG 4.2.0 replaced SWIG_Python_str_AsChar with SWIG_PyUnicode_AsUTF8AndSize. ++// SWIG doesn't provide any good way to detect SWIG version (other than parsing ++// `swig -version`), but it also introduced SWIG_NULLPTR. ++// So let's abuse that define to do different code for new SWIG. ++#ifdef SWIG_NULLPTR ++ // This is copied from some SWIG 4.2.0 from pystrings.swg ++ inline int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { ++#if PY_VERSION_HEX>=0x03000000 ++#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR) ++ if (PyBytes_Check(obj)) ++#else ++ if (PyUnicode_Check(obj)) ++#endif ++#else ++ if (PyString_Check(obj)) ++#endif ++ { ++ char *cstr; Py_ssize_t len; ++ PyObject *bytes = NULL; ++ int ret = SWIG_OK; ++ if (alloc) ++ *alloc = SWIG_OLDOBJ; ++#if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR) ++ if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1) ++ return SWIG_TypeError; ++#else ++ cstr = (char *)SWIG_PyUnicode_AsUTF8AndSize(obj, &len, &bytes); ++ if (!cstr) ++ return SWIG_TypeError; ++ /* The returned string is only duplicated if the char * returned is not owned and memory managed by obj */ ++ if (bytes && cptr) { ++ if (alloc) { ++ //cstr = %new_copy_array(cstr, len + 1, char); ++ cstr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1)); ++ *alloc = SWIG_NEWOBJ; ++ } else { ++ /* alloc must be set in order to clean up allocated memory */ ++ return SWIG_RuntimeError; ++ } ++ } ++#endif ++ if (cptr) *cptr = cstr; ++ if (psize) *psize = len + 1; ++ Py_XDECREF(bytes); ++ return ret; ++ } else { ++ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor(); ++ if (pchar_descriptor) { ++ void* vptr = 0; ++ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) { ++ if (cptr) *cptr = (char *) vptr; ++ if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0; ++ if (alloc) *alloc = SWIG_OLDOBJ; ++ return SWIG_OK; ++ } ++ } ++ } ++ return SWIG_TypeError; ++ } ++ ++#else ++ // TODO: at some point drop support for SWIG<4.2.0 (drop this branch of ifdef) ++ ++ // This is copied from some old SWIG version from pystrings.swg + inline int SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) { + #if PY_VERSION_HEX>=0x03000000 + if (PyUnicode_Check(obj)) +@@ -155,6 +196,7 @@ + } + return SWIG_TypeError; + } ++#endif + + inline int SWIG_AsPtr_CString (PyObject * obj, CString **val) { + char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ; diff --git a/net-irc/znc/znc-1.8.2-r2.ebuild b/net-irc/znc/znc-1.8.2-r2.ebuild index 6b6d33d21374..95ffdfe3d31e 100644 --- a/net-irc/znc/znc-1.8.2-r2.ebuild +++ b/net-irc/znc/znc-1.8.2-r2.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2023 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -76,6 +76,7 @@ PATCHES=( "${FILESDIR}"/${P}-fix-python-3.10.patch "${FILESDIR}"/${P}-fix-odr-violation.patch "${FILESDIR}"/${P}-fix-swig.patch + "${FILESDIR}"/${P}-fix-swig-2.patch ) pkg_setup() {