Re: Java -- how to use jni.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Andrew,

On Mon, May 11, 2009 at 09:43:07AM -0400, Andrew Overholt wrote:
> Sure, it would be great if you could post a patch to the wiki page it
> would help.

attached please find a first approximation; patch to Packaging:Java
wiki source.

Cheers,
	Stepan Kasal
Summary: Added subsection: How to build with jni.h generally

--- packaging.orig	2009-05-12 16:58:30.000000000 +0200
+++ packaging-java	2009-05-12 16:59:28.000000000 +0200
@@ -344,6 +344,22 @@
 {{Anchor|JNI}}
 == Packaging JAR files that use JNI ==
 
+=== Writing general spec file ===
+Keep in mind that your package should build under different flavors of Java.  In order to achieve this, you have to instruct the C preprocessor to search for header file in the include subdirectories under <code>/usr/lib/jvm/java</code>, which is a symlink maintained by the <code>alternatives</code> system.
+(Though file <code>jni.h</code> is
+in the default gcc include path when gcj is used, it is not so for openjdk.)
+
+If the package uses Autoconf-generated configure script, follow this template:
+<pre>
+BuildRequires: java-devel
+[...]
+%build
+for i in -I/usr/lib/jvm/java/include{,/linux}; do
+      java_inc="$java_inc $i"
+done
+%configure CPPFLAGS="$java_inc"
+</pre>
+
 === Applicability ===
 
 Java programs that wish to make calls into native libraries do so via the Java Native Interface (JNI).  A Java package uses JNI if it contains a .so
--
Fedora-packaging mailing list
Fedora-packaging@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-packaging

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux