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 @@ diff --git a/jna-stringarray-return.patch b/jna-stringarray-return.patch deleted file mode 100644 index c806e79..0000000 --- a/jna-stringarray-return.patch +++ /dev/null @@ -1,26 +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-10-14 19:47:44.000000000 -0400 -+++ jna-3.0.4-svn729.orig/src/com/sun/jna/Function.java 2008-10-14 19:48:00.000000000 -0400 -@@ -314,6 +314,20 @@ - String s = invokeString(callingConvention, args, true); - result = s != null ? new WString(s) : null; - } -+ else if (returnType == String[].class) { -+ Pointer tmp = invokePointer(callingConvention, args); -+ if (tmp != null) -+ result = tmp.getStringArray(0); -+ else -+ result = null; -+ } -+ else if (returnType == WString[].class) { -+ Pointer tmp = invokePointer(callingConvention, args); -+ if (tmp != null) -+ result = tmp.getStringArray(0, true); -+ else -+ result = null; -+ } - else if (Pointer.class.isAssignableFrom(returnType)) { - result = invokePointer(callingConvention, args); - } -Only in jna-3.0.4-svn729.orig/src/com/sun/jna: Function.java~ -Only in jna-3.0.4-svn729/src/com/sun/jna: Function.java.nativemapped-array diff --git a/jna.spec b/jna.spec index 38ed5d8..5643dd2 100644 --- a/jna.spec +++ b/jna.spec @@ -1,6 +1,6 @@ Name: jna -Version: 3.0.4 -Release: 10.svn729%{?dist} +Version: 3.2.4 +Release: 1%{?dist} Summary: Pure Java access to native libraries Group: Development/Libraries @@ -9,27 +9,29 @@ 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 jna-%{version}/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 +Patch1: jna-3.2.4-loadlibrary.patch # The X11 tests currently segfault; overall I think the X11 JNA stuff is just a # Really Bad Idea, for relying on AWT internals, using the X11 API at all, # and using a complex API like X11 through JNA just increases the potential # for problems. -Patch2: jna-tests-headless.patch -# https://jna.dev.java.net/issues/show_bug.cgi?id=90 -Patch3: jna-3.0.4-nativemapped-array.patch -# https://jna.dev.java.net/issues/show_bug.cgi?id=XXX -Patch4: jna-stringarray-return.patch +Patch2: jna-3.2.4-tests-headless.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: java-devel >= 1.6 ant jpackage-utils ant-nodeps BuildRequires: libX11-devel libXt-devel libffi-devel # We manually require libffi because find-requires doesn't work # inside jars. -Requires: java >= 1:1.6.0 jpackage-utils +Requires: java >= 1:1.6.0 jpackage-utils libffi +# for ExcludeArch see bug: 468831 +%if 0%{?rhel} < 6 +ExcludeArch: ppc ppc64 +%endif + %description JNA provides Java programs easy access to native shared libraries @@ -50,12 +52,20 @@ Requires: %{name} = %{version}-%{release} This package contains the javadocs for %{name}. +%package examples +Summary: Examples for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} + + +%description examples +This package contains the examples 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 # all java binaries must be removed from the sources find . -name '*.jar' -exec rm -f '{}' \; @@ -64,9 +74,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 @@ -75,7 +82,7 @@ chmod 0644 LICENSE.txt %build # We pass -Ddynlink.native which comes from our patch because # upstream doesn't want to default to dynamic linking. -ant jar -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true +ant -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true jar examples ant javadoc @@ -84,6 +91,7 @@ rm -rf %{buildroot} # jars install -D -m 644 build*/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar +install -D -m 644 build*/examples.jar %{buildroot}%{_javadir}/%{name}-examples-%{version}.jar (cd %{buildroot}%{_javadir}/; for jar in `ls *-%{version}.jar`; do ln -s $jar `echo $jar | sed -e 's/-%{version}//'`; done) # NOTE: JNA has highly custom code to look for native jars in this # directory. Since this roughly matches the jpackage guidelines, @@ -104,14 +112,43 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %doc LICENSE.txt %{_libdir}/%{name} -%{_javadir}/*.jar +%{_javadir}/%{name}.jar +%{_javadir}/%{name}-%{version}.jar + %files javadoc %defattr(-,root,root,-) %{_javadocdir}/%{name}-%{version} +%files examples +%defattr(-,root,root,-) +%{_javadir}/%{name}-examples.jar +%{_javadir}/%{name}-examples-%{version}.jar + + %changelog +* Sat Nov 14 2009 Levente Farkas - 3.2.4-1 +- Rebase on upstream 3.2.4 + +* Thu Oct 29 2009 Lubomir Rintel - 3.0.9-6 +- Add examples subpackage + +* Fri Jul 24 2009 Fedora Release Engineering - 3.0.9-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 3.0.9-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Tue Dec 30 2008 Colin Walters - 3.0.9-3 +- Add patch to allow opening current process + +* Sun Nov 30 2008 Colin Walters - 3.0.9-2 +- Fix library mapping, remove upstreamed patches + +* Fri Oct 31 2008 Colin Walters - 3.0.9-1 +- Rebase on upstream 3.0.9 + * Tue Oct 14 2008 Colin Walters - 3.0.4-10.svn729 - Add patch to support String[] returns diff --git a/sources b/sources index 5bf10cd..0a14343 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -789cf82e63d0cbc11198d3b2015d3490 jna-3.0.4.svn729.tar.bz2 +3e53de2ba6c9e3920ec681224114209e jna-3.2.4.tar.bz2