diff --git a/.cvsignore b/.cvsignore index 2194324..5bc5a3e 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -jna-3.0.4.svn729.tar.bz2 +jna-3.2.4.tar.bz2 diff --git a/import.log b/import.log index 658db96..6f119b2 100644 --- a/import.log +++ b/import.log @@ -1 +1,2 @@ jna-3_0_4-10_svn729_fc10:EL-5:jna-3.0.4-10.svn729.fc10.src.rpm:1226331400 +jna-3_2_4-1_el5:EL-5:jna-3.2.4-1.el5.src.rpm:1259001372 diff --git a/jna-3.0.2-loadlibrary.patch b/jna-3.0.2-loadlibrary.patch deleted file mode 100644 index d7db857..0000000 --- a/jna-3.0.2-loadlibrary.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- 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 { - try { -- System.loadLibrary("jnidispatch"); -+ System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch")); - } - catch(UnsatisfiedLinkError e) { - loadNativeLibrary(); diff --git a/jna-3.0.4-nativemapped-array.patch b/jna-3.0.4-nativemapped-array.patch deleted file mode 100644 index 53d2e94..0000000 --- a/jna-3.0.4-nativemapped-array.patch +++ /dev/null @@ -1,73 +0,0 @@ -diff -ur jna-3.0.4-svn729/src/com/sun/jna/Function.java jna-3.0.4-svn729.orig/src/com/sun/jna/Function.java ---- jna-3.0.4-svn729/src/com/sun/jna/Function.java 2008-09-12 10:05:07.000000000 -0400 -+++ jna-3.0.4-svn729.orig/src/com/sun/jna/Function.java 2008-10-01 23:23:38.000000000 -0400 -@@ -12,6 +12,7 @@ - - import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; -+import java.lang.reflect.Array; - import java.util.Collections; - import java.util.HashMap; - import java.util.Map; -@@ -351,16 +352,41 @@ - } - return result; - } -+ -+ private Class primitiveFromBoxed(Class boxedClass) { -+ if (boxedClass.isPrimitive()) -+ return boxedClass; -+ if (boxedClass == Boolean.class) -+ return Boolean.TYPE; -+ if (boxedClass == Byte.class) -+ return Byte.TYPE; -+ if (boxedClass == Character.class) -+ return Character.TYPE; -+ if (boxedClass == Short.class) -+ return Short.TYPE; -+ if (boxedClass == Integer.class) -+ return Integer.TYPE; -+ if (boxedClass == Long.class) -+ return Long.TYPE; -+ if (boxedClass == Float.class) -+ return Float.TYPE; -+ if (boxedClass == Double.class) -+ return Double.TYPE; -+ return boxedClass; -+ } - - private Object convertArgument(Object[] args, int index, Method invokingMethod, TypeMapper mapper) { - Object arg = args[index]; - if (arg != null) { - Class type = arg.getClass(); - ToNativeConverter converter = null; -+ boolean isArray = false; - if (NativeMapped.class.isAssignableFrom(type)) { - converter = NativeMappedConverter.getInstance(type); -- } -- else if (mapper != null) { -+ } else if (NativeMapped[].class.isAssignableFrom(type)) { -+ isArray = true; -+ converter = NativeMappedConverter.getInstance(type.getComponentType()); -+ } else if (mapper != null) { - converter = mapper.getToNativeConverter(type); - } - if (converter != null) { -@@ -371,7 +397,15 @@ - else { - context = new FunctionParameterContext(this, args, index); - } -- arg = converter.toNative(arg, context); -+ if (isArray) { -+ NativeMapped[] nativeArg = (NativeMapped[]) arg; -+ /* Reassign arg here to a new array */ -+ arg = Array.newInstance(primitiveFromBoxed(converter.nativeType()), nativeArg.length); -+ for (int i = 0; i < nativeArg.length; i++) -+ Array.set(arg, i, converter.toNative(nativeArg[i], context)); -+ } else { -+ arg = converter.toNative(arg, context); -+ } - } - } - if (arg == null || isPrimitiveArray(arg.getClass())) { -Only in jna-3.0.4-svn729.orig/src/com/sun/jna: Function.java~ diff --git a/jna-3.2.4-loadlibrary.patch b/jna-3.2.4-loadlibrary.patch new file mode 100644 index 0000000..47238b1 --- /dev/null +++ b/jna-3.2.4-loadlibrary.patch @@ -0,0 +1,142 @@ +diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java +--- ./src/com/sun/jna/Native.java.loadlib 2009-11-09 10:23:05.000000000 +0100 ++++ ./src/com/sun/jna/Native.java 2009-11-09 10:30:41.000000000 +0100 +@@ -630,131 +630,19 @@ public final class Native { + } + + /** +- * 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. +- *
+- * 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. +- *
++ * 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); +- nativeLibraryPath = 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 { +- path = path.substring(0, path.lastIndexOf(orig)) + ext; +- System.load(path); +- nativeLibraryPath = path; +- return; +- } catch (UnsatisfiedLinkError ex) { +- } +- } +- } +- } + try { +- System.loadLibrary(libName); +- nativeLibraryPath = libName; ++ System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch")); ++ nativeLibraryPath = "@JNIPATH@/" + System.mapLibraryName("jnidispatch"); + } + catch(UnsatisfiedLinkError e) { +- loadNativeLibraryFromJar(); +- } +- } +- +- /** +- * Attempts to load the native library resource from the filesystem, +- * extracting the JNA stub library from jna.jar if not already available. +- */ +- private static void loadNativeLibraryFromJar() { +- String libname = System.mapLibraryName("jnidispatch"); +- String arch = System.getProperty("os.arch"); +- String name = System.getProperty("os.name"); +- String resourceName = getNativeLibraryResourcePath(Platform.getOSType(), arch, name) + "/" + 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")) { +- try { +- lib = new File(url.toURI()); +- } +- catch(URISyntaxException e) { +- lib = new File(url.getPath()); +- } +- if (!lib.exists()) { +- throw new Error("File URL " + url + " could not be properly decoded"); +- } +- } +- 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, except on windows, to avoid +- // problems with Web Start. +- lib = File.createTempFile("jna", Platform.isWindows()?".dll":null); +- lib.deleteOnExit(); +- ClassLoader cl = Native.class.getClassLoader(); +- if (Platform.deleteNativeLibraryAfterVMExit() +- && (cl == null +- || cl.equals(ClassLoader.getSystemClassLoader()))) { +- 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) { } +- } +- } +- unpacked = true; ++ throw new RuntimeException(e); + } +- System.load(lib.getAbsolutePath()); +- nativeLibraryPath = lib.getAbsolutePath(); + } + + /** diff --git a/jna-tests-headless.patch b/jna-3.2.4-tests-headless.patch similarity index 63% rename from jna-tests-headless.patch rename to jna-3.2.4-tests-headless.patch index 994170b..82f94a9 100644 --- a/jna-tests-headless.patch +++ b/jna-3.2.4-tests-headless.patch @@ -1,6 +1,7 @@ ---- jna-3.0.4-svn700/build.xml 2008-10-01 12:57:20.000000000 -0400 -+++ jna-3.0.4-svn700.orig/build.xml 2008-10-01 12:57:16.000000000 -0400 -@@ -427,6 +427,7 @@ +diff -up ./build.xml.tests-headless ./build.xml +--- ./build.xml.tests-headless 2009-11-09 10:35:40.000000000 +0100 ++++ ./build.xml 2009-11-09 10:36:06.000000000 +0100 +@@ -466,6 +466,7 @@