Added recipe for rxtx

This commit is contained in:
Gerasim Troeglazov
2015-05-28 22:30:15 +10:00
parent 3008d3443b
commit 61459761af
2 changed files with 190 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
From cfd620b3d0cd312f21f2e97c732796e549e6750e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 11 Apr 2015 15:11:24 +1000
Subject: [PATCH 1/1] Add Haiku support
---
src/SerialImp.c | 16 +++++++++++++---
src/SerialImp.h | 6 ++++++
src/gnu/io/RXTXCommDriver.java | 9 ++++++++-
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/SerialImp.c b/src/SerialImp.c
index 617eaac..1352581 100644
--- a/src/SerialImp.c
+++ b/src/SerialImp.c
@@ -148,6 +148,11 @@
#include <lockdev.h>
#endif /* LIBLOCKDEV */
+#ifdef __HAIKU__
+#define major(x) (0)
+#define minor(x) (0)
+#endif
+
extern int errno;
#ifdef WIN32
@@ -288,7 +293,7 @@ JNIEXPORT void JNICALL RXTXPort(Initialize)(
threads, because it slows things down. Go figure. */
/* POSIX signal handling functions */
-#if !defined(WIN32)
+#if !defined(WIN32) && !defined(__HAIKU__)
struct sigaction old_action;
sigaction(SIGIO, NULL, &old_action);
/* green threads already has handler, no touch */
@@ -426,7 +431,7 @@ int configure_port( int fd )
if( cfsetospeed( &ttyset, B9600 ) < 0 ) goto fail;
#endif
if( tcsetattr( fd, TCSANOW, &ttyset ) < 0 ) goto fail;
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__HAIKU__)
fcntl( fd, F_SETOWN, getpid() );
#endif /* WIN32 */
#ifdef FASYNC
@@ -566,8 +571,10 @@ void set_java_vars( JNIEnv *env, jobject jobj, int fd )
switch( ttyset.c_cflag&CSIZE ) {
+#ifndef __HAIKU__
case CS5: databits = JDATABITS_5; break;
case CS6: databits = JDATABITS_6; break;
+#endif
case CS7: databits = JDATABITS_7; break;
case CS8: databits = JDATABITS_8; break;
}
@@ -2774,8 +2781,10 @@ JNIEXPORT jint JNICALL RXTXPort(nativeStaticGetDataBits)( JNIEnv *env, jobject j
return(-1);
}
switch( ttyset.c_cflag&CSIZE ) {
+#ifndef __HAIKU__
case CS5: return JDATABITS_5;
case CS6: return JDATABITS_6;
+#endif
case CS7: return JDATABITS_7;
case CS8: return JDATABITS_8;
default: return(-1);
@@ -3962,9 +3971,10 @@ void check_tiocmget_changes( struct event_info_struct * eis )
send_event( eis, SPE_DSR, change );
}
+#ifndef __HAIKU__
change = (mflags&TIOCM_RNG) - (eis->omflags&TIOCM_RNG);
if( eis && change ) send_event( eis, SPE_RI, change );
-
+#endif
change = (mflags&TIOCM_CD) - (eis->omflags&TIOCM_CD);
if( eis && change ) send_event( eis, SPE_CD, change );
diff --git a/src/SerialImp.h b/src/SerialImp.h
index 2677c28..f0820e1 100644
--- a/src/SerialImp.h
+++ b/src/SerialImp.h
@@ -271,6 +271,12 @@ Trent
# define LOCKFILEPREFIX ""
# define UUCP
#endif /* __BEOS__ */
+#if defined(__HAIKU__)
+# define DEVICEDIR "/dev/ports/"
+# define LOCKDIR "/var"
+# define LOCKFILEPREFIX ""
+# define UUCP
+#endif /* __BEOS__ */
#if defined(WIN32)
# define DEVICEDIR "//./"
# define LOCKDIR ""
diff --git a/src/gnu/io/RXTXCommDriver.java b/src/gnu/io/RXTXCommDriver.java
index 75929c1..0ce9333 100644
--- a/src/gnu/io/RXTXCommDriver.java
+++ b/src/gnu/io/RXTXCommDriver.java
@@ -848,7 +848,14 @@ public class RXTXCommDriver implements CommDriver
};
CandidatePortPrefixes=Temp;
}
-
+ else if(osName.equals("Haiku"))
+ {
+ String[] Temp = {
+ "serial",
+ "usb"
+ };
+ CandidatePortPrefixes=Temp;
+ }
else if(osName.equals("BeOS"))
{
String[] Temp = {
--
2.2.2

View File

@@ -0,0 +1,71 @@
SUMMARY="RXTX is a native serial library for java serial communication that runs on many OS."
DESCRIPTION="
RXTX is a Java library, using a native implementation (via JNI), providing serial \
and parallel communication for the Java Development Toolkit (JDK). All deliverables \
are under the GNU LGPL license. It is based on the specification for Sun Java \
Communications API, though while many of the class descriptions are the same the \
package used it not, since gnu.io is used instead. A certain amount of compatibility \
is intended with API, though this project should be considered as a fork and \
therefore compatible in spirit, but not in implementation."
HOMEPAGE="http://rxtx.qbang.org"
COPYRIGHT="(c) 1998-2006 Keane Jarvi"
LICENSE="GNU GPL v2"
SRC_URI="git+https://github.com/arduino/RXTX#84a009c"
REVISION="1"
ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
# x86_gcc2 is fine as primary target architecture as long as we're building
# for a different secondary architecture.
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"
PATCHES="rxtx-2.2_haiku-support.patch"
PROVIDES="
rxtx$secondaryArchSuffix = $portVersion
lib:librxtxSerial$secondaryArchSuffix = 0.0.0 compat >= 0
"
REQUIRES="
haiku$secondaryArchSuffix
openjdk${secondaryArchSuffix}
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
openjdk${secondaryArchSuffix}
"
BUILD_PREREQUIRES="
openjdk${secondaryArchSuffix}
cmd:aclocal
cmd:autoconf
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:javac
cmd:javah
cmd:libtoolize
cmd:make
cmd:find
"
BUILD()
{
sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.in
libtoolize --force --copy --install
aclocal
autoconf
runConfigure ./configure CPPFLAGS="-I/boot/system/lib/x86/openjdk/include/haiku"
make
}
INSTALL()
{
mkdir -p $libDir/openjdk/jre/lib/i386
cp i586-pc-haiku/.libs/librxtxSerial-2.2.so $libDir/openjdk/jre/lib/i386
cp i586-pc-haiku/.libs/librxtxSerial.so $libDir/openjdk/jre/lib/i386
mkdir -p $libDir/openjdk/jre/lib/ext
cp RXTXcomm.jar $libDir/openjdk/jre/lib/ext
}