[pl/f16] Fix JPL interface

Petr Pisar ppisar at fedoraproject.org
Fri Mar 9 09:42:59 UTC 2012


commit 9fc831fc5c1899f24b15e6e73004ecefb2ddb2d5
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Mar 8 17:08:53 2012 +0100

    Fix JPL interface

 pl-5.10.2-jni.patch |   21 ---------------------
 pl-6.0.2-jni.patch  |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 pl.spec             |   22 +++++++++++++++-------
 3 files changed, 65 insertions(+), 28 deletions(-)
---
diff --git a/pl-6.0.2-jni.patch b/pl-6.0.2-jni.patch
new file mode 100644
index 0000000..e07a1da
--- /dev/null
+++ b/pl-6.0.2-jni.patch
@@ -0,0 +1,50 @@
+From d3695f95a95e834ed13c8f02f21feaf22ce51627 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Thu, 8 Mar 2012 14:54:23 +0100
+Subject: [PATCH] Fix JNI
+
+Prefer JNI and poved JNI files per Java Fedora packaging guidelines
+---
+ packages/jpl/jpl.pl                |    5 +++--
+ packages/jpl/src/java/jpl/JPL.java |    2 +-
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/packages/jpl/jpl.pl b/packages/jpl/jpl.pl
+index 83b8aee..f614d9e 100644
+--- a/packages/jpl/jpl.pl
++++ b/packages/jpl/jpl.pl
+@@ -4390,7 +4390,8 @@ prolog:error_message(java_exception(Ex)) -->
+ :- multifile user:file_search_path/2.
+ :- dynamic   user:file_search_path/2.
+ 
+-user:file_search_path(jar, swi(lib)).
++user:file_search_path(jar, 'LIBDIR/swipl-jpl').
++user:file_search_path(jni, 'LIBDIR/swipl-jpl').
+ 
+ %%	add_search_path(+Var, +Value) is det.
+ %
+@@ -4534,7 +4535,7 @@ add_jpl_to_classpath :-
+ 
+ libjpl(File) :-
+ 	(   current_prolog_flag(unix, true)
+-	->  File = foreign(libjpl)
++	->  File = jni(libjpl)
+ 	;   File = foreign(jpl)
+ 	).
+ 
+diff --git a/packages/jpl/src/java/jpl/JPL.java b/packages/jpl/src/java/jpl/JPL.java
+index 1c82d83..311355c 100644
+--- a/packages/jpl/src/java/jpl/JPL.java
++++ b/packages/jpl/src/java/jpl/JPL.java
+@@ -97,7 +97,7 @@ public class JPL {
+ 		} else if (nativeLibraryDir != null) {
+             System.load((new File(nativeLibraryDir, System.mapLibraryName(nativeLibraryName))).getAbsolutePath());
+ 		} else {
+-			System.loadLibrary(nativeLibraryName); // as resolved somewhere on system property 'java.library.path'
++			System.load((new File(LIBDIR, System.mapLibraryName(nativeLibraryName))).getAbsolutePath());
+ 		}
+ 	}
+ 	// setDTMMode
+-- 
+1.7.7.6
+
diff --git a/pl.spec b/pl.spec
index d53507b..1cf65df 100644
--- a/pl.spec
+++ b/pl.spec
@@ -6,7 +6,7 @@
 
 Name:       pl
 Version:    5.10.2
-Release:    7%{?dist}.1
+Release:    8%{?dist}
 
 Summary:    SWI-Prolog - Edinburgh compatible Prolog compiler
 
@@ -25,7 +25,7 @@ Source1:    http://www.swi-prolog.org/download/stable/doc/SWI-Prolog-%{version}.
 Source2:    http://www.swi-prolog.org/download/xpce/doc/userguide/userguide.html.tgz
 Patch1:     %{name}-5.10.2-jpl-configure.patch
 Patch2:     %{name}-5.10.2-man-files.patch
-Patch3:     %{name}-5.10.2-jni.patch
+Patch3:     %{name}-6.0.2-jni.patch
 Patch4:     %{name}-5.10.2-pc.patch
 # Upstream bug #470, will be in 5.10.3
 Patch5:     %{name}-5.10.2-FIXED-Bug-470-Using-export-dynamic-is-not-a-valid-gc.patch
@@ -174,6 +174,7 @@ cd packages/xpce
 # Adjustments to take into account the new location of JNI stuff
 sed --in-place=.jni2 -e 's#LIBDIR#%{_libdir}#g' packages/jpl/jpl.pl
 sed --in-place=.jni2 -e 's#LIBDIR#%{_libdir}#g' packages/jpl/src/java/jpl/fli/Prolog.java
+sed --in-place=.jni2 -e 's#LIBDIR#"%{_libdir}/swipl-jpl"#g' packages/jpl/src/java/jpl/JPL.java
 
 
 %build
@@ -232,11 +233,13 @@ popd
 %if %{with_java}
 # Move the JPL JNI stuff to where the Java packaging guidelines 
 # say it should be
-mkdir -p $RPM_BUILD_ROOT%{_libdir}/swipl-jpl
-mv $RPM_BUILD_ROOT%{_libdir}/swipl-%{version}/lib/*/libjpl.so \
-        $RPM_BUILD_ROOT%{_libdir}/swipl-jpl/
-mv $RPM_BUILD_ROOT%{_libdir}/swipl-%{version}/lib/jpl.jar \
-        $RPM_BUILD_ROOT%{_libdir}/swipl-jpl/
+pushd $RPM_BUILD_ROOT%{_libdir}
+mkdir -p swipl-jpl
+mv swipl-%{version}/lib/*/libjpl.so swipl-jpl/
+mv swipl-%{version}/lib/jpl.jar swipl-jpl/
+# Original JAR locations is referenced by internal libraries and examples
+ln -s ../../swipl-jpl/jpl.jar swipl-%{version}/lib/jpl.jar
+popd
 %endif
 
 %if %{separate_xpce}
@@ -283,6 +286,7 @@ rm -rf $RPM_BUILD_ROOT
 # Exclude the files that are in the sub-packages
 %if %{with_java}
 # JPL
+%exclude %{_libdir}/swipl-%{version}/lib/jpl.jar
 %exclude %{_libdir}/swipl-%{version}/library/jpl.pl
 %endif
 # Devel
@@ -328,12 +332,16 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc packages/jpl/docs/*
 %doc packages/jpl/examples
+%{_libdir}/swipl-%{version}/lib/jpl.jar
 %{_libdir}/swipl-%{version}/library/jpl.pl
 %{_libdir}/swipl-jpl
 %endif
 
 
 %changelog
+* Thu Mar 08 2012 Petr Pisar <ppisar at redhat.com> - 5.10.2-8
+- Fix JPL interface (bug #590499)
+
 * Wed Oct 26 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.10.2-7.1
 - Rebuilt for glibc bug#747377
 


More information about the scm-commits mailing list