diff --git a/.cvsignore b/.cvsignore index 5bc5a3e..d0f7e8f 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -jna-3.2.4.tar.bz2 +jna-3.2.7.tar.bz2 diff --git a/import.log b/import.log index 94b7487..cbd2cba 100644 --- a/import.log +++ b/import.log @@ -1 +1,2 @@ jna-3_2_4-1_el5:HEAD:jna-3.2.4-1.el5.src.rpm:1259001126 +jna-3_2_7-1_fc12:HEAD:jna-3.2.7-1.fc12.src.rpm:1279792606 diff --git a/jna-3.2.4-gcj-javadoc.patch b/jna-3.2.4-gcj-javadoc.patch deleted file mode 100644 index 9865c8d..0000000 --- a/jna-3.2.4-gcj-javadoc.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- build.xml.orig 2010-04-22 15:22:49.082452327 -0400 -+++ build.xml 2010-04-22 15:22:54.266203934 -0400 -@@ -540,8 +540,6 @@ - - - -- -- - - - ---- src/com/sun/jna/Function.java.orig 2010-04-22 15:23:32.766205632 -0400 -+++ src/com/sun/jna/Function.java 2010-04-22 15:23:55.909207399 -0400 -@@ -76,7 +76,7 @@ - * Library in which to find the native function - * @param functionName - * Name of the native function to be linked with -- * @throws {@link UnsatisfiedLinkError} if the library is not found or -+ * @throws UnsatisfiedLinkError if the library is not found or - * the given function name is not found within the library. - */ - public static Function getFunction(String libraryName, String functionName) { -@@ -97,7 +97,7 @@ - * @param callFlags - * Function call flags - * -- * @throws {@link UnsatisfiedLinkError} if the library is not found or -+ * @throws UnsatisfiedLinkError if the library is not found or - * the given function name is not found within the library. - */ - public static Function getFunction(String libraryName, String functionName, int callFlags) { -@@ -161,7 +161,7 @@ - * Name of the native function to be linked with - * @param callFlags - * Function call flags -- * @throws {@link UnsatisfiedLinkError} if the given function name is -+ * @throws UnsatisfiedLinkError if the given function name is - * not found within the library. - */ - Function(NativeLibrary library, String functionName, int callFlags) { diff --git a/jna-3.2.4-loadlibrary.patch b/jna-3.2.4-loadlibrary.patch deleted file mode 100644 index 47238b1..0000000 --- a/jna-3.2.4-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 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 { - } - - /** -- * 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(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); -- 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.2.5-direct.patch b/jna-3.2.5-direct.patch new file mode 100644 index 0000000..8534f50 --- /dev/null +++ b/jna-3.2.5-direct.patch @@ -0,0 +1,12 @@ +diff -up ./native/dispatch.c.old ./native/dispatch.c +--- ./native/dispatch.c.old 2010-05-12 09:56:55.478872622 +0200 ++++ ./native/dispatch.c 2010-05-12 09:57:11.639872467 +0200 +@@ -2808,7 +2808,7 @@ Java_com_sun_jna_Native_unregister(JNIEn + free(md); + } + (*env)->ReleaseLongArrayElements(env, handles, data, 0); +- (*env)->UnregisterNatives(env, cls); ++ //(*env)->UnregisterNatives(env, cls); + } + + JNIEXPORT jlong JNICALL diff --git a/jna-3.2.5-junit.patch b/jna-3.2.5-junit.patch new file mode 100644 index 0000000..afce350 --- /dev/null +++ b/jna-3.2.5-junit.patch @@ -0,0 +1,37 @@ +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 new file mode 100644 index 0000000..99b2798 --- /dev/null +++ b/jna-3.2.5-loadlibrary.patch @@ -0,0 +1,142 @@ +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.2.7-gcj-javadoc.patch b/jna-3.2.7-gcj-javadoc.patch new file mode 100644 index 0000000..f1ea6d6 --- /dev/null +++ b/jna-3.2.7-gcj-javadoc.patch @@ -0,0 +1,42 @@ +diff -up ./build.xml.gcj-javadoc ./build.xml +--- ./build.xml.gcj-javadoc 2010-07-22 11:47:35.097371333 +0200 ++++ ./build.xml 2010-07-22 11:47:56.222245622 +0200 +@@ -555,8 +555,6 @@ + + + +- +- + + + +diff -up ./src/com/sun/jna/Function.java.gcj-javadoc ./src/com/sun/jna/Function.java +--- ./src/com/sun/jna/Function.java.gcj-javadoc 2010-07-22 11:48:33.732370892 +0200 ++++ ./src/com/sun/jna/Function.java 2010-07-22 11:49:25.324392691 +0200 +@@ -76,7 +76,7 @@ public class Function extends Pointer { + * Library in which to find the native function + * @param functionName + * Name of the native function to be linked with +- * @throws {@link UnsatisfiedLinkError} if the library is not found or ++ * @throws UnsatisfiedLinkError if the library is not found or + * the given function name is not found within the library. + */ + public static Function getFunction(String libraryName, String functionName) { +@@ -97,7 +97,7 @@ public class Function extends Pointer { + * @param callFlags + * Function call flags + * +- * @throws {@link UnsatisfiedLinkError} if the library is not found or ++ * @throws UnsatisfiedLinkError if the library is not found or + * the given function name is not found within the library. + */ + public static Function getFunction(String libraryName, String functionName, int callFlags) { +@@ -161,7 +161,7 @@ public class Function extends Pointer { + * Name of the native function to be linked with + * @param callFlags + * Function call flags +- * @throws {@link UnsatisfiedLinkError} if the given function name is ++ * @throws UnsatisfiedLinkError if the given function name is + * not found within the library. + */ + Function(NativeLibrary library, String functionName, int callFlags) { diff --git a/jna-pom.xml b/jna-pom.xml new file mode 100644 index 0000000..019d11a --- /dev/null +++ b/jna-pom.xml @@ -0,0 +1,52 @@ + + 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 2876c15..49c6060 100644 --- a/jna.spec +++ b/jna.spec @@ -1,6 +1,6 @@ Name: jna -Version: 3.2.4 -Release: 5%{?dist} +Version: 3.2.7 +Release: 1%{?dist} Summary: Pure Java access to native libraries Group: Development/Libraries @@ -9,29 +9,35 @@ 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 jna-%{version}/dist/* -# tar -cjf jna-%{version}.tar.bz2 jna-%{version} +# rm -rf jna-%{version}/dist/* +# tar cjf ~/rpm/SOURCES/jna-%{version}.tar.bz2 jna-%{version} Source0: %{name}-%{version}.tar.bz2 +Source1: %{name}-pom.xml # This patch is Fedora-specific for now until we get the huge # JNI library location mess sorted upstream -Patch1: jna-3.2.4-loadlibrary.patch +Patch1: jna-3.2.5-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 -# Upstream appears to have some sort of MD5 check on the contents of their # native jar. Carve that out so we always build it. Patch3: jna-3.2.4-build-md5.patch # Build using GCJ javadoc -Patch4: jna-3.2.4-gcj-javadoc.patch +Patch4: jna-3.2.7-gcj-javadoc.patch +# junit cames from rpm +Patch5: jna-3.2.5-junit.patch +# see: https://jna.dev.java.net/issues/show_bug.cgi?id=154 +Patch6: jna-3.2.5-direct.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: java-devel 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 jpackage-utils libffi +Requires: java >= 1:1.6.0 jpackage-utils libffi +Requires(post): jpackage-utils +Requires(postun): jpackage-utils +BuildRequires: java-devel >= 1:1.6.0 ant jpackage-utils ant-nodeps +BuildRequires: libX11-devel libXt-devel libffi-devel # for ExcludeArch see bug: 468831 %if 0%{?rhel} < 6 && 0%{?fedora} < 10 ExcludeArch: ppc ppc64 @@ -57,26 +63,30 @@ Requires: %{name} = %{version}-%{release} This package contains the javadocs for %{name}. -%package examples -Summary: Examples for %{name} +%package contrib +Summary: Contrib for %{name} Group: Documentation Requires: %{name} = %{version}-%{release} -%description examples -This package contains the examples for %{name}. +%description contrib +This package contains the contributed examples for %{name}. %prep %setup -q -n %{name}-%{version} sed -e 's|@JNIPATH@|%{_libdir}/%{name}|' %{PATCH1} | patch -p1 %patch2 -p1 -b .tests-headless -%patch3 -p0 -R -b .md5 +#patch3 -p0 -R -b .md5 %patch4 -p0 -b .gcj-javadoc +%patch5 -p1 -b .junit +#patch6 -p1 -b .direct +cp %{SOURCE1} ./ # all java binaries must be removed from the sources -find . -name '*.jar' -exec rm -f '{}' \; -find . -name '*.class' -exec rm -f '{}' \; +#find . -name '*.jar' -delete +rm lib/junit.jar +find . -name '*.class' -delete # remove internal copy of libffi rm -rf native/libffi @@ -89,16 +99,16 @@ 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 -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true jar examples -ant javadoc - +ant -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true jar javadoc +# remove compiled contribs +find contrib -name build -delete || : +sed -i "s/VERSION/%{version}/" %{name}-pom.xml %install 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, @@ -106,21 +116,43 @@ install -D -m 644 build*/examples.jar %{buildroot}%{_javadir}/%{name}-examples-% install -d -m 755 %{buildroot}%{_libdir}/%{name} install -m 755 build*/native/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/ +# install maven pom file +install -Dm 644 %{name}-pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}.pom + +# ... and maven depmap +%add_to_maven_depmap net.java.dev.jna %{name} %{version} JPP %{name} + # javadocs install -p -d -m 755 %{buildroot}%{_javadocdir}/%{name}-%{version} cp -a doc/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version} +%if 0%{?fedora} >= 9 +%check +#ant -Dcflags_extra.native="%{optflags}" -Ddynlink.native=true -Dnomixedjar.native=true test +%endif + + %clean rm -rf %{buildroot} +%post +%update_maven_depmap + + +%postun +%update_maven_depmap + + %files %defattr(-,root,root,-) %doc LICENSE.txt %{_libdir}/%{name} %{_javadir}/%{name}.jar %{_javadir}/%{name}-%{version}.jar +%{_mavenpomdir}/*.pom +%{_mavendepmapfragdir}/%{name} %files javadoc @@ -128,13 +160,18 @@ rm -rf %{buildroot} %{_javadocdir}/%{name}-%{version} -%files examples +%files contrib %defattr(-,root,root,-) -%{_javadir}/%{name}-examples.jar -%{_javadir}/%{name}-examples-%{version}.jar +%doc contrib %changelog +* Thu Jul 22 2010 Levente Farkas - 3.2.7-1 +- Rebase on upstream 3.2.7 + +* Wed Jul 21 2010 Stanislav Ochotnicky - 3.2.4-6 +- Add maven depmap + * Thu Apr 22 2010 Colin Walters - 3.2.4-5 - Add patches to make the build happen with gcj diff --git a/sources b/sources index 0a14343..b53151e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3e53de2ba6c9e3920ec681224114209e jna-3.2.4.tar.bz2 +59c5d5ac6b49f86b7ae701265f04a48c jna-3.2.7.tar.bz2