- Rebase on upstream 3.0.9
This commit is contained in:
parent
6907483b50
commit
de01bd4fc1
@ -1 +1 @@
|
||||
jna-3.0.4.svn729.tar.bz2
|
||||
jna-3.0.9.tar.bz2
|
||||
|
@ -1,11 +1,121 @@
|
||||
--- jna-3.0.2.default/src/com/sun/jna/Native.java 2008-02-11 16:04:47.000000000 -0500
|
||||
+++ jna-3.0.2/src/com/sun/jna/Native.java 2008-04-03 23:30:03.000000000 -0400
|
||||
@@ -85,7 +85,7 @@
|
||||
public static final int WCHAR_SIZE;
|
||||
static {
|
||||
diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Native.java
|
||||
--- jna-3.0.9/src/com/sun/jna/Native.java 2008-10-31 20:35:02.000000000 -0400
|
||||
+++ jna-3.0.9.orig/src/com/sun/jna/Native.java 2008-10-31 20:42:23.000000000 -0400
|
||||
@@ -504,109 +504,17 @@
|
||||
}
|
||||
|
||||
/**
|
||||
- * Loads the JNA stub library. It will first attempt to load this library
|
||||
- * from the directories specified in jna.boot.library.path. If that fails,
|
||||
- * it will fallback to loading from the system library paths. Finally it will
|
||||
- * attempt to extract the stub library from from the JNA jar file, and load it.
|
||||
- * <p>
|
||||
- * The jna.boot.library.path property is mainly to support jna.jar being
|
||||
- * included in -Xbootclasspath, where java.library.path and LD_LIBRARY_PATH
|
||||
- * are ignored. It might also be useful in other situations.
|
||||
- * </p>
|
||||
+ * Loads the JNA stub library.
|
||||
+ *
|
||||
+ ** MODIFIED FROM UPSTREAM - we rip out all sorts of gunk here that is
|
||||
+ ** unnecessary when JNA is properly installed with the OS.
|
||||
*/
|
||||
private static void loadNativeLibrary() {
|
||||
- String libName = "jnidispatch";
|
||||
- String bootPath = System.getProperty("jna.boot.library.path");
|
||||
- if (bootPath != null) {
|
||||
- String[] dirs = bootPath.split(File.pathSeparator);
|
||||
- for (int i = 0; i < dirs.length; ++i) {
|
||||
- String path = new File(new File(dirs[i]), System.mapLibraryName(libName)).getAbsolutePath();
|
||||
- try {
|
||||
- System.load(path);
|
||||
- return;
|
||||
- } catch (UnsatisfiedLinkError ex) {
|
||||
- }
|
||||
- if (Platform.isMac()) {
|
||||
- String orig, ext;
|
||||
- if (path.endsWith("dylib")) {
|
||||
- orig = "dylib";
|
||||
- ext = "jnilib";
|
||||
- } else {
|
||||
- orig = "jnilib";
|
||||
- ext = "dylib";
|
||||
- }
|
||||
- try {
|
||||
- System.load(path.substring(0, path.lastIndexOf(orig)) + ext);
|
||||
- return;
|
||||
- } catch (UnsatisfiedLinkError ex) {
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
try {
|
||||
- System.loadLibrary("jnidispatch");
|
||||
+ System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
|
||||
- System.loadLibrary(libName);
|
||||
- }
|
||||
- catch(UnsatisfiedLinkError e) {
|
||||
- loadNativeLibraryFromJar();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Extracts and loads the JNA stub library from jna.jar
|
||||
- */
|
||||
- private static void loadNativeLibraryFromJar() {
|
||||
- String libname = System.mapLibraryName("jnidispatch");
|
||||
- String resourceName = getNativeLibraryResourcePath() + "/" + libname;
|
||||
- URL url = Native.class.getResource(resourceName);
|
||||
-
|
||||
- // Add an ugly hack for OpenJDK (soylatte) - JNI libs use the usual .dylib extension
|
||||
- if (url == null && Platform.isMac() && resourceName.endsWith(".dylib")) {
|
||||
- resourceName = resourceName.substring(0, resourceName.lastIndexOf(".dylib")) + ".jnilib";
|
||||
- url = Native.class.getResource(resourceName);
|
||||
- }
|
||||
- if (url == null) {
|
||||
- throw new UnsatisfiedLinkError("jnidispatch (" + resourceName
|
||||
- + ") not found in resource path");
|
||||
- }
|
||||
-
|
||||
- File lib = null;
|
||||
- if (url.getProtocol().toLowerCase().equals("file")) {
|
||||
- // NOTE: use older API for 1.3 compatibility
|
||||
- lib = new File(URLDecoder.decode(url.getPath()));
|
||||
- }
|
||||
- else {
|
||||
- InputStream is = Native.class.getResourceAsStream(resourceName);
|
||||
- if (is == null) {
|
||||
- throw new Error("Can't obtain jnidispatch InputStream");
|
||||
- }
|
||||
-
|
||||
- FileOutputStream fos = null;
|
||||
- try {
|
||||
- // Suffix is required on windows, or library fails to load
|
||||
- // Let Java pick the suffix
|
||||
- lib = File.createTempFile("jna", null);
|
||||
- lib.deleteOnExit();
|
||||
- if (Platform.deleteNativeLibraryAfterVMExit()) {
|
||||
- Runtime.getRuntime().addShutdownHook(new DeleteNativeLibrary(lib));
|
||||
- }
|
||||
- fos = new FileOutputStream(lib);
|
||||
- int count;
|
||||
- byte[] buf = new byte[1024];
|
||||
- while ((count = is.read(buf, 0, buf.length)) > 0) {
|
||||
- fos.write(buf, 0, count);
|
||||
- }
|
||||
- }
|
||||
- catch(IOException e) {
|
||||
- throw new Error("Failed to create temporary file for jnidispatch library: " + e);
|
||||
- }
|
||||
- finally {
|
||||
- try { is.close(); } catch(IOException e) { }
|
||||
- if (fos != null) {
|
||||
- try { fos.close(); } catch(IOException e) { }
|
||||
- }
|
||||
- }
|
||||
+ System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
|
||||
+ } catch(UnsatisfiedLinkError e) {
|
||||
+ throw new RuntimeException(e);
|
||||
}
|
||||
catch(UnsatisfiedLinkError e) {
|
||||
loadNativeLibrary();
|
||||
- System.load(lib.getAbsolutePath());
|
||||
}
|
||||
|
||||
/**
|
||||
Only in jna-3.0.9.orig/src/com/sun/jna: Native.java~
|
||||
|
18
jna.spec
18
jna.spec
@ -1,6 +1,6 @@
|
||||
Name: jna
|
||||
Version: 3.0.4
|
||||
Release: 10.svn729%{?dist}
|
||||
Version: 3.0.9
|
||||
Release: 1%{?dist}
|
||||
Summary: Pure Java access to native libraries
|
||||
|
||||
Group: Development/Libraries
|
||||
@ -9,8 +9,9 @@ URL: https://jna.dev.java.net/
|
||||
# The source for this package was pulled from upstream's vcs. Use the
|
||||
# following commands to generate the tarball:
|
||||
# svn export https://jna.dev.java.net/svn/jna/tags/%{version}/jnalib/ --username guest jna-%{version}
|
||||
# rm dist/*
|
||||
# tar -cjf jna-%{version}.tar.bz2 jna-%{version}
|
||||
Source0: %{name}-%{version}.svn729.tar.bz2
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
# This patch is Fedora-specific for now until we get the huge
|
||||
# JNI library location mess sorted upstream
|
||||
Patch1: jna-3.0.2-loadlibrary.patch
|
||||
@ -23,6 +24,8 @@ Patch2: jna-tests-headless.patch
|
||||
Patch3: jna-3.0.4-nativemapped-array.patch
|
||||
# https://jna.dev.java.net/issues/show_bug.cgi?id=XXX
|
||||
Patch4: jna-stringarray-return.patch
|
||||
# https://jna.dev.java.net/issues/show_bug.cgi?id=XXX
|
||||
Patch5: jna-callback-exception.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
BuildRequires: java-devel >= 1.6 ant jpackage-utils ant-nodeps
|
||||
@ -51,11 +54,12 @@ This package contains the javadocs for %{name}.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}-svn729
|
||||
%setup -q -n %{name}-%{version}
|
||||
sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH1} | patch -p1
|
||||
%patch2 -p1 -b .tests-headless
|
||||
%patch3 -p1 -b .nativemapped-array
|
||||
%patch4 -p1 -b .stringarray-return
|
||||
#%patch5 -p1 -b .callback-exception
|
||||
|
||||
# all java binaries must be removed from the sources
|
||||
find . -name '*.jar' -exec rm -f '{}' \;
|
||||
@ -64,9 +68,6 @@ find . -name '*.class' -exec rm -f '{}' \;
|
||||
# remove internal copy of libffi
|
||||
rm -rf native/libffi
|
||||
|
||||
# remove random unused zips
|
||||
rm dist/{src,doc}.zip
|
||||
|
||||
# clean LICENSE.txt
|
||||
sed -i 's/\r//' LICENSE.txt
|
||||
chmod 0644 LICENSE.txt
|
||||
@ -112,6 +113,9 @@ rm -rf %{buildroot}
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Oct 31 2008 Colin Walters <walters@redhat.com> - 3.0.9-1
|
||||
- Rebase on upstream 3.0.9
|
||||
|
||||
* Tue Oct 14 2008 Colin Walters <walters@redhat.com> - 3.0.4-10.svn729
|
||||
- Add patch to support String[] returns
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user