added community/java-rxtx

This commit is contained in:
Kevin Mihelich 2018-04-25 12:51:50 +00:00
parent a58df78d1b
commit 43f3769b60
8 changed files with 231 additions and 0 deletions

View file

@ -0,0 +1,76 @@
# $Id$
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Vitaliy Berdinskikh ur6lad[at]i.ua
# 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
pkgname=java-rxtx
_pkgname=rxtx
pkgver=2.2pre2
pkgrel=5
pkgdesc="Java library for serial IO"
arch=('x86_64')
url="http://rxtx.qbang.org/"
license=('LGPL')
depends=('glibc' 'java-runtime>=8' 'systemd')
makedepends=('java-environment>=8')
provides=("$_pkgname=$pkgver")
replaces=("$_pkgname")
install=$pkgname.install
source=(http://rxtx.qbang.org/pub/$_pkgname/$_pkgname-$pkgver.zip
utsrelease.patch
rxtx-2.2-lock.patch
rxtx-2.2-fhs_lock.patch
ttyACM_port.patch
java10.patch
rxtx-sys_io_h_check.patch)
md5sums=('7eedb18e3f33a427e2b0e9be8ce3f94c'
'2f21ec5eb108f871815242698b6150f1'
'1f7c43d582bfe9daea22d7f7057436da'
'f4d22d263f45cd1d4db6242dd0ac78ae'
'903a3fe0067d0682dd5f64483c741df6'
'c743b0be1ae32e8e7d1bc3e596a65766'
'6fa4482df20625f652ecad818e92614a')
prepare() {
cd $_pkgname-$pkgver
# Fix build
patch -Np1 -i ../utsrelease.patch
# Fix lockdir patch
patch -Np1 -i ../rxtx-2.2-lock.patch
# Fix buffer overflow
patch -Np1 -i ../rxtx-2.2-fhs_lock.patch
# Enable more ports
patch -Np1 -i ../ttyACM_port.patch
# Fix build with openjdk10
patch -Np1 -i ../java10.patch
# Fix ARM build
patch -Np1 -i ../rxtx-sys_io_h_check.patch
rm *.m4
autoreconf -fi
}
build() {
cd $_pkgname-$pkgver
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make -j1
}
package() {
cd $_pkgname-$pkgver
mkdir -p "$pkgdir"/usr/{lib,share/java/rxtx}
make JHOME="$pkgdir/usr/share/java/rxtx" RXTX_PATH="$pkgdir/usr/lib" install
# Setup lock directory
install -dm755 "$pkgdir"/usr/lib/tmpfiles.d
echo 'd /run/lock/lockdev 0775 root lock -' > "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
}

View file

@ -0,0 +1,3 @@
post_install() {
echo "Users need to be in 'lock' and 'uucp' groups to connect to devices"
}

View file

@ -0,0 +1,28 @@
diff -Naur rxtx-2.2pre2.orig/configure.in rxtx-2.2pre2/configure.in
--- rxtx-2.2pre2.orig/configure.in 2008-12-31 03:28:37.000000000 +0100
+++ rxtx-2.2pre2/configure.in 2018-04-25 07:50:42.382848449 +0200
@@ -483,8 +483,7 @@
;;
*)
find_java_native_include jni_md.h
- JAVAH="\$(JPATH)/bin/javah -classpath \$(CLASSPATH) -d \$(DEST) -jni"
- JAVAC="\$(JPATH)/bin/javac -classpath \$(CLASSPATH) -d \$(TOP)/ -O -source 1.3 -target 1.3"
+ JAVAC="\$(JPATH)/bin/javac -classpath \$(CLASSPATH) -d \$(TOP)/ -h \$(DEST) -O -source 6 -target 1.6"
JAR="\$(JPATH)/bin/jar"
JAVADOC="\$(JPATH)/bin/javadoc"
CFLAGS=$CFLAGS" -D_BSD_SOURCE"
diff -Naur rxtx-2.2pre2.orig/Makefile.am rxtx-2.2pre2/Makefile.am
--- rxtx-2.2pre2.orig/Makefile.am 2008-09-14 23:36:27.000000000 +0200
+++ rxtx-2.2pre2/Makefile.am 2018-04-25 07:50:01.198326446 +0200
@@ -111,11 +111,6 @@
$(CLASSES): $(javafiles) $(TOP)/Makefile
$(JAVAH_FIX)
$(JAVAC) $(javafiles)
- $(JAVAH) `(for i in $(javahfiles);do \
- if grep > /dev/null native.*\( $(SPATH)/gnu/io/$$i.java; then \
- echo $(CLASSDIR).$$i; \
- fi; \
- done)`
$(JAR) cf $(JARTARGET) $(CLASSTOP)/*
# install librxtxSerial.so into the proper directory and copy $(JARTARGET) to its

View file

@ -0,0 +1,13 @@
--- ./src/SerialImp.c.orig 2011-03-17 14:42:48.946047373 -0500
+++ ./src/SerialImp.c 2011-03-17 14:46:01.244904859 -0500
@@ -5291,8 +5291,8 @@
*
*/
int fd,j;
- char lockinfo[12], message[80];
- char file[80], *p;
+ char lockinfo[12], message[200];
+ char file[200], *p;
j = strlen( filename );
p = ( char * ) filename + j;

View file

@ -0,0 +1,12 @@
diff -up ./src/SerialImp.h.lock ./src/SerialImp.h
--- ./src/SerialImp.h.lock 2010-11-09 15:59:54.891179571 +0100
+++ ./src/SerialImp.h 2010-11-09 16:01:12.257819409 +0100
@@ -158,7 +158,7 @@ struct event_info_struct
# endif /* CMSPAR */
#
# define DEVICEDIR "/dev/"
-# define LOCKDIR "/var/lock"
+# define LOCKDIR "/var/lock/lockdev"
# define LOCKFILEPREFIX "LCK.."
# define FHS
#endif /* __linux__ */

View file

@ -0,0 +1,35 @@
Description: sys/io.h does not exist on all systems
Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=609152
Author: Scott Howard <showard@debian.org>
Index: rxtx/configure.in
===================================================================
--- rxtx.orig/configure.in 2011-02-23 23:01:09.596613286 -0500
+++ rxtx/configure.in 2011-02-23 23:02:41.269525630 -0500
@@ -71,6 +71,7 @@
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/signal.h)
AC_CHECK_HEADERS(signal.h)
+AC_CHECK_HEADERS(sys/io.h)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(pwd.h)
Index: rxtx/src/RawImp.c
===================================================================
--- rxtx.orig/src/RawImp.c 2011-02-23 23:04:29.641932242 -0500
+++ rxtx/src/RawImp.c 2011-02-23 23:05:40.487353587 -0500
@@ -99,11 +99,9 @@
# include <linux/serial.h>
# include <linux/version.h>
#endif
-#ifndef __APPLE__ /* dima */
-#ifndef PPC
-#include <sys/io.h>
-#endif /* PPC */
-#endif /* dima */
+#ifdef HAVE_SYS_IO_H
+# include <sys/io.h>
+#endif
extern int errno;
#include "I2CImp.h"

View file

@ -0,0 +1,28 @@
Description: Allows for the enumeration of many additional ports, including ttyACM for Arduino Unos
Author: Scott Howard <showard314@gmail.com>
Index: rxtx/src/gnu/io/RXTXCommDriver.java
===================================================================
--- rxtx.orig/src/gnu/io/RXTXCommDriver.java 2010-10-04 23:14:47.236148507 -0400
+++ rxtx/src/gnu/io/RXTXCommDriver.java 2010-10-04 23:18:56.976108303 -0400
@@ -574,20 +574,7 @@
if(osName.equals("Linux"))
{
String[] Temp = {
- "ttyS", // linux Serial Ports
"ttySA", // for the IPAQs
- "ttyUSB", // for USB frobs
- "rfcomm", // bluetooth serial device
- "ttyircomm", // linux IrCommdevices (IrDA serial emu)
- };
- CandidatePortPrefixes=Temp;
- }
- else if(osName.equals("Linux-all-ports"))
- {
- /* if you want to enumerate all ports ~5000
- possible, then replace the above with this
- */
- String[] Temp = {
"comx", // linux COMMX synchronous serial card
"holter", // custom card for heart monitoring
"modem", // linux symbolic link to modem.

View file

@ -0,0 +1,36 @@
diff -Naur rxtx-2.2pre2.orig/src/I2CImp.c rxtx-2.2pre2/src/I2CImp.c
--- rxtx-2.2pre2.orig/src/I2CImp.c 2007-04-26 07:26:05.000000000 +0200
+++ rxtx-2.2pre2/src/I2CImp.c 2013-08-10 13:28:54.690313710 +0200
@@ -125,7 +125,7 @@
sigaction( SIGIO, NULL, &handler );
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN );
#endif /* !__FreeBSD__ */
-#if defined(__linux__)
+#if defined(DEBUG) && defined(__linux__) && defined(UTS_RELEASE)
/* Lets let people who upgraded kernels know they may have problems */
if (uname (&name) == -1)
{
diff -Naur rxtx-2.2pre2.orig/src/RawImp.c rxtx-2.2pre2/src/RawImp.c
--- rxtx-2.2pre2.orig/src/RawImp.c 2007-11-18 23:32:42.000000000 +0100
+++ rxtx-2.2pre2/src/RawImp.c 2013-08-10 13:28:54.703647364 +0200
@@ -270,7 +270,7 @@
sigaction( SIGIO, NULL, &handler );
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN );
#endif /* !__FreeBSD__ */
-#if defined(__linux__)
+#if defined(DEBUG) && defined(__linux__) && defined(UTS_RELEASE)
/* Lets let people who upgraded kernels know they may have problems */
if (uname (&name) == -1)
{
diff -Naur rxtx-2.2pre2.orig/src/RS485Imp.c rxtx-2.2pre2/src/RS485Imp.c
--- rxtx-2.2pre2.orig/src/RS485Imp.c 2007-04-26 07:26:05.000000000 +0200
+++ rxtx-2.2pre2/src/RS485Imp.c 2013-08-10 13:28:54.706980778 +0200
@@ -125,7 +125,7 @@
sigaction( SIGIO, NULL, &handler );
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN );
#endif /* !__FreeBSD__ */
-#if defined(__linux__)
+#if defined(DEBUG) && defined(__linux__) && defined(UTS_RELEASE)
/* Lets let people who upgraded kernels know they may have problems */
if (uname (&name) == -1)
{