From 471a86474c3af71afff27a0ea92ff911d5a2d8c6 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 00:10:45 +0100 Subject: [PATCH] added no_utsrelease patch to disable kernel version dependent code checks [release 2.1-4mamba;Wed Feb 06 2013] --- README.md | 2 + java-rxtx-2.1-loadlibrary.patch | 96 ++++++++++++++++++++++++++++ java-rxtx-2.1-no_utsrelease.patch | 95 ++++++++++++++++++++++++++++ java-rxtx.spec | 102 ++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+) create mode 100644 java-rxtx-2.1-loadlibrary.patch create mode 100644 java-rxtx-2.1-no_utsrelease.patch create mode 100644 java-rxtx.spec diff --git a/README.md b/README.md index 5383bd6..833d56c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # java-rxtx +RXTX is an full implementation of java commapi which aims to support RS232 IEEE 1284, RS485, I2C and RawIO. + diff --git a/java-rxtx-2.1-loadlibrary.patch b/java-rxtx-2.1-loadlibrary.patch new file mode 100644 index 0000000..353c1c5 --- /dev/null +++ b/java-rxtx-2.1-loadlibrary.patch @@ -0,0 +1,96 @@ +diff -Nru src/CommPortIdentifier.java src-gil/CommPortIdentifier.java +--- src/CommPortIdentifier.java 2004-10-12 10:59:27.000000000 +0200 ++++ src-gil/CommPortIdentifier.java 2010-03-09 16:07:18.000000000 +0100 +@@ -80,7 +80,7 @@ + if (debug) + System.out.println("Have not implemented native_psmisc_report_owner(PortName)); in CommPortIdentifier"); + } +- System.loadLibrary( "rxtxSerial" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxSerial" )); + } + CommPortIdentifier ( String pn, CommPort cp, int pt, CommDriver driver) + { +diff -Nru src/I2C.java src-gil/I2C.java +--- src/I2C.java 2004-10-12 10:59:27.000000000 +0200 ++++ src-gil/I2C.java 2010-03-09 16:07:55.000000000 +0100 +@@ -35,7 +35,7 @@ + + static + { +- System.loadLibrary( "rxtxI2C" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxI2C" )); + Initialize(); + } + +diff -Nru src/LPRPort.java src-gil/LPRPort.java +--- src/LPRPort.java 2004-10-12 10:59:27.000000000 +0200 ++++ src-gil/LPRPort.java 2010-03-09 16:24:04.000000000 +0100 +@@ -32,7 +32,7 @@ + { + + static { +- System.loadLibrary( "rxtxParallel" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxParallel" )); + Initialize(); + } + +diff -Nru src/Raw.java src-gil/Raw.java +--- src/Raw.java 2004-10-12 10:59:27.000000000 +0200 ++++ src-gil/Raw.java 2010-03-09 16:12:20.000000000 +0100 +@@ -32,7 +32,7 @@ + + static + { +- System.loadLibrary( "rxtxRaw" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxRaw" )); + Initialize(); + } + +diff -Nru src/RS485.java src-gil/RS485.java +--- src/RS485.java 2004-10-12 10:59:27.000000000 +0200 ++++ src-gil/RS485.java 2010-03-09 16:08:57.000000000 +0100 +@@ -32,7 +32,7 @@ + + static + { +- System.loadLibrary( "rxtxRS485" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxRS485" )); + Initialize(); + } + +diff -Nru src/RXTXCommDriver.java src-gil/RXTXCommDriver.java +--- src/RXTXCommDriver.java 2006-01-30 05:37:49.000000000 +0100 ++++ src-gil/RXTXCommDriver.java 2010-03-09 16:19:51.000000000 +0100 +@@ -42,7 +42,7 @@ + static + { + if(debug ) System.out.println("RXTXCommDriver {}"); +- System.loadLibrary( "rxtxSerial" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxSerial" )); + + /* + Perform a crude check to make sure people don't mix +diff -Nru src/RXTXPort.java src-gil/RXTXPort.java +--- src/RXTXPort.java 2006-01-30 03:50:57.000000000 +0100 ++++ src-gil/RXTXPort.java 2010-03-09 16:18:04.000000000 +0100 +@@ -51,7 +51,7 @@ + + if(debug ) + z.reportln( "RXTXPort {}"); +- System.loadLibrary( "rxtxSerial" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName( "rxtxSerial" )); + Initialize(); + } + +diff -Nru src/RXTXVersion.java src-gil/RXTXVersion.java +--- src/RXTXVersion.java 2006-01-29 23:19:04.000000000 +0100 ++++ src-gil/RXTXVersion.java 2010-03-09 16:11:22.000000000 +0100 +@@ -36,7 +36,7 @@ + private static String Version; + + static { +- System.loadLibrary( "rxtxSerial" ); ++ System.load("@JNIPATH@/" + System.mapLibraryName("rxtxSerial")); + Version = "RXTX-2.1-7"; + } + /** diff --git a/java-rxtx-2.1-no_utsrelease.patch b/java-rxtx-2.1-no_utsrelease.patch new file mode 100644 index 0000000..3b77096 --- /dev/null +++ b/java-rxtx-2.1-no_utsrelease.patch @@ -0,0 +1,95 @@ +diff -Nru rxtx-2.1-7r2.orig/CNI/SerialImp.c rxtx-2.1-7r2/CNI/SerialImp.c +--- rxtx-2.1-7r2.orig/CNI/SerialImp.c 2005-06-16 17:09:55.000000000 +0200 ++++ rxtx-2.1-7r2/CNI/SerialImp.c 2013-02-06 19:39:13.973705958 +0100 +@@ -245,13 +245,6 @@ + LEAVE( "RXTXPort:Initialize" ); + return; + } +- if(strcmp(name.release,UTS_RELEASE)!=0) +- { +- sprintf( message, LINUX_KERNEL_VERSION_ERROR, UTS_RELEASE, +- name.release ); +- report( message ); +- getchar(); +- } + LEAVE( "RXTXPort:Initialize" ); + #endif /* DEBUG && __linux__ */ + } +diff -Nru rxtx-2.1-7r2.orig/src/I2CImp.c rxtx-2.1-7r2/src/I2CImp.c +--- rxtx-2.1-7r2.orig/src/I2CImp.c 2004-10-17 16:23:02.000000000 +0200 ++++ rxtx-2.1-7r2/src/I2CImp.c 2013-02-06 19:38:08.349258600 +0100 +@@ -93,11 +93,6 @@ + fprintf(stderr,"RXTX WARNING: cannot get system name\n"); + return; + } +- if(strcmp(name.release,UTS_RELEASE)!=0) +- { +- fprintf(stderr, "\n\n\nRXTX WARNING: This library was compiled to run with OS release %s and you are currently running OS release %s. In some cases this can be a problem. Try recompiling RXTX if you notice strange behavior. If you just compiled RXTX make sure /usr/include/linux is a symbolic link to the include files that came with the kernel source and not an older copy.\n\n\npress enter to continue\n",UTS_RELEASE,name.release); +- getchar(); +- } + #endif /* __linux__ */ + #endif /* WIN32 */ + } +diff -Nru rxtx-2.1-7r2.orig/src/RawImp.c rxtx-2.1-7r2/src/RawImp.c +--- rxtx-2.1-7r2.orig/src/RawImp.c 2004-10-16 18:20:35.000000000 +0200 ++++ rxtx-2.1-7r2/src/RawImp.c 2013-02-06 19:38:28.770086558 +0100 +@@ -237,11 +237,6 @@ + fprintf(stderr,"RXTX WARNING: cannot get system name\n"); + return; + } +- if(strcmp(name.release,UTS_RELEASE)!=0) +- { +- fprintf(stderr, "\n\n\nRXTX WARNING: This library was compiled to run with OS release %s and you are currently running OS release %s. In some cases this can be a problem. Try recompiling RXTX if you notice strange behavior. If you just compiled RXTX make sure /usr/include/linux is a symbolic link to the include files that came with the kernel source and not an older copy.\n\n\npress enter to continue\n",UTS_RELEASE,name.release); +- getchar(); +- } + #endif /* __linux__ */ + #endif /* WIN32 */ + } +diff -Nru rxtx-2.1-7r2.orig/src/RS485Imp.c rxtx-2.1-7r2/src/RS485Imp.c +--- rxtx-2.1-7r2.orig/src/RS485Imp.c 2004-10-16 18:20:35.000000000 +0200 ++++ rxtx-2.1-7r2/src/RS485Imp.c 2013-02-06 19:37:52.370393265 +0100 +@@ -93,11 +93,6 @@ + fprintf(stderr,"RXTX WARNING: cannot get system name\n"); + return; + } +- if(strcmp(name.release,UTS_RELEASE)!=0) +- { +- fprintf(stderr, "\n\n\nRXTX WARNING: This library was compiled to run with OS release %s and you are currently running OS release %s. In some cases this can be a problem. Try recompiling RXTX if you notice strange behavior. If you just compiled RXTX make sure /usr/include/linux is a symbolic link to the include files that came with the kernel source and not an older copy.\n\n\npress enter to continue\n",UTS_RELEASE,name.release); +- getchar(); +- } + #endif /* __linux__ */ + #endif /* WIN32 */ + } +diff -Nru rxtx-2.1-7r2.orig/src/SerialImp.c rxtx-2.1-7r2/src/SerialImp.c +--- rxtx-2.1-7r2.orig/src/SerialImp.c 2006-01-29 23:19:04.000000000 +0100 ++++ rxtx-2.1-7r2/src/SerialImp.c 2013-02-06 19:39:01.875807791 +0100 +@@ -287,13 +287,6 @@ + LEAVE( "RXTXPort:Initialize" ); + return; + } +- if(strcmp(name.release,UTS_RELEASE)!=0) +- { +- sprintf( message, LINUX_KERNEL_VERSION_ERROR, UTS_RELEASE, +- name.release ); +- report( message ); +- getchar(); +- } + LEAVE( "RXTXPort:Initialize" ); + #endif /* DEBUG && __linux__ */ + } +diff -Nru rxtx-2.1-7r2.orig/src/SerialImp.cpp rxtx-2.1-7r2/src/SerialImp.cpp +--- rxtx-2.1-7r2.orig/src/SerialImp.cpp 2004-10-12 10:59:27.000000000 +0200 ++++ rxtx-2.1-7r2/src/SerialImp.cpp 2013-02-06 19:38:42.823968196 +0100 +@@ -108,12 +108,6 @@ + report("RXTX WARNING: cannot get system name\n"); + return; + } +- if(!strcmp(name.release,UTS_RELEASE)) +- { +- fprintf(stderr, LINUX_KERNEL_VERSION_ERROR, UTS_RELEASE, +- name.release); +- getchar(); +- } + #endif /* DEBUG */ + #endif /* __BEOS__ */ + #endif /* WIN32 */ diff --git a/java-rxtx.spec b/java-rxtx.spec new file mode 100644 index 0000000..0fa04fd --- /dev/null +++ b/java-rxtx.spec @@ -0,0 +1,102 @@ +%define rel 7 +%define rel_version %{rel}r2 + +Name: java-rxtx +Version: 2.1 +Release: 4mamba +Summary: Provides access to serial ports +Group: System/Libraries/Java +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://rxtx.qbang.org/wiki/index.php/Main_Page +# cvs -d:pserver:anonymous@qbang.org:/var/cvs/cvsroot co -r commapi-0-0-1 -D "2010-02-11" -d rxtx-20100211 rxtx-devel +# tar cjvf rxtx-20100211.tar.bz2 --exclude CVS --exclude .cvsignore rxtx-20100211 +Source: http://rxtx.qbang.org/pub/rxtx/rxtx-%{version}-%{rel_version}.zip +Patch0: java-rxtx-2.1-loadlibrary.patch +Patch1: java-rxtx-2.1-no_utsrelease.patch +License: LGPL +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +BuildRequires: jpackage-utils +BuildRequires: kernelheaders +BuildRequires: make +Requires: jpackage-utils +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +RXTX is an full implementation of java commapi which aims to support RS232 IEEE 1284, RS485, I2C and RawIO. + +%prep +%setup -q -n rxtx-%{version}-%{rel_version} + +for j in $(find . -name "*.jar"); do + rm -rf $j +done + +for j in $(find . -name "*.hqx"); do + rm -rf $j +done + +sed -e 's|@JNIPATH@|%{_libdir}/rxtx|' %{PATCH0} | patch -p0 + +%patch1 -p1 + +for j in $(find . -name "CVS"); do + rm -rf $j +done + +iconv -f ISO_8859-1 -t UTF-8 ChangeLog >ChangeLog.utf-8 +mv ChangeLog.utf-8 ChangeLog + +sed -i 's,\(1\.5\*\),\1|1.6*,' configure + +%build +export JAVA_HOME=%{_jvmdir}/jdk +%configure +make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +mkdir -p %{buildroot}{%{_javadir},%{_libdir}/rxtx} + +make RXTX_PATH=%{buildroot}%{_libdir}/rxtx JHOME=%{buildroot}%{_javadir} install + +# remove useless files +find %{buildroot} -name '*.la' -exec rm {} \; + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%dir %{_libdir}/rxtx +%{_libdir}/rxtx/librxtxI2C-%{version}-%{rel}.so +%{_libdir}/rxtx/librxtxI2C.so +%{_libdir}/rxtx/librxtxParallel-%{version}-%{rel}.so +%{_libdir}/rxtx/librxtxParallel.so +%{_libdir}/rxtx/librxtxRS485-%{version}-%{rel}.so +%{_libdir}/rxtx/librxtxRS485.so +%{_libdir}/rxtx/librxtxRaw-%{version}-%{rel}.so +%{_libdir}/rxtx/librxtxRaw.so +%{_libdir}/rxtx/librxtxSerial-%{version}-%{rel}.so +%{_libdir}/rxtx/librxtxSerial.so +%{_javadir}/RXTXcomm.jar +%doc AUTHORS COPYING +#ChangeLog INSTALL install-japanese.html PORTING +#%doc README* RMISecurityManager.html SerialPortInstructions.txt TODO + +%changelog +* Wed Feb 06 2013 Silvan Calarco 2.1-4mamba +- added no_utsrelease patch to disable kernel version dependent code checks + +* Sat Mar 24 2012 Silvan Calarco 2.1-3mamba +- buildrequire kernelheaders instead of kernel-mamba-headers + +* Wed Mar 21 2012 Stefano Cotta Ramusino 2.1-2mamba +- fixed build with jdk 1.6 +- remove static package + +* Tue Mar 09 2010 gil 2.1-1mamba +- package created by autospec