From 2dd3cefc8d2ba5ccfd69503466af529101e7bc30 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Fri, 4 Apr 2008 22:10:17 +0000 Subject: [PATCH 1/6] Initialize branch EL-5 for jna --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..42f697a --- /dev/null +++ b/branch @@ -0,0 +1 @@ +EL-5 From 4b8cd86d43fc3cd5dcdd5479d88abddc6dce1867 Mon Sep 17 00:00:00 2001 From: Levente Farkas Date: Mon, 10 Nov 2008 15:39:52 +0000 Subject: [PATCH 2/6] initial import from the F-10 branch --- .cvsignore | 1 + import.log | 1 + jna-3.0.2-loadlibrary.patch | 11 ++ jna-3.0.4-nativemapped-array.patch | 73 +++++++++++++ jna-stringarray-return.patch | 26 +++++ jna-tests-headless.patch | 10 ++ jna.spec | 169 +++++++++++++++++++++++++++++ sources | 1 + 8 files changed, 292 insertions(+) create mode 100644 import.log create mode 100644 jna-3.0.2-loadlibrary.patch create mode 100644 jna-3.0.4-nativemapped-array.patch create mode 100644 jna-stringarray-return.patch create mode 100644 jna-tests-headless.patch create mode 100644 jna.spec diff --git a/.cvsignore b/.cvsignore index e69de29..2194324 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +jna-3.0.4.svn729.tar.bz2 diff --git a/import.log b/import.log new file mode 100644 index 0000000..658db96 --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +jna-3_0_4-10_svn729_fc10:EL-5:jna-3.0.4-10.svn729.fc10.src.rpm:1226331400 diff --git a/jna-3.0.2-loadlibrary.patch b/jna-3.0.2-loadlibrary.patch new file mode 100644 index 0000000..d7db857 --- /dev/null +++ b/jna-3.0.2-loadlibrary.patch @@ -0,0 +1,11 @@ +--- 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 new file mode 100644 index 0000000..53d2e94 --- /dev/null +++ b/jna-3.0.4-nativemapped-array.patch @@ -0,0 +1,73 @@ +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-stringarray-return.patch b/jna-stringarray-return.patch new file mode 100644 index 0000000..c806e79 --- /dev/null +++ b/jna-stringarray-return.patch @@ -0,0 +1,26 @@ +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-tests-headless.patch b/jna-tests-headless.patch new file mode 100644 index 0000000..994170b --- /dev/null +++ b/jna-tests-headless.patch @@ -0,0 +1,10 @@ +--- 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 --git a/jna.spec b/jna.spec new file mode 100644 index 0000000..38ed5d8 --- /dev/null +++ b/jna.spec @@ -0,0 +1,169 @@ +Name: jna +Version: 3.0.4 +Release: 10.svn729%{?dist} +Summary: Pure Java access to native libraries + +Group: Development/Libraries +License: LGPLv2+ +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} +# tar -cjf jna-%{version}.tar.bz2 jna-%{version} +Source0: %{name}-%{version}.svn729.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 +# 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 +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 + +%description +JNA provides Java programs easy access to native shared libraries +(DLLs on Windows) without writing anything but Java code. JNA's +design aims to provide native access in a natural way with a +minimum of effort. No boilerplate or generated code is required. +While some attention is paid to performance, correctness and ease +of use take priority. + + +%package javadoc +Summary: Javadocs for %{name} +Group: Documentation +Requires: %{name} = %{version}-%{release} + + +%description javadoc +This package contains the javadocs for %{name}. + + +%prep +%setup -q -n %{name}-%{version}-svn729 +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 '{}' \; +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 + + +%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 javadoc + + +%install +rm -rf %{buildroot} + +# jars +install -D -m 644 build*/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{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, +# we'll leave it unchanged. +install -d -m 755 %{buildroot}%{_libdir}/%{name} +install -m 755 build*/native/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/ + +# javadocs +install -p -d -m 755 %{buildroot}%{_javadocdir}/%{name}-%{version} +cp -a doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version} + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc LICENSE.txt +%{_libdir}/%{name} +%{_javadir}/*.jar + +%files javadoc +%defattr(-,root,root,-) +%{_javadocdir}/%{name}-%{version} + + +%changelog +* Tue Oct 14 2008 Colin Walters - 3.0.4-10.svn729 +- Add patch to support String[] returns + +* Wed Oct 01 2008 Colin Walters - 3.0.4-9.svn729 +- Add new patch to support NativeMapped[] which I want + +* Wed Oct 01 2008 Colin Walters - 3.0.4-8.svn729 +- Update to svn r729 +- drop upstreamed typemapper patch + +* Tue Sep 18 2008 Colin Walters - 3.0.4-7.svn700 +- Add patch to make typemapper always accessible +- Add patch to skip cracktastic X11 test bits which currently fail + +* Tue Sep 09 2008 Colin Walters - 3.0.4-5.svn700 +- Update to upstream SVN r700; drop all now upstreamed patches + +* Sat Sep 06 2008 Colin Walters - 3.0.4-3.svn630 +- A few more patches for JGIR + +* Thu Sep 04 2008 Colin Walters - 3.0.4-2.svn630 +- Add two (sent upstream) patches that I need for JGIR + +* Thu Jul 31 2008 Colin Walters - 3.0.4-1.svn630 +- New upstream version, drop upstreamed patch parts +- New patch jna-3.0.4-nomixedjar.patch which ensures that we don't + include the .so in the .jar + +* Fri Apr 04 2008 Colin Walters - 3.0.2-7 +- Add patch to use JPackage-compatible JNI library path +- Do build debuginfo package +- Refactor build patch greatly so it's hopefully upstreamable +- Install .so directly to JNI directory, rather than inside jar +- Clean up Requires/BuildRequires (thanks Mamoru Tasaka) + +* Sun Mar 30 2008 Conrad Meyer - 3.0.2-6 +- -javadocs should be -javadoc. +- %%files section cleaned a bit. + +* Mon Mar 17 2008 Conrad Meyer - 3.0.2-5 +- -javadocs package should be in group "Documentation". + +* Mon Mar 17 2008 Conrad Meyer - 3.0.2-4 +- License should be LGPLv2+, not GPLv2+. +- Several minor fixes. +- Fix Requires in javadoc package. + +* Sun Mar 16 2008 Conrad Meyer - 3.0.2-3 +- Don't use internal libffi. + +* Thu Mar 6 2008 Conrad Meyer - 3.0.2-2 +- Don't pull in jars from the web. + +* Mon Mar 3 2008 Conrad Meyer - 3.0.2-1 +- Initial package. diff --git a/sources b/sources index e69de29..5bf10cd 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +789cf82e63d0cbc11198d3b2015d3490 jna-3.0.4.svn729.tar.bz2 From 5ab5507b390582c260129625081cd871b77ed2e9 Mon Sep 17 00:00:00 2001 From: Levente Farkas Date: Mon, 23 Nov 2009 18:36:40 +0000 Subject: [PATCH 3/6] update to 3.2.4 --- .cvsignore | 2 +- import.log | 1 + jna-3.0.2-loadlibrary.patch | 11 -- jna-3.0.4-nativemapped-array.patch | 73 --------- jna-3.2.4-loadlibrary.patch | 142 ++++++++++++++++++ ...ss.patch => jna-3.2.4-tests-headless.patch | 7 +- jna-stringarray-return.patch | 26 ---- jna.spec | 73 ++++++--- sources | 2 +- 9 files changed, 204 insertions(+), 133 deletions(-) delete mode 100644 jna-3.0.2-loadlibrary.patch delete mode 100644 jna-3.0.4-nativemapped-array.patch create mode 100644 jna-3.2.4-loadlibrary.patch rename jna-tests-headless.patch => jna-3.2.4-tests-headless.patch (63%) delete mode 100644 jna-stringarray-return.patch 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 From c1a5da9d98a4104fedb8b11a20ee150660e8ad11 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 26 Nov 2009 01:17:19 +0000 Subject: [PATCH 4/6] Fix typo that causes a failure to update the common directory. (releng #2781) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 796341d..243fccc 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Makefile for source rpm: jna -# $Id$ +# $Id: Makefile,v 1.1 2008/04/04 22:09:38 kevin Exp $ NAME := jna SPECFILE = $(firstword $(wildcard *.spec)) define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done +for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done endef MAKEFILE_COMMON := $(shell $(find-makefile-common)) From 0ea7e9fc1b85f17ce61c67d6b13c3b53786c5d1c Mon Sep 17 00:00:00 2001 From: Levente Farkas Date: Thu, 17 Dec 2009 08:55:44 +0000 Subject: [PATCH 5/6] fix ExclusiveArch --- jna.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/jna.spec b/jna.spec index 5643dd2..e470ec6 100644 --- a/jna.spec +++ b/jna.spec @@ -1,6 +1,6 @@ Name: jna Version: 3.2.4 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Pure Java access to native libraries Group: Development/Libraries @@ -28,7 +28,7 @@ BuildRequires: libX11-devel libXt-devel libffi-devel # inside jars. Requires: java >= 1:1.6.0 jpackage-utils libffi # for ExcludeArch see bug: 468831 -%if 0%{?rhel} < 6 +%if 0%{?rhel} < 6 && 0%{?fedora} < 10 ExcludeArch: ppc ppc64 %endif @@ -128,6 +128,12 @@ rm -rf %{buildroot} %changelog +* Thu Dec 17 2009 Levente Farkas - 3.2.4-3 +- add proper ExclusiveArch + +* Thu Dec 17 2009 Alexander Kurtakov 3.2.4-2 +- Comment rhel ExclusiveArchs - not correct applies on Fedora. + * Sat Nov 14 2009 Levente Farkas - 3.2.4-1 - Rebase on upstream 3.2.4 From 503e574fd8713436ccff76f6d5cf53019b785bc4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 28 Jul 2010 18:50:31 +0000 Subject: [PATCH 6/6] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - import.log | 2 -- 4 files changed, 24 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch delete mode 100644 import.log diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 243fccc..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: jna -# $Id: Makefile,v 1.1 2008/04/04 22:09:38 kevin Exp $ -NAME := jna -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attept a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index 42f697a..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -EL-5 diff --git a/import.log b/import.log deleted file mode 100644 index 6f119b2..0000000 --- a/import.log +++ /dev/null @@ -1,2 +0,0 @@ -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