From f63a5dd2a9dcda7416d0584e83144ea71ac6fc9a Mon Sep 17 00:00:00 2001 From: Levente Farkas Date: Mar 07 2012 11:20:26 +0000 Subject: update to 3.4.0 --- diff --git a/jna-3.2.4-tests-headless.patch b/jna-3.2.4-tests-headless.patch deleted file mode 100644 index 82f94a9..0000000 --- a/jna-3.2.4-tests-headless.patch +++ /dev/null @@ -1,11 +0,0 @@ -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-3.2.5-junit.patch b/jna-3.2.5-junit.patch deleted file mode 100644 index afce350..0000000 --- a/jna-3.2.5-junit.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -up ./build.xml.junit ./build.xml ---- ./build.xml.junit 2010-05-01 12:18:55.547238394 +0200 -+++ ./build.xml 2010-05-01 12:20:49.253989440 +0200 -@@ -161,9 +161,6 @@ - - - -- -- -- - - - -@@ -419,13 +416,12 @@ - - - -- - - - - - -- -+ - - - -@@ -633,7 +629,7 @@ - - - -- -+ - - - diff --git a/jna-3.2.5-loadlibrary.patch b/jna-3.2.5-loadlibrary.patch deleted file mode 100644 index 99b2798..0000000 --- a/jna-3.2.5-loadlibrary.patch +++ /dev/null @@ -1,142 +0,0 @@ -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 { - } - - /** -- * 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(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. -- 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-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 @@ + + + +- +- +- + + + +@@ -253,7 +250,6 @@ + + + +- + + + +@@ -262,7 +258,6 @@ + + + +- + + + +@@ -491,13 +486,12 @@ + + + +- + + + + + +- ++ + + + +@@ -587,7 +581,6 @@ + + + +- + + + +@@ -813,7 +806,7 @@ osname=macos, + + + +- ++ + + + diff --git a/jna-3.4.0-loadlibrary.patch b/jna-3.4.0-loadlibrary.patch new file mode 100644 index 0000000..34f2e3a --- /dev/null +++ b/jna-3.4.0-loadlibrary.patch @@ -0,0 +1,157 @@ +diff -up ./src/com/sun/jna/Native.java.loadlib ./src/com/sun/jna/Native.java +--- ./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. +- * 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()); +- } +- } +- } +- } +- } + 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("jnidispatch (" + 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); + } + } + 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 @@ + + + ++ + + + diff --git a/jna-pom.xml b/jna-pom.xml deleted file mode 100644 index 019d11a..0000000 --- a/jna-pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - 4.0.0 - net.java.dev.jna - jna - jar - VERSION - Java Native Access - - - - false - java.net-maven2-repository - java-net:/maven2-repository/trunk/repository/ - - - - - - - - org.jvnet.maven-antrun-extended-plugin - maven-antrun-extended-plugin - - - package - - run - - - - - - - - - - - - - - - org.jvnet.wagon-svn - wagon-svn - 1.8 - - - - - 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 - 3.4.0-1 +- Update to 3.4.0 + * Fri Jan 13 2012 Fedora Release Engineering - 3.2.7-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/pom-jna.xml b/pom-jna.xml new file mode 100644 index 0000000..d44b3ad --- /dev/null +++ b/pom-jna.xml @@ -0,0 +1,71 @@ + + 4.0.0 + net.java.dev.jna + jna + jar + VERSION + Java Native Access + Java Native Access + https://github.com/twall/jna + + + + LGPL, version 2.1 + http://creativecommons.org/licenses/LGPL/2.1/ + repo + + + + + scm:git:https://github.com/twall/jna + scm:git:ssh://git@github.com/twall/jna.git + https://github.com/twall/jna + + + + + twall + Timotyh Wall + + Owner + + + + + + + + + + org.jvnet.maven-antrun-extended-plugin + maven-antrun-extended-plugin + + + package + + run + + + + + + + + + + + + + + + + org.jvnet.wagon-svn + wagon-svn + 1.12 + + + + 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 @@ + + 4.0.0 + net.java.dev.jna + platform + jar + VERSION + Java Native Access Platform + Java Native Access Platform + https://github.com/twall/jna + + + + LGPL, version 2.1 + http://creativecommons.org/licenses/LGPL/2.1/ + repo + + + + + + + false + java.net-m2-repository + java-net:/maven2-repository~svn/trunk/repository/ + + + + + scm:git:https://github.com/twall/jna + scm:git:ssh://git@github.com/twall/jna.git + https://github.com/twall/jna + + + + + twall + Timotyh Wall + + Owner + + + + + + + + + org.jvnet.maven-antrun-extended-plugin + maven-antrun-extended-plugin + + + package + + run + + + + + + + + + + + + + + + + org.jvnet.wagon-svn + wagon-svn + 1.12 + + + +