[arch-commits] Commit in libsigrok/trunk (PKGBUILD fix_swig4_java_bindings.patch)

Anatol Pomozov anatolik at archlinux.org
Fri May 29 18:16:38 UTC 2020


    Date: Friday, May 29, 2020 @ 18:16:38
  Author: anatolik
Revision: 637223

SWIG4 rebuild

Pull java bindings fix from upstream
Disable ruby bindings as it currently does not build with SWIG + Ruby2.7

Added:
  libsigrok/trunk/fix_swig4_java_bindings.patch
Modified:
  libsigrok/trunk/PKGBUILD

-------------------------------+
 PKGBUILD                      |   18 +++++++++---------
 fix_swig4_java_bindings.patch |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 9 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-05-29 18:15:24 UTC (rev 637222)
+++ PKGBUILD	2020-05-29 18:16:38 UTC (rev 637223)
@@ -3,30 +3,30 @@
 
 pkgname=libsigrok
 pkgver=0.5.2
-pkgrel=2
+pkgrel=3
 pkgdesc='Client software that supports various hardware logic analyzers, core library'
 arch=('x86_64')
 url='https://www.sigrok.org/wiki/Libsigrok'
 license=('GPL3')
 depends=('libftdi' 'libserialport' 'glibmm' 'libzip' 'libieee1284')
-makedepends=('cmake' 'doxygen' 'ruby' 'jdk8-openjdk' 'swig3' 'python' 'pygobject-devel' 'python-numpy' 'python-setuptools')
+makedepends=('cmake' 'doxygen' 'ruby' 'jdk8-openjdk' 'swig' 'python' 'pygobject-devel' 'python-numpy' 'python-setuptools')
 optdepends=('python' 'ruby' 'jdk8-openjdk'
             'sigrok-firmware-fx2lafw: Cypress FX2-based device support')
-source=("https://sigrok.org/download/source/$pkgname/$pkgname-$pkgver.tar.gz")
-sha512sums=('cf673dad6280302d69050c29490621f66c6d6a73932d019a53ec3501316d3f2e23e7667a04f866dbe6ed73f86a63de73d2173e2b6cea563631d705e06f887092')
+source=("https://sigrok.org/download/source/$pkgname/$pkgname-$pkgver.tar.gz"
+        "fix_swig4_java_bindings.patch")
+sha512sums=('cf673dad6280302d69050c29490621f66c6d6a73932d019a53ec3501316d3f2e23e7667a04f866dbe6ed73f86a63de73d2173e2b6cea563631d705e06f887092'
+            '0e6bdddb2dcc03d76e5d16708bb127ec8a9207fba0e04b436ac92e370618cc0b1bc9d3e2c86a0878783626f2a8b59961c3a1a52a1e180e69005e3585e5766a89')
 
 prepare() {
   cd $pkgname-$pkgver
-  # Build with swig 3 due to 
-  #   https://sigrok.org/bugzilla/show_bug.cgi?id=1527
-  #   https://github.com/swig/swig/issues/1689
-  sed -e 's|swig3.0|swig-3|g' -i configure
+  patch -p1 < ../fix_swig4_java_bindings.patch # https://sigrok.org/bugzilla/show_bug.cgi?id=1527
 }
 
 build() {
   cd $pkgname-$pkgver
 
- ./configure --prefix=/usr
+  # Ruby bindings do not build with SWIG4 https://sigrok.org/bugzilla/show_bug.cgi?id=1526
+  ./configure --prefix=/usr --disable-ruby
 
   make
 }

Added: fix_swig4_java_bindings.patch
===================================================================
--- fix_swig4_java_bindings.patch	                        (rev 0)
+++ fix_swig4_java_bindings.patch	2020-05-29 18:16:38 UTC (rev 637223)
@@ -0,0 +1,38 @@
+From e803574173bdac8a7f33085a648c29eaf248a394 Mon Sep 17 00:00:00 2001
+From: Uwe Hermann <uwe at hermann-uwe.de>
+Date: Sat, 4 Apr 2020 21:54:13 +0200
+Subject: [PATCH 1/1] bindings/java: Fix build issue with SWIG 4.x.
+
+Tested with SWIG 3.x and SWIG 4.x.
+
+This fixes bug #1527.
+---
+ bindings/java/org/sigrok/core/classes/classes.i | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/bindings/java/org/sigrok/core/classes/classes.i b/bindings/java/org/sigrok/core/classes/classes.i
+index 75793b25..e953fe5d 100644
+--- a/bindings/java/org/sigrok/core/classes/classes.i
++++ b/bindings/java/org/sigrok/core/classes/classes.i
+@@ -94,10 +94,18 @@ VECTOR(std::shared_ptr<sigrok::HardwareDevice>, HardwareDevice)
+   "java.util.Map<JKey, JValue>"
+ 
+ %typemap(javain,
++/* SWIG 4.0.0 changed the std::map wrappers in an incompatible way. */
++#if SWIG_VERSION >= 0x040000
++    pre="  $javaclassname temp$javainput = new $javaclassname();
++    for (java.util.Map.Entry<JKey, JValue> entry : $javainput.entrySet())
++      temp$javainput.put(entry.getKey(), entry.getValue());",
++    pgcppname="temp$javainput")
++#else
+     pre="  $javaclassname temp$javainput = new $javaclassname();
+     for (java.util.Map.Entry<JKey, JValue> entry : $javainput.entrySet())
+       temp$javainput.set(entry.getKey(), entry.getValue());",
+     pgcppname="temp$javainput")
++#endif
+   std::map< CKey, CValue > "$javaclassname.getCPtr(temp$javainput)"
+ 
+ %typemap(javaout) std::map< CKey, CValue > {
+-- 
+2.24.0.rc2
+


More information about the arch-commits mailing list