[jna] updat to 3.5.2

Levente Farkas lfarkas at fedoraproject.org
Mon Apr 29 13:28:52 UTC 2013


commit fbf1c465256f11073bf307ab3e536f4bd2676dbb
Author: Levente Farkas <lfarkas at lfarkas.org>
Date:   Mon Apr 29 15:28:31 2013 +0200

    updat to 3.5.2

 jna-3.5.0-gcj-javadoc.patch                        |   42 ---
 jna-3.5.2-gcj-javadoc.patch                        |   13 +
 jna-3.5.0-junit.patch => jna-3.5.2-junit.patch     |   43 ++--
 ...oadlibrary.patch => jna-3.5.2-loadlibrary.patch |  267 ++++++++------------
 jna.spec                                           |    6 +-
 pom-jna.xml                                        |   71 ------
 pom-platform.xml                                   |   79 ------
 7 files changed, 138 insertions(+), 383 deletions(-)
---
diff --git a/jna-3.5.2-gcj-javadoc.patch b/jna-3.5.2-gcj-javadoc.patch
new file mode 100644
index 0000000..477ae64
--- /dev/null
+++ b/jna-3.5.2-gcj-javadoc.patch
@@ -0,0 +1,13 @@
+diff -up ./build.xml.gcj-javadoc ./build.xml
+--- ./build.xml.gcj-javadoc	2013-04-29 14:59:19.748042560 +0200
++++ ./build.xml	2013-04-29 15:00:00.678317442 +0200
+@@ -916,8 +916,6 @@ osname=macosx;processor=x86;processor=x8
+       <group title="Java Native Access" packages="com.sun.jna,com.sun.jna.ptr,com.sun.jna.types,com.sun.jna.win32"/>
+       <group title="Platform Utilities" packages="com.sun.jna.platform,com.sun.jna.platform.dnd"/>
+       <group title="Platform Specific" packages="com.sun.jna.platform.*"/>
+-
+-      <arg value="-notimestamp"/>
+     </javadoc>
+     <jar jarfile="${platform-javadoc-jar}">
+       <fileset dir="${javadoc}" />
+diff -up ./src/com/sun/jna/Function.java.gcj-javadoc ./src/com/sun/jna/Function.java
diff --git a/jna-3.5.0-junit.patch b/jna-3.5.2-junit.patch
similarity index 61%
rename from jna-3.5.0-junit.patch
rename to jna-3.5.2-junit.patch
index 0c40acf..babd7b8 100644
--- a/jna-3.5.0-junit.patch
+++ b/jna-3.5.2-junit.patch
@@ -1,61 +1,48 @@
 diff -up ./build.xml.junit ./build.xml
---- ./build.xml.junit	2012-10-26 11:42:01.192000696 +0200
-+++ ./build.xml	2012-10-26 11:44:42.912125221 +0200
-@@ -239,9 +239,6 @@
+--- ./build.xml.junit	2013-04-29 15:06:12.423790515 +0200
++++ ./build.xml	2013-04-29 15:07:09.442166774 +0200
+@@ -250,7 +250,7 @@
    <target name="-setup" depends="-dynamic-properties">
      <path id="compile-test.path">
        <path id="test.libs">
 -        <fileset dir="lib">
--          <include name="junit.jar"/>
--        </fileset>
-         <pathelement path="${classes}"/>
-       </path>
-     </path>
-@@ -429,7 +426,6 @@ osname=macos
++        <fileset dir="/usr/share/java">
+           <include name="junit.jar"/>
+         </fileset>
+         <fileset dir="lib/test"/>
+@@ -441,7 +441,7 @@ osname=macosx;processor=x86;processor=x8
      <subant target="jar" failonerror="true">
        <property name="file.reference.jna.build" location="${build}"/>
        <property name="file.reference.jna.jar" location="${build}/${jar}"/>
 -      <property name="libs.junit.classpath" location="lib/junit.jar"/>
++      <property name="libs.junit.classpath" location="/usr/share/java/junit.jar"/>
        <property name="javac.source" value="${platform.compatibility}"/>
        <property name="javac.target" value="${platform.compatibility}"/>
        <fileset dir="${contrib}" includes="platform/build.xml" />
-@@ -447,7 +443,6 @@ osname=macos
+@@ -456,7 +456,7 @@ osname=macosx;processor=x86;processor=x8
      <subant target="jar" failonerror="true">
        <property name="file.reference.jna.build" location="${build}"/>
        <property name="file.reference.jna.jar" location="${build}/${jar}"/>
 -      <property name="libs.junit.classpath" location="lib/junit.jar"/>
++      <property name="libs.junit.classpath" location="/usr/share/java/junit.jar"/>
        <fileset dir="${contrib}" includes="*/build.xml" excludes="platform/build.xml"/>
      </subant>
    </target>
-@@ -711,13 +706,12 @@ osname=macos
+@@ -734,7 +734,7 @@ osname=macosx;processor=x86;processor=x8
      <mkdir dir="${build}/jws"/>
      <copy todir="${build}/jws" file="${build}/${jar}"/>
      <copy todir="${build}/jws" file="${build}/${testjar}"/>
 -    <copy todir="${build}/jws" file="lib/junit.jar"/>
++    <copy todir="${build}/jws" file="/usr/share/java/junit.jar"/>
      <copy todir="${build}/jws" file="lib/clover.jar"/>
      <jar jarfile="${build}/jws/jnidispatch.jar">
        <fileset dir="${build.native}" includes="*jnidispatch.*"/>
-     </jar>
-     <signjar alias="jna" keystore="jna.keystore" storepass="jnadev" lazy="true">
--      <fileset dir="${build}/jws" includes="${jar},${testjar},junit.jar,jnidispatch.jar,clover.jar"/>
-+      <fileset dir="${build}/jws" includes="${jar},${testjar},jnidispatch.jar,clover.jar"/>
-     </signjar>
-   </target>
- 
-@@ -822,7 +816,6 @@ osname=macos
+@@ -845,7 +845,7 @@ osname=macosx;processor=x86;processor=x8
      <subant target="test" failonerror="true">
        <property name="file.reference.jna.build" location="${build}"/>
        <property name="file.reference.jna.jar" location="${build}/${jar}"/>
 -      <property name="libs.junit.classpath" location="lib/junit.jar"/>
++      <property name="libs.junit.classpath" location="/usr/share/java/junit.jar"/>
        <property name="javac.source" value="${test.compatibility}"/>
        <property name="javac.target" value="${test.compatibility}"/>
        <fileset dir="${contrib}" includes="platform/build.xml"/>
-@@ -930,7 +923,7 @@ osname=macos
-     <!-- Full sources required to build and test everything -->
-     <zip zipfile="${dist}/src-full.zip">
-       <zipfileset src="${dist}/src.zip"/>
--      <zipfileset dir="lib" includes="junit.jar,clover.jar" prefix="lib"/>
-+      <zipfileset dir="lib" includes="clover.jar" prefix="lib"/>
-       <zipfileset dir="." includes=".classpath,.project"/>
-       <zipfileset dir="${native}" includes="libffi,libffi/**/*" prefix="native"/>
-     </zip>
diff --git a/jna-3.5.0-loadlibrary.patch b/jna-3.5.2-loadlibrary.patch
similarity index 52%
rename from jna-3.5.0-loadlibrary.patch
rename to jna-3.5.2-loadlibrary.patch
index 6c75bb3..b5feb18 100644
--- a/jna-3.5.0-loadlibrary.patch
+++ b/jna-3.5.2-loadlibrary.patch
@@ -1,161 +1,108 @@
 diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
---- ./src/com/sun/jna/Native.java.loadlib	2012-10-19 03:53:11.000000000 +0200
-+++ ./src/com/sun/jna/Native.java	2012-10-26 11:36:51.028999957 +0200
-@@ -641,152 +641,18 @@ public final class Native {
- 
-     /**
-      * Loads the JNA stub library.
--     * First tries jna.boot.library.path, then the system path, then from the
--     * jar file.
-+     * 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() {
-         removeTemporaryFiles();
- 
--        String libName = System.getProperty("jna.boot.library.name", "jnidispatch");
--        String bootPath = System.getProperty("jna.boot.library.path");
--        if (bootPath != null) {
--            // String.split not available in 1.4
--            StringTokenizer dirs = new StringTokenizer(bootPath, File.pathSeparator);
--            while (dirs.hasMoreTokens()) {
--                String dir = dirs.nextToken();
--                File file = new File(new File(dir), System.mapLibraryName(libName));
--                String path = file.getAbsolutePath();
--                if (file.exists()) {
--                    try {
--                        System.load(path);
--                        nativeLibraryPath = path;
--                        return;
--                    } catch (UnsatisfiedLinkError ex) {
--                        // Not a problem if already loaded in anoteher class loader
--                        // Unfortunately we can't distinguish the difference...
--                        //System.out.println("File found at " + file + " but not loadable: " + ex.getMessage());
--                    }
--                }
--                if (Platform.isMac()) {
--                    String orig, ext;
--                    if (path.endsWith("dylib")) {
--                        orig = "dylib";
--                        ext = "jnilib";
--                    } else {
--                        orig = "jnilib";
--                        ext = "dylib";
--                    }
--                    path = path.substring(0, path.lastIndexOf(orig)) + ext;
--                    if (new File(path).exists()) {
--                        try {
--                            System.load(path);
--                            nativeLibraryPath = path;
--                            return;
--                        } catch (UnsatisfiedLinkError ex) {
--                            System.err.println("File found at " + path + " but not loadable: " + ex.getMessage());
--                        }
--                    }
--                }
--            }
--        }
--        if (Platform.isAndroid()) {
--            // Native libraries on android must be bundled with the APK
--            System.setProperty("jna.nounpack", "true");
--        }
-         try {
--            if (!Boolean.getBoolean("jna.nosys")) {
--                System.loadLibrary(libName);
--                return;
--            }
-+            System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
-+            nativeLibraryPath = "@JNIPATH@/" + System.mapLibraryName("jnidispatch");
-         }
-         catch(UnsatisfiedLinkError e) {
--            if (Boolean.getBoolean("jna.nounpack")) {
--                throw e;
--            }
--        }
--        if (!Boolean.getBoolean("jna.nounpack")) {
--            loadNativeLibraryFromJar();
--            return;
--        }
--        throw new UnsatisfiedLinkError("Native jnidispatch library not found");
--    }
--
--    /**
--     * 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);
--        boolean unpacked = false;
--                
--        // 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("JNA native support (" + resourceName 
--                                           + ") not found in resource path");
--        }
--    
--        File lib = null;
--        if (url.getProtocol().toLowerCase().equals("file")) {
--            try {
--                lib = new File(new URI(url.toString()));
--            }
--            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.
--                File dir = getTempDir();
--                lib = File.createTempFile("jna", Platform.isWindows()?".dll":null, dir);
--                lib.deleteOnExit();
--                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);
--                }
--                unpacked = true;
--            }
--            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) { }
--                }
--            }
--        }
--        System.load(lib.getAbsolutePath());
--        nativeLibraryPath = lib.getAbsolutePath();
--        // Attempt to delete immediately once jnidispatch is successfully
--        // loaded.  This avoids the complexity of trying to do so on "exit",
--        // which point can vary under different circumstances (native
--        // compilation, dynamically loaded modules, normal application, etc).
--        if (unpacked) {
--            deleteNativeLibrary(lib.getAbsolutePath());
-+            throw new RuntimeException(e);
-         }
-     }
- 
+--- ./src/com/sun/jna/Native.java.loadlib	2013-04-29 15:23:30.988702267 +0200
++++ ./src/com/sun/jna/Native.java	2013-04-29 15:25:55.409671266 +0200
+@@ -670,99 +670,22 @@ public final class Native {
+ 
+     /**
+      * Loads the JNA stub library.
+-     * First tries jna.boot.library.path, then the system path, then from the
+-     * jar file.
++     * 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() {
+         removeTemporaryFiles();
+ 
+-        String libName = System.getProperty("jna.boot.library.name", "jnidispatch");
+-        String bootPath = System.getProperty("jna.boot.library.path");
+-        if (bootPath != null) {
+-            // String.split not available in 1.4
+-            StringTokenizer dirs = new StringTokenizer(bootPath, File.pathSeparator);
+-            while (dirs.hasMoreTokens()) {
+-                String dir = dirs.nextToken();
+-                File file = new File(new File(dir), System.mapLibraryName(libName));
+-                String path = file.getAbsolutePath();
+-                if (file.exists()) {
+-                    try {
+-                        System.load(path);
+-                        nativeLibraryPath = path;
+-                        return;
+-                    } catch (UnsatisfiedLinkError ex) {
+-                        // Not a problem if already loaded in anoteher class loader
+-                        // Unfortunately we can't distinguish the difference...
+-                        //System.out.println("File found at " + file + " but not loadable: " + ex.getMessage());
+-                    }
+-                }
+-                if (Platform.isMac()) {
+-                    String orig, ext;
+-                    if (path.endsWith("dylib")) {
+-                        orig = "dylib";
+-                        ext = "jnilib";
+-                    } else {
+-                        orig = "jnilib";
+-                        ext = "dylib";
+-                    }
+-                    path = path.substring(0, path.lastIndexOf(orig)) + ext;
+-                    if (new File(path).exists()) {
+-                        try {
+-                            System.load(path);
+-                            nativeLibraryPath = path;
+-                            return;
+-                        } catch (UnsatisfiedLinkError ex) {
+-                            System.err.println("File found at " + path + " but not loadable: " + ex.getMessage());
+-                        }
+-                    }
+-                }
+-            }
+-        }
+-        if (Platform.isAndroid()) {
+-            // Native libraries on android must be bundled with the APK
+-            System.setProperty("jna.nounpack", "true");
+-        }
+         try {
+-            if (!Boolean.getBoolean("jna.nosys")) {
+-                System.loadLibrary(libName);
+-                return;
+-            }
++            System.load("@JNIPATH@/" + System.mapLibraryName("jnidispatch"));
++            nativeLibraryPath = "@JNIPATH@/" + System.mapLibraryName("jnidispatch");
+         }
+         catch(UnsatisfiedLinkError e) {
+-            if (Boolean.getBoolean("jna.nounpack")) {
+-                throw e;
+-            }
+-        }
+-        if (!Boolean.getBoolean("jna.nounpack")) {
+-            loadNativeLibraryFromJar();
+-            return;
++            throw new RuntimeException(e);
+         }
+-        throw new UnsatisfiedLinkError("Native jnidispatch library not found");
+     }
+ 
+     static final String JNA_TMPLIB_PREFIX = "jna";
+-    /**
+-     * 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() {
+-        try {
+-            String prefix = "com/sun/jna/" + getNativeLibraryResourcePrefix();
+-            File lib = extractFromResourcePath("jnidispatch", prefix, Native.class.getClassLoader());
+-            System.load(lib.getAbsolutePath());
+-            nativeLibraryPath = lib.getAbsolutePath();
+-            // Attempt to delete immediately once jnidispatch is successfully
+-            // loaded.  This avoids the complexity of trying to do so on "exit",
+-            // which point can vary under different circumstances (native
+-            // compilation, dynamically loaded modules, normal application, etc).
+-            if (isUnpacked(lib)) {
+-                deleteLibrary(lib);
+-            }
+-        }
+-        catch(IOException e) {
+-            throw new UnsatisfiedLinkError(e.getMessage());
+-        }
+-    }
+ 
+     /** Identify temporary files unpacked from classpath jar files. */
+     static boolean isUnpacked(File file) {
diff --git a/jna.spec b/jna.spec
index 8fe87c0..1264ed8 100644
--- a/jna.spec
+++ b/jna.spec
@@ -17,16 +17,16 @@ Source0:        %{name}-%{version}.tar.bz2
 Patch0:         jna-3.5.0-build.patch
 # This patch is Fedora-specific for now until we get the huge
 # JNI library location mess sorted upstream
-Patch1:         jna-3.5.0-loadlibrary.patch
+Patch1:         jna-3.5.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-3.4.0-tests-headless.patch
 # Build using GCJ javadoc
-Patch3:         jna-3.5.0-gcj-javadoc.patch
+Patch3:         jna-3.5.2-gcj-javadoc.patch
 # junit cames from rpm
-Patch4:         jna-3.5.0-junit.patch
+Patch4:         jna-3.5.2-junit.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 # We manually require libffi because find-requires doesn't work


More information about the scm-commits mailing list