update to 3.2.4
This commit is contained in:
		
							parent
							
								
									efd8563192
								
							
						
					
					
						commit
						b0814dd143
					
				| @ -1 +1 @@ | ||||
| jna-3.0.9.tar.bz2 | ||||
| jna-3.2.4.tar.bz2 | ||||
|  | ||||
							
								
								
									
										1
									
								
								import.log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								import.log
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| jna-3_2_4-1_el5:F-12:jna-3.2.4-1.el5.src.rpm:1259006256 | ||||
| @ -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~ | ||||
| @ -1,14 +0,0 @@ | ||||
| --- jna-3.0.9/src/com/sun/jna/NativeLibrary.java	2008-10-28 20:30:54.000000000 -0400
 | ||||
| +++ jna-3.0.9.orig/src/com/sun/jna/NativeLibrary.java	2008-11-15 18:29:52.000000000 -0500
 | ||||
| @@ -374,8 +374,9 @@
 | ||||
|              return name; | ||||
|          } | ||||
|          else if (Platform.isLinux()) { | ||||
| -            if (isVersionedName(libName)) {
 | ||||
| -                // A specific version was requested - use as is for search
 | ||||
| +            if (isVersionedName(libName) || libName.endsWith(".so")) {
 | ||||
| +                // An already mapped name was specified - use as is
 | ||||
| +                // for search
 | ||||
|                  return libName; | ||||
|              } | ||||
|          } | ||||
| @ -1,98 +0,0 @@ | ||||
| diff -ur jna-3.0.9/native/dispatch.c jna-3.0.9.process/native/dispatch.c
 | ||||
| --- jna-3.0.9/native/dispatch.c	2008-09-22 11:55:59.000000000 -0400
 | ||||
| +++ jna-3.0.9.process/native/dispatch.c	2008-12-30 17:03:22.000000000 -0500
 | ||||
| @@ -641,14 +641,20 @@
 | ||||
|      void *handle = NULL; | ||||
|      LIBNAMETYPE libname = NULL; | ||||
|   | ||||
| -    if ((libname = LIBNAME2CSTR(env, lib)) != NULL) {
 | ||||
| -      handle = (void *)LOAD_LIBRARY(libname);
 | ||||
| -      if (!handle) {
 | ||||
| -        char buf[1024];
 | ||||
| -        throwByName(env, EUnsatisfiedLink, LOAD_ERROR(buf, sizeof(buf)));
 | ||||
| +    /* dlopen on Unix allows NULL to mean "current process" */
 | ||||
| +    if (lib != NULL) {
 | ||||
| +      if ((libname = LIBNAME2CSTR(env, lib)) == NULL) {
 | ||||
| +        return (jlong)A2L(NULL);
 | ||||
|        } | ||||
| -      free(libname);
 | ||||
|      } | ||||
| +
 | ||||
| +    handle = (void *)LOAD_LIBRARY(libname);
 | ||||
| +    if (!handle) {
 | ||||
| +      char buf[1024];
 | ||||
| +      throwByName(env, EUnsatisfiedLink, LOAD_ERROR(buf, sizeof(buf)));
 | ||||
| +    }
 | ||||
| +    if (libname != NULL)
 | ||||
| +      free(libname);
 | ||||
|      return (jlong)A2L(handle); | ||||
|  } | ||||
|   | ||||
| diff -ur jna-3.0.9/src/com/sun/jna/NativeLibrary.java jna-3.0.9.process/src/com/sun/jna/NativeLibrary.java
 | ||||
| --- jna-3.0.9/src/com/sun/jna/NativeLibrary.java	2008-12-30 17:19:15.000000000 -0500
 | ||||
| +++ jna-3.0.9.process/src/com/sun/jna/NativeLibrary.java	2008-12-30 17:17:45.000000000 -0500
 | ||||
| @@ -45,6 +45,7 @@
 | ||||
|      private final String libraryPath; | ||||
|      private final Map functions = new HashMap(); | ||||
|   | ||||
| +    private static WeakReference currentProcess;
 | ||||
|      private static final Map libraries = new HashMap(); | ||||
|      private static final Map searchPaths = Collections.synchronizedMap(new HashMap()); | ||||
|      private static final List librarySearchPath = new LinkedList(); | ||||
| @@ -196,6 +197,27 @@
 | ||||
|      } | ||||
|   | ||||
|      /** | ||||
| +     * Returns an instance of NativeLibrary which refers to the current process.
 | ||||
| +     * This is useful for accessing functions which were already mapped by some
 | ||||
| +     * other mechanism, without having to reference or even know the exact
 | ||||
| +     * name of the native library.
 | ||||
| +     */
 | ||||
| +    public static synchronized final NativeLibrary getProcess() {
 | ||||
| +        NativeLibrary library = null;
 | ||||
| +        if (currentProcess != null) {
 | ||||
| +            library = (NativeLibrary) currentProcess.get();
 | ||||
| +        }
 | ||||
| +
 | ||||
| +        if (library == null) {
 | ||||
| +           long handle = open(null);
 | ||||
| +           library = new NativeLibrary("<process>", null, handle);
 | ||||
| +           currentProcess = new WeakReference(library);
 | ||||
| +        }
 | ||||
| +
 | ||||
| +        return library;
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    /**
 | ||||
|       * Add a path to search for the specified library, ahead of any system paths | ||||
|       * | ||||
|       * @param libraryName The name of the library to use the path for | ||||
| @@ -287,9 +309,13 @@
 | ||||
|      public String getName() { | ||||
|          return libraryName; | ||||
|      } | ||||
| -    /** Returns the file on disk corresponding to this NativeLibrary instacne.
 | ||||
| +    /** 
 | ||||
| +     * Returns the file on disk corresponding to this NativeLibrary instance.
 | ||||
| +     * If this NativeLibrary represents the current process, this function will return null. 
 | ||||
|       */ | ||||
|      public File getFile() { | ||||
| +        if (libraryPath == null)
 | ||||
| +            return null;
 | ||||
|          return new File(libraryPath); | ||||
|      } | ||||
|      /** Close the library when it is no longer referenced. */ | ||||
| @@ -300,8 +326,11 @@
 | ||||
|      public void dispose() { | ||||
|          synchronized(libraries) { | ||||
|              libraries.remove(getName()); | ||||
| -            libraries.remove(getFile().getAbsolutePath());
 | ||||
| -            libraries.remove(getFile().getName());
 | ||||
| +            File path = getFile();
 | ||||
| +            if (path != null) {
 | ||||
| +                libraries.remove(path.getAbsolutePath());
 | ||||
| +                libraries.remove(path.getName());
 | ||||
| +            }
 | ||||
|          } | ||||
|          synchronized(this) { | ||||
|              if (handle != 0) { | ||||
| @ -1,7 +1,7 @@ | ||||
| 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 @@
 | ||||
| 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 {
 | ||||
|      } | ||||
|   | ||||
|      /** | ||||
| @ -28,6 +28,7 @@ diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Na | ||||
| -                String path = new File(new File(dirs[i]), System.mapLibraryName(libName)).getAbsolutePath();
 | ||||
| -                try {
 | ||||
| -                    System.load(path);
 | ||||
| -                    nativeLibraryPath = path;
 | ||||
| -                    return;
 | ||||
| -                } catch (UnsatisfiedLinkError ex) {
 | ||||
| -                }
 | ||||
| @ -41,7 +42,9 @@ diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Na | ||||
| -                        ext = "dylib";
 | ||||
| -                    }
 | ||||
| -                    try {
 | ||||
| -                        System.load(path.substring(0, path.lastIndexOf(orig)) + ext);
 | ||||
| -                        path = path.substring(0, path.lastIndexOf(orig)) + ext;
 | ||||
| -                        System.load(path);
 | ||||
| -                        nativeLibraryPath = path;
 | ||||
| -                        return;
 | ||||
| -                    } catch (UnsatisfiedLinkError ex) {
 | ||||
| -                    }
 | ||||
| @ -50,22 +53,30 @@ diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Na | ||||
| -        }
 | ||||
|          try { | ||||
| -            System.loadLibrary(libName);
 | ||||
| -        }
 | ||||
| -        catch(UnsatisfiedLinkError e) {
 | ||||
| -            nativeLibraryPath = libName;
 | ||||
| +            System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
 | ||||
| +            nativeLibraryPath = "@JNIPATH@/" + System.mapLibraryName("jnidispatch");
 | ||||
|          } | ||||
|          catch(UnsatisfiedLinkError e) { | ||||
| -            loadNativeLibraryFromJar();
 | ||||
| -        }
 | ||||
| -    }
 | ||||
| -
 | ||||
| -    /**
 | ||||
| -     * Extracts and loads the JNA stub library from jna.jar
 | ||||
| -     * 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 resourceName = getNativeLibraryResourcePath() + "/" + libname;
 | ||||
| -        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")) {
 | ||||
| -        // 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);
 | ||||
| -        }
 | ||||
| @ -76,8 +87,15 @@ diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Na | ||||
| -    
 | ||||
| -        File lib = null;
 | ||||
| -        if (url.getProtocol().toLowerCase().equals("file")) {
 | ||||
| -            // NOTE: use older API for 1.3 compatibility
 | ||||
| -            lib = new File(URLDecoder.decode(url.getPath()));
 | ||||
| -            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);
 | ||||
| @ -88,10 +106,14 @@ diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Na | ||||
| -            FileOutputStream fos = null;
 | ||||
| -            try {
 | ||||
| -                // Suffix is required on windows, or library fails to load
 | ||||
| -                // Let Java pick the suffix
 | ||||
| -                lib = File.createTempFile("jna", null);
 | ||||
| -                // Let Java pick the suffix, except on windows, to avoid
 | ||||
| -                // problems with Web Start.
 | ||||
| -                lib = File.createTempFile("jna", Platform.isWindows()?".dll":null);
 | ||||
| -                lib.deleteOnExit();
 | ||||
| -                if (Platform.deleteNativeLibraryAfterVMExit()) {
 | ||||
| -                ClassLoader cl = Native.class.getClassLoader();
 | ||||
| -                if (Platform.deleteNativeLibraryAfterVMExit()
 | ||||
| -                    && (cl == null
 | ||||
| -                        || cl.equals(ClassLoader.getSystemClassLoader()))) {
 | ||||
| -                    Runtime.getRuntime().addShutdownHook(new DeleteNativeLibrary(lib));
 | ||||
| -                }
 | ||||
| -                fos = new FileOutputStream(lib);
 | ||||
| @ -110,12 +132,11 @@ diff -ur jna-3.0.9/src/com/sun/jna/Native.java jna-3.0.9.orig/src/com/sun/jna/Na | ||||
| -                    try { fos.close(); } catch(IOException e) { }
 | ||||
| -                }
 | ||||
| -            }
 | ||||
| +            System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
 | ||||
| +        } catch(UnsatisfiedLinkError e) {
 | ||||
| +	    throw new RuntimeException(e);
 | ||||
| -            unpacked = true;
 | ||||
| +            throw new RuntimeException(e);
 | ||||
|          } | ||||
| -        System.load(lib.getAbsolutePath());
 | ||||
| -        nativeLibraryPath = lib.getAbsolutePath();
 | ||||
|      } | ||||
|   | ||||
|      /** | ||||
| Only in jna-3.0.9.orig/src/com/sun/jna: Native.java~ | ||||
| @ -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 @@
 | ||||
|        <jvmarg value="-Djna.protected=true"/> | ||||
|        <jvmarg value="-Djna.builddir=${build}"/> | ||||
|        <jvmarg value="${vmopt.arch}"/> | ||||
| @ -1,57 +0,0 @@ | ||||
| diff -ur jna-3.0.4-svn729/native/callback.c jna-3.0.4-svn729.orig/native/callback.c
 | ||||
| --- jna-3.0.4-svn729/native/callback.c	2008-09-07 13:32:02.000000000 -0400
 | ||||
| +++ jna-3.0.4-svn729.orig/native/callback.c	2008-10-21 00:05:24.000000000 -0400
 | ||||
| @@ -119,6 +119,42 @@
 | ||||
|  } | ||||
|   | ||||
|  static void | ||||
| +call_thread_uncaught(JNIEnv *env)
 | ||||
| +{
 | ||||
| +  jthrowable e;
 | ||||
| +  jclass threadCls;
 | ||||
| +  jclass handlerCls;
 | ||||
| +  jmethodID mid;
 | ||||
| +  jobject threadObj;
 | ||||
| +  jobject handler;
 | ||||
| +
 | ||||
| +  /* Get the exception */
 | ||||
| +  e = (*env)->ExceptionOccurred(env);
 | ||||
| +
 | ||||
| +  /* Now clear it from JNI's point of view, holding our ref to it */
 | ||||
| +  (*env)->ExceptionClear(env);
 | ||||
| +
 | ||||
| +  threadCls = (*env)->FindClass(env, "java/lang/Thread");
 | ||||
| +  if (threadCls == NULL)
 | ||||
| +    return;
 | ||||
| +
 | ||||
| +  mid = (*env)->GetMethodID(env, threadCls, "getCurrentThread",
 | ||||
| +				   "()Ljava/lang/Thread;");
 | ||||
| +  threadObj = (*env)->CallStaticObjectMethod(env, threadCls, mid);
 | ||||
| +  mid = (*env)->GetMethodID(env, threadCls, "getUncaughtExceptionHandler",
 | ||||
| +			 "()Ljava/lang/Thread$UncaughtExceptionHandler;");
 | ||||
| +  handler = (*env)->CallObjectMethod(env, threadObj, mid);
 | ||||
| +  if (handler == NULL)
 | ||||
| +    return;
 | ||||
| +
 | ||||
| +  handlerCls = (*env)->GetObjectClass(env, handler);
 | ||||
| +  mid = (*env)->GetMethodID(env, handlerCls, "uncaughtException",
 | ||||
| +			 "(Ljava/lang/Thread;Ljava/lang/Throwable;)V");
 | ||||
| +
 | ||||
| +  (*env)->CallObjectMethod(env, handler, mid, threadObj, e);
 | ||||
| +}
 | ||||
| +
 | ||||
| +static void
 | ||||
|  callback_invoke(JNIEnv* env, callback *cb, ffi_cif* cif, void *resp, void **cbargs) { | ||||
|    jobject self; | ||||
|   | ||||
| @@ -140,7 +176,8 @@
 | ||||
|      } | ||||
|      result = (*env)->CallObjectMethod(env, self, cb->methodID, array); | ||||
|      if ((*env)->ExceptionCheck(env)) { | ||||
| -      fprintf(stderr, "JNA: uncaught exception in callback, continuing\n");
 | ||||
| +      /* Toss it over to the current thread's uncaught handler */
 | ||||
| +      call_thread_uncaught(env);
 | ||||
|        memset(resp, 0, cif->rtype->size); | ||||
|      } | ||||
|      else { | ||||
| Only in jna-3.0.4-svn729.orig/native: callback.c~ | ||||
| @ -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 | ||||
							
								
								
									
										59
									
								
								jna.spec
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								jna.spec
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| Name:           jna | ||||
| Version:        3.0.9 | ||||
| Release:        5%{?dist} | ||||
| Version:        3.2.4 | ||||
| Release:        1%{?dist} | ||||
| Summary:        Pure Java access to native libraries | ||||
| 
 | ||||
| Group:          Development/Libraries | ||||
| @ -9,33 +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 dist/* | ||||
| #   rm jna-%{version}/dist/* | ||||
| #   tar -cjf jna-%{version}.tar.bz2 jna-%{version} | ||||
| 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 | ||||
| # Not yet sent upstream - haven't decided whether it's a good idea yet, | ||||
| # but keeping around here for now. | ||||
| Patch5:         jna-callback-exception.patch | ||||
| # https://jna.dev.java.net/issues/show_bug.cgi?id=95 | ||||
| Patch6:		jna-3.0.9-linux-nomaplibrary.patch | ||||
| # https://jna.dev.java.net/issues/show_bug.cgi?id=98 | ||||
| Patch7:         jna-3.0.9-processopen.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 | ||||
| @ -56,14 +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} | ||||
| sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH1} | patch -p1 | ||||
| %patch2 -p1 -b .tests-headless | ||||
| %patch3 -p1 -b .nativemapped-array | ||||
| #%patch5 -p1 -b .callback-exception | ||||
| %patch6 -p1 -b .linux-nomaplibrary | ||||
| %patch7 -p1 -b .processopen | ||||
| 
 | ||||
| # all java binaries must be removed from the sources | ||||
| find . -name '*.jar' -exec rm -f '{}' \; | ||||
| @ -80,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 | ||||
| 
 | ||||
| 
 | ||||
| @ -89,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, | ||||
| @ -109,14 +112,28 @@ 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 <lfarkas@lfarkas.org> - 3.2.4-1 | ||||
| - Rebase on upstream 3.2.4 | ||||
| 
 | ||||
| * Thu Oct 29 2009 Lubomir Rintel <lkundrak@v3.sk> - 3.0.9-6 | ||||
| - Add examples subpackage | ||||
| 
 | ||||
| * Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.9-5 | ||||
| - Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user