updat to 3.5.2

This commit is contained in:
Levente Farkas 2013-04-29 15:28:31 +02:00
parent e03cc5d3ee
commit fbf1c46525
7 changed files with 138 additions and 383 deletions

View File

@ -1,42 +0,0 @@
diff -up ./build.xml.gcj-javadoc ./build.xml
--- ./build.xml.gcj-javadoc 2012-10-26 11:39:31.000000000 +0200
+++ ./build.xml 2012-10-26 11:40:11.194483580 +0200
@@ -893,8 +893,6 @@ osname=macos
<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>
</target>
diff -up ./src/com/sun/jna/Function.java.gcj-javadoc ./src/com/sun/jna/Function.java
--- ./src/com/sun/jna/Function.java.gcj-javadoc 2012-10-19 03:53:11.000000000 +0200
+++ ./src/com/sun/jna/Function.java 2012-10-26 11:39:31.112063090 +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 <a href="#callflags">call flags</a>
*
- * @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 <a href="#callflags">call flags</a>
- * @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) {

View File

@ -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

View File

@ -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>

View File

@ -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) {

View File

@ -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

View File

@ -1,71 +0,0 @@
<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>jna</artifactId>
<packaging>jar</packaging>
<version>VERSION</version>
<name>Java Native Access</name>
<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>
<!-- 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>

View File

@ -1,79 +0,0 @@
<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>