rpms/jna/F-9 jna-3.0.4-nativemapped-array.patch, NONE, 1.1 jna-tests-headless.patch, NONE, 1.1 jna.spec, 1.2, 1.3 sources, 1.2, 1.3

Colin Walters walters at fedoraproject.org
Thu Oct 2 14:23:19 UTC 2008


Author: walters

Update of /cvs/pkgs/rpms/jna/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20674

Modified Files:
	jna.spec sources 
Added Files:
	jna-3.0.4-nativemapped-array.patch jna-tests-headless.patch 
Log Message:
* Wed Oct 01 2008 Colin Walters <walters at redhat.com> - 3.0.4-9.svn729
- Add new patch to support NativeMapped[] which I want


jna-3.0.4-nativemapped-array.patch:

--- NEW FILE jna-3.0.4-nativemapped-array.patch ---
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~

jna-tests-headless.patch:

--- NEW FILE jna-tests-headless.patch ---
--- 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 @@
       <jvmarg value="-Djna.protected=true"/>
       <jvmarg value="-Djna.builddir=${build}"/>
       <jvmarg value="${vmopt.arch}"/>
+      <jvmarg value="-Djava.awt.headless=true"/>
       <classpath><path refid="test.runpath"/></classpath>
       <formatter type="xml"/>
       <batchtest todir="${results.junit}">


Index: jna.spec
===================================================================
RCS file: /cvs/pkgs/rpms/jna/F-9/jna.spec,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jna.spec	10 Jun 2008 19:55:25 -0000	1.2
+++ jna.spec	2 Oct 2008 14:22:49 -0000	1.3
@@ -1,6 +1,6 @@
 Name:           jna
-Version:        3.0.2
-Release:        8%{?dist}
+Version:        3.0.4
+Release:        9.svn729%{?dist}
 Summary:        Pure Java access to native libraries
 
 Group:          Development/Libraries
@@ -10,12 +10,17 @@
 # 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}.tar.bz2
-# https://jna.dev.java.net/issues/show_bug.cgi?id=60
-Patch0:         jna-3.0.2-dynlink-and-cflags.patch
+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
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  java-devel >= 1.6 ant jpackage-utils ant-nodeps
@@ -44,9 +49,10 @@
 
 
 %prep
-%setup -q -n %{name}-%{version}
-%patch0 -p1
+%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
 
 # all java binaries must be removed from the sources
 find . -name '*.jar' -exec rm -f '{}' \;
@@ -74,13 +80,13 @@
 rm -rf %{buildroot}
 
 # jars
-install -D -m 644 build/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
+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}/
+install -m 755 build*/native/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/
 
 # javadocs
 install -p -d -m 755 %{buildroot}%{_javadocdir}/%{name}-%{version}
@@ -103,8 +109,30 @@
 
 
 %changelog
-* Tue Jun 10 2008 Colin Walters <walters at redhat.com> - 3.0.2-8
-- Bump rev for upgrade path
+* Wed Oct 01 2008 Colin Walters <walters at redhat.com> - 3.0.4-9.svn729
+- Add new patch to support NativeMapped[] which I want
+
+* Wed Oct 01 2008 Colin Walters <walters at redhat.com> - 3.0.4-8.svn729
+- Update to svn r729
+- drop upstreamed typemapper patch
+
+* Tue Sep 18 2008 Colin Walters <walters at redhat.com> - 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 <walters at redhat.com> - 3.0.4-5.svn700
+- Update to upstream SVN r700; drop all now upstreamed patches
+
+* Sat Sep 06 2008 Colin Walters <walters at redhat.com> - 3.0.4-3.svn630
+- A few more patches for JGIR
+
+* Thu Sep 04 2008 Colin Walters <walters at redhat.com> - 3.0.4-2.svn630
+- Add two (sent upstream) patches that I need for JGIR
+
+* Thu Jul 31 2008 Colin Walters <walters at redhat.com> - 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 <walters at redhat.com> - 3.0.2-7
 - Add patch to use JPackage-compatible JNI library path


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/jna/F-9/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sources	4 Apr 2008 23:46:58 -0000	1.2
+++ sources	2 Oct 2008 14:22:49 -0000	1.3
@@ -1 +1 @@
-4f177e179adfdb3c2289c6f36445809f  jna-3.0.2.tar.bz2
+789cf82e63d0cbc11198d3b2015d3490  jna-3.0.4.svn729.tar.bz2




More information about the scm-commits mailing list