From 3bf1d55b805dcad3291aa94a1a29b42e678864b6 Mon Sep 17 00:00:00 2001
From: Kevin Mihelich <kevin@archlinuxarm.org>
Date: Thu, 28 May 2020 12:14:28 +0000
Subject: [PATCH] community/java-rxtx to 2.2pre2-7

---
 community/java-rxtx/PKGBUILD                  | 22 +++++++++++--------
 community/java-rxtx/java11.patch              | 12 ++++++++++
 ....patch => rxtx-2.2-undefined_symbol.patch} |  2 ++
 3 files changed, 27 insertions(+), 9 deletions(-)
 create mode 100644 community/java-rxtx/java11.patch
 rename community/java-rxtx/{rxtx-2.2-minor.patch => rxtx-2.2-undefined_symbol.patch} (68%)

diff --git a/community/java-rxtx/PKGBUILD b/community/java-rxtx/PKGBUILD
index 3c4ef15a2..55b9cef94 100644
--- a/community/java-rxtx/PKGBUILD
+++ b/community/java-rxtx/PKGBUILD
@@ -4,12 +4,11 @@
 # ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
 #  - (make)depend on java-runtime and -environmennt >=8 (fails to build with 7)
 #  - patch from debian to fix build on ARM
-#  - patch from Fedora to fix undefined symbol error
 
 pkgname=java-rxtx
 _pkgname=rxtx
 pkgver=2.2pre2
-pkgrel=6.1
+pkgrel=7
 pkgdesc="Java library for serial IO"
 arch=('x86_64')
 url="http://rxtx.qbang.org/"
@@ -25,16 +24,18 @@ source=(http://rxtx.qbang.org/pub/$_pkgname/$_pkgname-$pkgver.zip
         rxtx-2.2-fhs_lock.patch
         ttyACM_port.patch
         java10.patch
-        rxtx-sys_io_h_check.patch
-        rxtx-2.2-minor.patch)
+        java11.patch
+        rxtx-2.2-undefined_symbol.patch
+        rxtx-sys_io_h_check.patch)
 md5sums=('7eedb18e3f33a427e2b0e9be8ce3f94c'
          '2f21ec5eb108f871815242698b6150f1'
          '1f7c43d582bfe9daea22d7f7057436da'
          'f4d22d263f45cd1d4db6242dd0ac78ae'
          '903a3fe0067d0682dd5f64483c741df6'
          '683dd95e6e419b2b63851c08ede7ca86'
-         '6fa4482df20625f652ecad818e92614a'
-         '5d2a20641b82e46b31330267d1a5c19b')
+         '1db5c64e239c80294d00c932237889dd'
+         '4695fe9bb28a7c9b21447f998fb46b02'
+         '6fa4482df20625f652ecad818e92614a')
 
 prepare() {
   cd $_pkgname-$pkgver
@@ -54,12 +55,15 @@ prepare() {
   # Fix build with openjdk10
   patch -Np1 -i ../java10.patch
 
+  # Fix build with openjdk11
+  patch -Np1 -i ../java11.patch
+  
+  # Fix undefined symbol
+  patch -Np1 -i ../rxtx-2.2-undefined_symbol.patch
+
   # Fix ARM build
   patch -Np1 -i ../rxtx-sys_io_h_check.patch
 
-  # Fix undefined symbol error
-  patch -Np1 -i ../rxtx-2.2-minor.patch
-
   rm *.m4
   autoreconf -fi
 }
diff --git a/community/java-rxtx/java11.patch b/community/java-rxtx/java11.patch
new file mode 100644
index 000000000..3b7fad1d6
--- /dev/null
+++ b/community/java-rxtx/java11.patch
@@ -0,0 +1,12 @@
+diff -Naur rxtx-2.2pre2.orig/src/gnu/io/LPRPort.java rxtx-2.2pre2/src/gnu/io/LPRPort.java
+--- rxtx-2.2pre2.orig/src/gnu/io/LPRPort.java	2007-04-26 07:26:05.000000000 +0200
++++ rxtx-2.2pre2/src/gnu/io/LPRPort.java	2020-05-28 10:20:22.755141415 +0200
+@@ -370,7 +370,7 @@
+ 		public void run()
+ 		{
+ 			eventLoop();
+-			yield();
++			Thread.yield();
+ 		}
+ 	}
+ }
diff --git a/community/java-rxtx/rxtx-2.2-minor.patch b/community/java-rxtx/rxtx-2.2-undefined_symbol.patch
similarity index 68%
rename from community/java-rxtx/rxtx-2.2-minor.patch
rename to community/java-rxtx/rxtx-2.2-undefined_symbol.patch
index b58f5ce58..8818cf94d 100644
--- a/community/java-rxtx/rxtx-2.2-minor.patch
+++ b/community/java-rxtx/rxtx-2.2-undefined_symbol.patch
@@ -1,5 +1,7 @@
 --- rxtx-20100211.orig/src/SerialImp.c	2018-11-04 13:02:53.306800091 +0100
 +++ rxtx-20100211.new/src/SerialImp.c	2018-11-04 13:01:39.495497644 +0100
+--- ./src/SerialImp.c.orig	2018-11-04 13:02:53.306800091 +0100
++++ ./src/SerialImp.c		2018-11-04 13:01:39.495497644 +0100
 @@ -148,6 +148,7 @@
  #endif /* LIBLOCKDEV */