[jna] update to 3.4.0

Levente Farkas lfarkas at fedoraproject.org
Wed Mar 7 11:20:45 UTC 2012


commit f63a5dd2a9dcda7416d0584e83144ea71ac6fc9a
Author: Levente Farkas <lfarkas at lfarkas.org>
Date:   Wed Mar 7 12:20:26 2012 +0100

    update to 3.4.0

 jna-3.2.4-tests-headless.patch                     |   11 --
 jna-3.2.5-junit.patch                              |   37 -------
 jna-3.4.0-junit.patch                              |   61 +++++++++++
 ...oadlibrary.patch => jna-3.4.0-loadlibrary.patch |  105 +++++++++++---------
 jna-3.4.0-tests-headless.patch                     |   11 ++
 jna.spec                                           |   45 +++++----
 jna-pom.xml => pom-jna.xml                         |   39 ++++++--
 pom-platform.xml                                   |   79 +++++++++++++++
 8 files changed, 265 insertions(+), 123 deletions(-)
---
diff --git a/jna-3.4.0-junit.patch b/jna-3.4.0-junit.patch
new file mode 100644
index 0000000..ffae004
--- /dev/null
+++ b/jna-3.4.0-junit.patch
@@ -0,0 +1,61 @@
+diff -up ./build.xml.junit ./build.xml
+--- ./build.xml.junit	2012-03-07 12:01:58.716741284 +0100
++++ ./build.xml	2012-03-07 12:03:39.669022092 +0100
+@@ -188,9 +188,6 @@
+   <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>
+@@ -253,7 +250,6 @@
+     <subant target="jar">
+       <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"/>
+       <fileset dir="${contrib}" includes="platform/build.xml" />
+     </subant>
+   </target>
+@@ -262,7 +258,6 @@
+     <subant target="jar">
+       <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"/>
+       <fileset dir="${contrib}" includes="*/build.xml" excludes="platform/build.xml"/>
+     </subant>
+   </target>
+@@ -491,13 +486,12 @@
+     <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="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="jna.jar,jna-test.jar,junit.jar,jnidispatch.jar,clover.jar"/>
++      <fileset dir="${build}/jws" includes="jna.jar,jna-test.jar,jnidispatch.jar,clover.jar"/>
+     </signjar>
+   </target>
+ 	
+@@ -587,7 +581,6 @@
+     <subant target="test">
+       <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"/>
+       <fileset dir="${contrib}" includes="platform/build.xml"/>
+     </subant>
+   </target>
+@@ -813,7 +806,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.2.5-loadlibrary.patch b/jna-3.4.0-loadlibrary.patch
similarity index 60%
rename from jna-3.2.5-loadlibrary.patch
rename to jna-3.4.0-loadlibrary.patch
index 99b2798..34f2e3a 100644
--- a/jna-3.2.5-loadlibrary.patch
+++ b/jna-3.4.0-loadlibrary.patch
@@ -1,36 +1,37 @@
 diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
---- ./src/com/sun/jna/Native.java.loadlib	2010-05-01 10:54:09.949779524 +0200
-+++ ./src/com/sun/jna/Native.java	2010-05-01 10:55:08.405824567 +0200
-@@ -631,131 +631,19 @@ public final class Native {
-     }
+--- ./src/com/sun/jna/Native.java.loadlib	2012-03-07 11:41:53.378594071 +0100
++++ ./src/com/sun/jna/Native.java	2012-03-07 11:52:18.537721064 +0100
+@@ -634,148 +634,18 @@ 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.
--     * <p>
--     * 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.
--     * </p>
-+     * 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.
+      * 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() {
--        String libName = "jnidispatch";
+         removeTemporaryFiles();
+ 
+-        String libName = System.getProperty("jna.boot.library.name", "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) {
+-            // 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;
@@ -41,25 +42,37 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
 -                        orig = "jnilib";
 -                        ext = "dylib";
 -                    }
--                    try {
--                        path = path.substring(0, path.lastIndexOf(orig)) + ext;
--                        System.load(path);
--                        nativeLibraryPath = path;
--                        return;
--                    } catch (UnsatisfiedLinkError ex) {
+-                    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());
+-                        }
 -                    }
 -                }
 -            }
 -        }
          try {
--            System.loadLibrary(libName);
--            nativeLibraryPath = libName;
+-            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");
 -    }
 -
 -    /**
@@ -72,6 +85,7 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
 -        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 
@@ -108,20 +122,16 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
 -                // 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);
+-                File dir = getTempDir();
+-                lib = File.createTempFile("jna", Platform.isWindows()?".dll":null, dir);
 -                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);
 -                }
+-                unpacked = true;
 -            }
 -            catch(IOException e) {
 -                throw new Error("Failed to create temporary file for jnidispatch library: " + e);
@@ -132,11 +142,16 @@ diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java
 -                    try { fos.close(); } catch(IOException e) { }
 -                }
 -            }
--            unpacked = true;
-+            throw new RuntimeException(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);
+         }
      }
  
-     /**
diff --git a/jna-3.4.0-tests-headless.patch b/jna-3.4.0-tests-headless.patch
new file mode 100644
index 0000000..73dba50
--- /dev/null
+++ b/jna-3.4.0-tests-headless.patch
@@ -0,0 +1,11 @@
+diff -up ./build.xml.tests-headless ./build.xml
+--- ./build.xml.tests-headless	2012-03-07 11:56:41.702657823 +0100
++++ ./build.xml	2012-03-07 11:57:12.635887659 +0100
+@@ -561,6 +561,7 @@
+       <sysproperty key="jna.protected" value="true"/>
+       <sysproperty key="jna.builddir" file="${build}"/>
+       <jvmarg value="${vmopt.arch}"/>
++      <jvmarg value="-Djava.awt.headless=true"/>
+       <classpath><path refid="test.runpath"/></classpath>
+       <formatter type="brief" usefile="false"/>
+       <formatter type="xml"/>
diff --git a/jna.spec b/jna.spec
index 7e21860..3d074d4 100644
--- a/jna.spec
+++ b/jna.spec
@@ -1,6 +1,6 @@
 Name:           jna
-Version:        3.2.7
-Release:        13%{?dist}
+Version:        3.4.0
+Release:        1%{?dist}
 Summary:        Pure Java access to native libraries
 
 Group:          Development/Libraries
@@ -8,32 +8,34 @@ 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}
-#   rm -rf jna-%{version}/dist/*
+#   https://github.com/twall/jna/tarball/%{version}
+#   tar xzf twall-jna-%{version}*.tar.gz
+#   mv twall-jna-* jna-%{version}
+#   rm -rf jna-%{version}/{dist,www}
 #   tar cjf ~/rpm/SOURCES/jna-%{version}.tar.bz2 jna-%{version}
 Source0:        %{name}-%{version}.tar.bz2
-Source1:	%{name}-pom.xml
+Source1:	pom-%{name}.xml
+Source2:	pom-platform.xml
 # This patch is Fedora-specific for now until we get the huge
 # JNI library location mess sorted upstream
-Patch1:         jna-3.2.5-loadlibrary.patch
+Patch1:         jna-3.4.0-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.2.4-tests-headless.patch
-Patch3:         jna-3.2.7-javadoc.patch
+Patch2:         jna-3.4.0-tests-headless.patch
 # Build using GCJ javadoc
 Patch4:         jna-3.2.7-gcj-javadoc.patch
 # junit cames from rpm
-Patch5:         jna-3.2.5-junit.patch
+Patch5:         jna-3.4.0-junit.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 # We manually require libffi because find-requires doesn't work
 # inside jars.
-Requires:       java >= 1:1.6.0, jpackage-utils, libffi
+Requires:       java, jpackage-utils, libffi
 Requires(post):	jpackage-utils
 Requires(postun): jpackage-utils
-BuildRequires:  java-devel >= 1:1.6.0, jpackage-utils, libffi-devel
+BuildRequires:  java-devel, jpackage-utils, libffi-devel
 BuildRequires:  ant, ant-junit, ant-nodeps, ant-trax, junit
 BuildRequires:  libX11-devel, libXt-devel
 # for ExclusiveArch see bug: 468831 640005 548099
@@ -81,12 +83,10 @@ This package contains the contributed examples for %{name}.
 %setup -q -n %{name}-%{version}
 sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH1} | patch -p1
 %patch2 -p1 -b .tests-headless
-%patch3 -p1 -b .javadoc
-# temporary hach for patch3 on epel5
 chmod -Rf a+rX,u+w,g-w,o-w .
 %patch4 -p0 -b .gcj-javadoc
 %patch5 -p1 -b .junit
-cp %{SOURCE1} ./
+cp %{SOURCE1} %{SOURCE2} ./
 
 # UnloadTest fail during build since we modify class loading
 rm test/com/sun/jna/JNAUnloadTest.java
@@ -102,9 +102,9 @@ find . -name '*.class' -delete
 rm -rf native/libffi
 
 # clean LICENSE.txt
-sed -i 's/\r//' LICENSE.txt
+sed -i 's/\r//' LICENSE
 
-chmod -c 0644 LICENSE.txt OTHERS release-notes.html
+chmod -c 0644 LICENSE OTHERS CHANGES.md
 
 
 %build
@@ -113,7 +113,7 @@ chmod -c 0644 LICENSE.txt OTHERS release-notes.html
 ant -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true jar contrib-jars javadoc
 # remove compiled contribs
 find contrib -name build -exec rm -rf {} \; || :
-sed -i "s/VERSION/%{version}/" %{name}-pom.xml
+sed -i "s/VERSION/%{version}/" pom-%{name}.xml pom-platform.xml
 
 %install
 rm -rf %{buildroot}
@@ -130,10 +130,12 @@ install -m 755 build*/native/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/
 
 %if 0%{?fedora} >= 9 || 0%{?rhel} > 5
 # install maven pom file
-install -Dm 644 %{name}-pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
+install -Dm 644 pom-%{name}.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
+install -Dm 644 pom-platform.xml %{buildroot}%{_mavenpomdir}/JPP-platform.pom
 
 # ... and maven depmap
 %add_to_maven_depmap net.java.dev.jna %{name} %{version} JPP %{name}
+%add_to_maven_depmap net.java.dev.jna %{name} %{version} JPP platform
 %endif
 
 # javadocs
@@ -166,7 +168,7 @@ rm -rf %{buildroot}
 
 %files
 %defattr(-,root,root,-)
-%doc LICENSE.txt OTHERS release-notes.html TODO
+%doc LICENSE OTHERS README.md CHANGES.md TODO
 %{_libdir}/%{name}
 %{_javadir}/%{name}.jar
 %if 0%{?fedora} >= 9 || 0%{?rhel} > 5
@@ -177,7 +179,7 @@ rm -rf %{buildroot}
 
 %files javadoc
 %defattr(-,root,root,-)
-%doc LICENSE.txt
+%doc LICENSE
 %{_javadocdir}/%{name}
 
 
@@ -187,6 +189,9 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Wed Mar  7 2012 Levente Farkas <lfarkas at lfarkas.org> - 3.4.0-1
+- Update to 3.4.0
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 3.2.7-13
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 
diff --git a/jna-pom.xml b/pom-jna.xml
similarity index 62%
rename from jna-pom.xml
rename to pom-jna.xml
index 019d11a..d44b3ad 100644
--- a/jna-pom.xml
+++ b/pom-jna.xml
@@ -8,14 +8,33 @@
   <packaging>jar</packaging>
   <version>VERSION</version>
   <name>Java Native Access</name>
-    
-   <distributionManagement>
-    <repository>
-      <uniqueVersion>false</uniqueVersion>
-      <id>java.net-maven2-repository</id>
-      <url>java-net:/maven2-repository/trunk/repository/</url>
-    </repository>
-  </distributionManagement>
+  <description>Java Native Access</description>
+  <url>https://github.com/twall/jna</url>
+
+  <licenses>
+      <license>
+          <name>LGPL, version 2.1</name>
+          <url>http://creativecommons.org/licenses/LGPL/2.1/</url>
+          <distribution>repo</distribution>
+      </license>
+  </licenses>
+
+  <scm>
+    <connection>scm:git:https://github.com/twall/jna</connection>
+    <developerConnection>scm:git:ssh://git@github.com/twall/jna.git</developerConnection>
+    <url>https://github.com/twall/jna</url>
+  </scm>
+
+  <developers>
+    <developer>
+      <id>twall</id>
+      <name>Timotyh Wall</name>
+      <roles>
+        <role>Owner</role>
+      </roles>
+    </developer>
+  </developers>
+
 
   <build>
     <plugins>
@@ -33,6 +52,7 @@
               <tasks>
                 <!--<ant dir="." target="dist" />-->
                 <attachArtifact file="dist/jna.jar" />
+                <attachArtifact file="dist/platform.jar" classifier="platform" type="jar" />
                 <attachArtifact file="dist/src-mvn.zip" classifier="sources" type="jar"/>
               </tasks>
             </configuration>
@@ -44,9 +64,8 @@
       <extension>
         <groupId>org.jvnet.wagon-svn</groupId>
         <artifactId>wagon-svn</artifactId>
-        <version>1.8</version>
+        <version>1.12</version>
       </extension>
     </extensions>
   </build>
-
 </project>
diff --git a/pom-platform.xml b/pom-platform.xml
new file mode 100644
index 0000000..c1092c6
--- /dev/null
+++ b/pom-platform.xml
@@ -0,0 +1,79 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+  http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>net.java.dev.jna</groupId>
+  <artifactId>platform</artifactId>
+  <packaging>jar</packaging>
+  <version>VERSION</version>
+  <name>Java Native Access Platform</name>
+  <description>Java Native Access Platform</description>
+  <url>https://github.com/twall/jna</url>
+
+  <licenses>
+      <license>
+          <name>LGPL, version 2.1</name>
+          <url>http://creativecommons.org/licenses/LGPL/2.1/</url>
+          <distribution>repo</distribution>
+      </license>
+  </licenses>
+
+
+  <distributionManagement>
+    <repository>
+      <uniqueVersion>false</uniqueVersion>
+      <id>java.net-m2-repository</id>
+      <url>java-net:/maven2-repository~svn/trunk/repository/</url>
+    </repository>
+  </distributionManagement>
+
+  <scm>
+    <connection>scm:git:https://github.com/twall/jna</connection>
+    <developerConnection>scm:git:ssh://git@github.com/twall/jna.git</developerConnection>
+    <url>https://github.com/twall/jna</url>
+  </scm>
+
+  <developers>
+    <developer>
+      <id>twall</id>
+      <name>Timotyh Wall</name>
+      <roles>
+        <role>Owner</role>
+      </roles>
+    </developer>
+  </developers>
+
+  <build>
+    <plugins>
+      <!-- fake out maven and install the binary artifact -->
+      <plugin>
+        <groupId>org.jvnet.maven-antrun-extended-plugin</groupId>
+        <artifactId>maven-antrun-extended-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <!--<ant dir="." target="dist" />-->
+                <attachArtifact file="dist/jna.jar"/>
+                <attachArtifact file="dist/platform.jar" classifier="platform" type="jar"/>
+                <attachArtifact file="dist/src-mvn.zip" classifier="sources" type="jar"/>
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+    <extensions>
+      <extension>
+        <groupId>org.jvnet.wagon-svn</groupId>
+        <artifactId>wagon-svn</artifactId>
+        <version>1.12</version>
+      </extension>
+    </extensions>
+  </build>
+</project>


More information about the scm-commits mailing list