commit:     e08bc83aa01688908ae6a6aa7f6b08274ed81851
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 10 04:22:29 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul 10 04:22:42 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e08bc83a

sci-libs/libsigrok: fix build w/ swig-4.1 (again)

Bug: https://bugs.gentoo.org/878395
Closes: https://bugs.gentoo.org/959264
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/libsigrok-0.6.0_pre20241020-swig.patch   | 38 ++++++++++++++++++++++
 .../libsigrok/libsigrok-0.6.0_pre20241020.ebuild   |  4 +++
 2 files changed, 42 insertions(+)

diff --git a/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-swig.patch 
b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-swig.patch
new file mode 100644
index 000000000000..8f96a1e58ce5
--- /dev/null
+++ b/sci-libs/libsigrok/files/libsigrok-0.6.0_pre20241020-swig.patch
@@ -0,0 +1,38 @@
+https://bugs.gentoo.org/878395
+https://bugs.gentoo.org/959264
+
+From cdd8b55975e447840ce76f3a241be88fec7585b3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <[email protected]>
+Date: Sun, 3 Nov 2024 17:07:29 +0100
+Subject: [PATCH] support SWIG 4.2 and later
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+otherwise building sigrok fails with
+bindings/swig/enums.i:1: Error: Unknown directive '%attribute'.
+
+Also indicate that bindings/swig/enums.i is a generated file.
+
+Signed-off-by: Klaus Kämpf <[email protected]>
+---
+ bindings/cxx/enums.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/bindings/cxx/enums.py b/bindings/cxx/enums.py
+index 3711334e7..388faf225 100644
+--- a/bindings/cxx/enums.py
++++ b/bindings/cxx/enums.py
+@@ -73,9 +73,11 @@
+ code = open(os.path.join(outdirname, 'cxx/enums.cpp'), 'w')
+ swig = open(os.path.join(outdirname, 'swig/enums.i'), 'w')
+ 
+-for file in (header, code):
++for file in (header, code, swig):
+     print("/* Generated file - edit enums.py instead! */", file=file)
+ 
++print('%include "attribute.i"', file=swig)
++
+ print("namespace sigrok {", file=header)
+ 
+ # Template for beginning of class declaration and public members.

diff --git a/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild 
b/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild
index 2a5260bad733..a4a1080ed119 100644
--- a/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild
+++ b/sci-libs/libsigrok/libsigrok-0.6.0_pre20241020.ebuild
@@ -85,6 +85,10 @@ BDEPEND="
 "
 [[ ${PV} == *_p* ]] && BDEPEND+=" app-arch/unzip"
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.6.0_pre20241020-swig.patch
+)
+
 pkg_setup() {
        use python && python_setup
        use ruby && ruby-ng_pkg_setup

Reply via email to