Fix up java subpackage installation directories

- Fix java JNI loading code
This commit is contained in:
Stanislav Ochotnicky 2012-12-12 15:52:40 +01:00
parent 030cad36c2
commit d5cc6e70d2
2 changed files with 40 additions and 14 deletions

21
brltty-loadLibrary.patch Normal file
View File

@ -0,0 +1,21 @@
diff --git a/Bindings/Java/Native.java b/Bindings/Java/Native.java
index 8a3b003..c404bf2 100644
--- a/Bindings/Java/Native.java
+++ b/Bindings/Java/Native.java
@@ -21,7 +21,15 @@ package org.a11y.BrlAPI;
public class Native {
static {
- System.loadLibrary("brlapi_java");
+ try {
+ System.load( "/usr/lib64/brltty/libbrlapi_java.so" );
+ } catch( UnsatisfiedLinkError e ) {
+ try {
+ System.load( "/usr/lib/brltty/libbrlapi_java.so" );
+ } catch( UnsatisfiedLinkError f ) {
+ throw new UnsatisfiedLinkError("brlapi_java library load failed");
+ }
+ }
}
protected long handle;

View File

@ -10,7 +10,6 @@
%define _exec_prefix %{nil}
%define _libdir /%{_lib}
%define _jnidir %{_prefix}/%{_lib}/java
# with speech dispatcher iff on Fedora:
%define with_speech_dispatcher 0%{?fedora}
@ -21,7 +20,7 @@
Name: brltty
Version: %{pkg_version}
Release: 8%{?dist}
Release: 9%{?dist}
License: GPLv2+
Group: System Environment/Daemons
URL: http://mielke.cc/brltty/
@ -30,6 +29,7 @@ Patch0: brltty-cppflags.patch
Patch1: brltty-autoconf-quote.patch
#Patch2: brltty-4.2-S_ISCHR.patch
Patch3: brltty-parallel.patch
Patch4: brltty-loadLibrary.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Summary: Braille display driver for Linux/Unix
BuildRequires: byacc glibc-kernheaders
@ -133,10 +133,8 @@ Version: %{api_version}
Group: Development/System
License: LGPLv2+
Requires: brlapi = %{api_version}-%{release}
## temporary work around, java-devel is not resolved consistently across archs
#BuildRequires: jpackage-utils
BuildRequires: jpackage-utils
BuildRequires: java-devel
#BuildRequires: java-1.5.0-gcj-devel
Summary: Java binding for BrlAPI
%description -n brlapi-java
This package provides the Java binding for BrlAPI.
@ -162,6 +160,7 @@ This package provides the OCaml binding for BrlAPI.
%patch1 -p1 -b .quote
#%%patch2 -p1 -b .S_ISCHR
%patch3 -p1 -b .parallel
%patch4 -p1 -b .loadLibrary
%build
# Patch6 changes aclocal.m4:
@ -176,6 +175,11 @@ done
--with-speechd=%{_prefix} \
%endif
--with-install-root="${RPM_BUILD_ROOT}"
JAVA_JAR_DIR=%{_jnidir} \
JAVA_JNI_DIR=%{_libdir}/brltty \
JAVA_JNI=yes
make %{?_smp_mflags}
find . \( -path ./doc -o -path ./Documents \) -prune -o \
@ -202,19 +206,15 @@ done
%install
rm -rf $RPM_BUILD_ROOT
# does not seem to be parallel safe
make install
make install JAVA_JAR_DIR=%{_jnidir} \
JAVA_JNI_DIR=%{_libdir}/brltty \
JAVA_JNI=yes
rm "$RPM_BUILD_ROOT%{_libdir}/libbrlapi.so"
ln -s ../../%{_lib}/libbrlapi.so.0.5 "$RPM_BUILD_ROOT%{_prefix}/%{_lib}/libbrlapi.so"
install -d -m 755 "${RPM_BUILD_ROOT}%{_sysconfdir}" "$RPM_BUILD_ROOT%{_mandir}/man5"
install -m 644 Documents/brltty.conf "${RPM_BUILD_ROOT}%{_sysconfdir}"
echo ".so man1/brltty.1" > $RPM_BUILD_ROOT%{_mandir}/man5/brltty.conf.5
%if %{_lib} == "lib64"
#Manually place java plugin on 64-bit arches
mkdir $RPM_BUILD_ROOT%{_prefix}/%{_lib}/java/
install -m 755 Bindings/Java/libbrlapi_java.so "$RPM_BUILD_ROOT%{_prefix}/%{_lib}/java/"
%endif
# clean up the manuals:
rm Documents/Manual-*/*/{*.mk,*.made,Makefile*}
mv Documents/BrlAPIref/{html,BrlAPIref}
@ -258,6 +258,7 @@ exit 0
%{_libdir}/brltty/
%exclude %{_libdir}/brltty/libbrlttybba.so
%exclude %{_libdir}/brltty/libbrlttybxw.so
%exclude %{_libdir}/brltty/libbrlapi_java.so
%if %{with_speech_dispatcher}
%exclude %{_libdir}/brltty/libbrlttyssd.so
%endif
@ -311,8 +312,8 @@ exit 0
%files -n brlapi-java
%defattr(-,root,root)
%{_jnidir}/libbrlapi_java.so
%{_javadir}/brlapi.jar
%{_libdir}/brltty/libbrlapi_java.so
%{_jnidir}/brlapi.jar
%if 0%{?with_ocaml}
%files -n ocaml-brlapi
@ -322,6 +323,10 @@ exit 0
%endif
%changelog
* Wed Dec 12 2012 Stanislav Ochotnicky <sochotnicky@redhat.com> - 4.3-9
- Fix up java subpackage installation directories
- Fix java JNI loading code
* Wed Oct 17 2012 Jon Ciesla <limburgher@gmail.com> - 4.3-8
- Bump and rebuild for new ocaml.