[jinput] Initial import.

Jerry James jjames at fedoraproject.org
Fri Mar 2 15:22:01 UTC 2012


commit 4c33459d3da8bb804a4c0bb4babe795c5eb71e39
Author: Jerry James <loganjerry at gmail.com>
Date:   Fri Mar 2 08:21:49 2012 -0700

    Initial import.

 .gitignore                     |    1 +
 001_jinput_build.patch         |   88 +++++++++++++++++++++++++
 002_jinput_dontstripso.patch   |   12 ++++
 003_jinput_usesystemload.patch |   35 ++++++++++
 004_jinput_usagebits.patch     |   80 +++++++++++++++++++++++
 jinput.spec                    |  137 ++++++++++++++++++++++++++++++++++++++++
 sources                        |    1 +
 7 files changed, 354 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..6309c03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/jinput-2.0.6.tar.xz
diff --git a/001_jinput_build.patch b/001_jinput_build.patch
new file mode 100644
index 0000000..99d02fb
--- /dev/null
+++ b/001_jinput_build.patch
@@ -0,0 +1,88 @@
+--- build.xml.orig	2011-03-23 12:33:26.374177000 -0600
++++ build.xml	2012-02-02 11:46:43.419456439 -0700
+@@ -3,7 +3,7 @@
+ <project name="Sun Games Initiative Client Technologies" basedir="." default="all" xmlns:artifact="urn:maven-artifact-ant">
+ 	
+ 	<property name="api.version" value="2.0.6"/>
+-	<property name="mvn.version" value="${api.version}-SNAPSHOT"/>
++	<property name="mvn.version" value="${api.version}"/>
+ 	<property name="maven-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
+ 	<property name="maven-repository-id" value="sonatype-nexus-staging" />
+ 	
+@@ -76,9 +76,9 @@
+ 				<property name="api.version" value="${api.version}"/>
+ 				<fileset file="coreAPI/build.xml"/>
+ 				<fileset file="plugins/linux/build.xml"/>
+-				<fileset file="plugins/windows/build.xml"/>
+-				<fileset file="plugins/wintab/build.xml"/>
+-				<fileset file="plugins/OSX/build.xml"/>
++				<!--fileset file="plugins/windows/build.xml"/-->
++				<!--fileset file="plugins/wintab/build.xml"/-->
++				<!--fileset file="plugins/OSX/build.xml"/-->
+ 				<fileset file="plugins/awt/build.xml"/>
+ 			</subant>
+ 		</sequential>
+@@ -107,9 +107,9 @@
+ 		<copy todir="dist/controller">
+ 			<fileset dir="plugins/awt/bin"/>
+ 			<fileset dir="plugins/linux/bin"/>
+-			<fileset dir="plugins/OSX/bin"/>
+-			<fileset dir="plugins/windows/bin"/>
+-			<fileset dir="plugins/wintab/bin"/>
++			<!--fileset dir="plugins/OSX/bin"/-->
++			<!--fileset dir="plugins/windows/bin"/-->
++			<!--fileset dir="plugins/wintab/bin"/-->
+ 		</copy>
+ 	</target>
+ 
+@@ -125,18 +125,18 @@
+ 			<fileset dir="plugins/linux/classes">
+ 				<include name="**/*.class"/>
+ 			</fileset>
+-			<fileset dir="plugins/OSX/classes">
++			<!--fileset dir="plugins/OSX/classes">
+ 				<include name="**/*.class"/>
+-			</fileset>
++			</fileset-->
+ 			<fileset dir="plugins/awt/classes">
+ 				<include name="**/*.class"/>
+ 			</fileset>
+-			<fileset dir="plugins/windows/classes">
++			<!--fileset dir="plugins/windows/classes">
+ 				<include name="**/*.class"/>
+-			</fileset>
+-			<fileset dir="plugins/wintab/classes">
++			</fileset-->
++			<!--fileset dir="plugins/wintab/classes">
+ 				<include name="**/*.class"/>
+-			</fileset>
++			</fileset-->
+ 			<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
+ 			<manifest>
+ 				<attribute name="Sealed" value="true"/>
+@@ -145,9 +145,9 @@
+ 		<copy todir="dist">
+ 			<fileset file="coreAPI/bin/jinput-test.jar"/>
+ 			<fileset dir="plugins/linux/bin" includes="*so"/>
+-			<fileset dir="plugins/OSX/bin" includes="*jnilib"/>
+-			<fileset dir="plugins/windows/bin" includes="*dll"/>
+-			<fileset dir="plugins/wintab/bin" includes="*dll"/>
++			<!--fileset dir="plugins/OSX/bin" includes="*jnilib"/-->
++			<!--fileset dir="plugins/windows/bin" includes="*dll"/-->
++			<!--fileset dir="plugins/wintab/bin" includes="*dll"/-->
+ 		</copy>
+ 	</target>
+ 
+@@ -246,9 +246,9 @@
+ 	</target>
+ 
+ 	<target name="install" description="Installs jinput in to local mvn repo">
+-		<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
+-		<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
+-	             classpathref="maven-ant-tasks.classpath"/>
++		<!--<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />-->
++		<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
++	        <!--     classpathref="maven-ant-tasks.classpath"/>-->
+ 
+ 		<filter token="VERSION" value="${mvn.version}"/>		
+ 		<copy tofile="dist/jinput-${mvn.version}.pom" filtering="true">
diff --git a/002_jinput_dontstripso.patch b/002_jinput_dontstripso.patch
new file mode 100644
index 0000000..9ab01f1
--- /dev/null
+++ b/002_jinput_dontstripso.patch
@@ -0,0 +1,12 @@
+--- ./plugins/linux/src/native/build.xml.orig	2007-04-19 05:40:03.000000000 -0600
++++ ./plugins/linux/src/native/build.xml	2012-02-02 08:45:27.705551182 -0700
+@@ -46,9 +46,6 @@
+ 			<arg line="-shared -O2 -Wall -o ${libname}"/>
+ 			<fileset dir="." includes="*.o"/>
+ 		</apply>
+-		<apply dir="." parallel="true" executable="strip" os="Linux" failonerror="true">
+-			<fileset file="${libname}"/>
+-		</apply>
+     </target>
+ </project>
+ 
diff --git a/003_jinput_usesystemload.patch b/003_jinput_usesystemload.patch
new file mode 100644
index 0000000..8d91796
--- /dev/null
+++ b/003_jinput_usesystemload.patch
@@ -0,0 +1,35 @@
+--- plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java.orig	2011-02-20 15:11:41.234377000 +0100
++++ plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java	2011-07-20 08:20:17.725039445 +0200
+@@ -42,7 +42,7 @@
+  * @author Jeremy Booth (jeremy at newdawnsoftware.com)
+  */
+ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plugin {
+-	private final static String LIBNAME = "jinput-linux";
++	private final static String LIBNAME = "jinput";
+ 	private final static String POSTFIX64BIT = "64";
+ 	private static boolean supported = false;
+ 	
+@@ -61,7 +61,7 @@
+ 		AccessController.doPrivileged(
+ 				new PrivilegedAction() {
+ 					public final Object run() {
+-						String lib_path = System.getProperty("net.java.games.input.librarypath");
++						String lib_path = System.getProperty("java.library.path");
+ 						try {
+ 							if (lib_path != null)
+ 								System.load(lib_path + File.separator + System.mapLibraryName(lib_name));
+@@ -97,12 +97,8 @@
+ 	static {
+ 		String osName = getPrivilegedProperty("os.name", "").trim();
+ 		if(osName.equals("Linux")) {
+-            supported = true;
+-			if("i386".equals(getPrivilegedProperty("os.arch"))) {
+-				loadLibrary(LIBNAME);
+-			} else {
+-				loadLibrary(LIBNAME + POSTFIX64BIT);
+-			}
++			supported = true;
++			loadLibrary(LIBNAME);
+ 		}
+ 	}
+ 
diff --git a/004_jinput_usagebits.patch b/004_jinput_usagebits.patch
new file mode 100644
index 0000000..b3fbea5
--- /dev/null
+++ b/004_jinput_usagebits.patch
@@ -0,0 +1,80 @@
+--- ./plugins/linux/build.xml.orig	2006-07-11 15:07:38.000000000 -0600
++++ ./plugins/linux/build.xml	2012-02-02 08:57:51.545209862 -0700
+@@ -56,6 +56,7 @@
+ 		<javah destdir="src/native">
+             <classpath>
+                 <pathelement location="classes"/>
++                <pathelement location="../../coreAPI/classes"/>
+             </classpath>
+ 			<class name="net.java.games.input.LinuxEventDevice"/>
+ 			<class name="net.java.games.input.LinuxJoystickDevice"/>
+--- ./plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java.orig	2007-06-10 09:03:27.000000000 -0600
++++ ./plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java	2012-02-02 09:08:54.380920130 -0700
+@@ -94,28 +94,6 @@ final class LinuxEventDevice implements
+ 	}
+ 
+ 	private final Controller.Type guessType() throws IOException {
+-		Controller.Type type_from_usages = guessTypeFromUsages();
+-		if (type_from_usages == Controller.Type.UNKNOWN)
+-			return guessTypeFromComponents();
+-		else
+-			return type_from_usages;
+-	}
+-	
+-	private final Controller.Type guessTypeFromUsages() throws IOException {
+-		byte[] usage_bits = getDeviceUsageBits();
+-		if (isBitSet(usage_bits, NativeDefinitions.USAGE_MOUSE))
+-			return Controller.Type.MOUSE;
+-		else if (isBitSet(usage_bits, NativeDefinitions.USAGE_KEYBOARD))
+-			return Controller.Type.KEYBOARD;
+-		else if (isBitSet(usage_bits, NativeDefinitions.USAGE_GAMEPAD))
+-			return Controller.Type.GAMEPAD;
+-		else if (isBitSet(usage_bits, NativeDefinitions.USAGE_JOYSTICK))
+-			return Controller.Type.STICK;
+-		else
+-			return Controller.Type.UNKNOWN;
+-	}
+-
+-	private final Controller.Type guessTypeFromComponents() throws IOException {
+ 		List components = getComponents();
+ 		if (components.size() == 0)
+ 			return Controller.Type.UNKNOWN;
+@@ -342,15 +320,6 @@ final class LinuxEventDevice implements
+ 	}
+ 	private final static native void nGetBits(long fd, int ev_type, byte[] evtype_bits) throws IOException;
+ 
+-	private final byte[] getDeviceUsageBits() throws IOException {
+-		byte[] bits = new byte[NativeDefinitions.USAGE_MAX/8 + 1];
+-		if (getVersion() >= 0x010001) {
+-			nGetDeviceUsageBits(fd, bits);
+-		}
+-		return bits;
+-	}
+-	private final static native void nGetDeviceUsageBits(long fd, byte[] type_bits) throws IOException;
+-
+ 	public final synchronized void pollKeyStates() throws IOException {
+ 		nGetKeyStates(fd, key_states);
+ 	}
+--- ./plugins/linux/src/native/net_java_games_input_LinuxEventDevice.c.orig	2006-04-29 16:29:27.000000000 -0600
++++ ./plugins/linux/src/native/net_java_games_input_LinuxEventDevice.c	2012-02-02 09:06:58.256751788 -0700
+@@ -112,20 +112,6 @@ JNIEXPORT jint JNICALL Java_net_java_gam
+ 	return num_effects;
+ }
+ 
+-JNIEXPORT void JNICALL Java_net_java_games_input_LinuxEventDevice_nGetDeviceUsageBits(JNIEnv *env, jclass unused, jlong fd_address, jbyteArray usages_array) {
+-#if EV_VERSION >= 0x010001
+-	int fd = (int)fd_address;
+-	jsize len = (*env)->GetArrayLength(env, usages_array);
+-	jbyte *usages = (*env)->GetByteArrayElements(env, usages_array, NULL);
+-	if (usages == NULL)
+-		return;
+-	int res = ioctl(fd, EVIOCGUSAGE(len), usages);
+-	(*env)->ReleaseByteArrayElements(env, usages_array, usages, 0);
+-	if (res == -1)
+-		throwIOException(env, "Failed to get device usages (%d)\n", errno);
+-#endif
+-}
+-
+ JNIEXPORT void JNICALL Java_net_java_games_input_LinuxEventDevice_nGetBits(JNIEnv *env, jclass unused, jlong fd_address, jint evtype, jbyteArray bits_array) {
+ 	int fd = (int)fd_address;
+ 	jsize len = (*env)->GetArrayLength(env, bits_array);
diff --git a/jinput.spec b/jinput.spec
new file mode 100644
index 0000000..e48449c
--- /dev/null
+++ b/jinput.spec
@@ -0,0 +1,137 @@
+Name:           jinput
+Version:        2.0.6
+Release:        1.20110801svn%{?dist}
+Summary:        Java Game Controller API
+
+Group:          Development/Libraries
+License:        BSD
+URL:            http://java.net/projects/jinput
+# Upstream only provides subversion checkout or nightly build.
+# Also, some (non-Linux) plugin code is non-free.  As long as we are deleting
+# non-free plugins, we also delete plugins for non-Linux operating systems.
+# Create the source tarball as follows:
+# svn export -r 247 https://svn.java.net/svn/jinput~svn/trunk jinput-2.0.6
+# rm -rf jinput-2.0.6/plugins/{OSX,windows,wintab}
+# tar cJf jinput-2.0.6.tar.xz jinput-2.0.6
+Source0:        %{name}-%{version}.tar.xz
+# Fedora-specific patch: will not be sent upstream.  Remove build.xml rules
+# for building non-free plugin code.
+Patch0:         001_jinput_build.patch
+# Fedora-specific patch: will not be sent upstream.  Do not strip the native
+# library.
+Patch1:         002_jinput_dontstripso.patch
+# Fedora-specific patch: will not be sent upstream.  Load the shared library
+# from the Fedora-mandated location.
+Patch2:         003_jinput_usesystemload.patch
+# Patch from http://java.net/jira/browse/JINPUT-44 to not access usage bits,
+# which are not supported in current Linux kernels
+Patch3:         004_jinput_usagebits.patch
+
+BuildRequires:  ant
+BuildRequires:  java-devel
+BuildRequires:  jpackage-utils
+BuildRequires:  jutils
+BuildRequires:  jutils-javadoc
+
+Requires:       java 
+Requires:       jpackage-utils
+Requires:       jutils
+
+%description
+jinput is an implementation of an API for game controller discovery and
+polled input.  It is part of a suite of open-source technologies
+initiated by the Game Technology Group at Sun Microsystems with the
+intention of making the development of high performance games in Java a
+reality.  The API itself is pure Java and presents a platform-neutral,
+completely portable model of controller discovery and polling.  It can
+handle arbitrary controllers and returns both human and machine
+understandable descriptions of the inputs available.
+
+%package javadoc
+Summary:        Javadocs for %{name}
+Group:          Documentation
+Requires:       %{name} = %{version}-%{release}
+Requires:       jutils-javadoc
+BuildArch:      noarch
+
+%description javadoc
+This package contains the API documentation for %{name}.
+
+%prep
+%setup -q
+%patch0
+%patch1
+%patch2
+%patch3
+
+# Don't use prebuilt jars
+rm -f lib/*.jar
+build-jar-repository -s -p lib jutils
+
+# Fix the version string in the POMs
+sed -i 's/@VERSION@/%{version}/' jinput.pom jinput-platform.pom
+
+# Use Fedora's CFLAGS
+sed -i "s/-O2 -Wall/$RPM_OPT_FLAGS/" plugins/linux/src/native/build.xml
+
+%build
+# Get the latest definitions from <linux/input.h>
+ant -f plugins/linux/src/native/build.xml createNativeDefinitions.java
+
+# Build
+ant dist
+
+# The ant target to build javadocs has several problems.  It looks for the
+# jutils jar in the wrong place.  It doesn't link to the jutils javadocs.
+# It creates distinct sets of javadoc pages for the coreAPI and for the
+# plugins, where we would like all of the pages to be in a single javadoc
+# package.  We can solve all but the last with a bit of judicious hacking in
+# the appropriate build.xml files, but that last point is difficult to address
+# without resulting in broken links from the plugin pages to the coreAPI pages.
+# Therefore, we throw up our hands in despair and do this instead:
+javadoc -d javadoc -classpath lib/jutils.jar:dist/jinput.jar -package \
+  -sourcepath plugins/awt/src:plugins/linux/src/java:coreAPI/src/java \
+  -link %{_javadocdir}/jutils net.java.games.input
+
+%install
+# jar
+install -Dp -m 644 dist/%{name}.jar \
+    $RPM_BUILD_ROOT%{_libdir}/%{name}/%{name}.jar
+
+# jni
+install -Dp -m 755 dist/libjinput* \
+    $RPM_BUILD_ROOT%{_libdir}/%{name}/libjinput.so
+
+# javadoc
+mkdir -p $RPM_BUILD_ROOT%{_javadocdir}
+cp -a javadoc $RPM_BUILD_ROOT%{_javadocdir}/%{name}
+
+# pom
+install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
+install -pm 644 jinput-platform.pom  \
+    $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}-platform.pom
+install -pm 644 jinput.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
+
+%add_to_maven_depmap JPP-%{name}.pom %{name}.jar
+%add_to_maven_depmap JPP-%{name}-platform.pom 
+
+%check
+ant versiontest
+
+%files
+%doc README.txt 
+%{_mavenpomdir}/*
+%{_mavendepmapfragdir}/*
+%{_libdir}/%{name}
+
+%files javadoc
+%{_javadocdir}/%{name}
+
+%changelog
+* Thu Feb  2 2012 Jerry James <loganjerry at gmail.com> - 2.0.6-1.20110801svn
+- Add patch for missing USAGE bits in the Linux kernel
+- Don't build the OSX plugin
+- Combine javadocs into one place and fix broken links
+
+* Tue Jul 19 2011 Guido Grazioli <guido.grazioli at gmail.com> - 2.0.6-1.20110719svn
+- Initial packaging
diff --git a/sources b/sources
index e69de29..f392747 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+da6176a38e76e0b0cbc974f469e7a77e  jinput-2.0.6.tar.xz


More information about the scm-commits mailing list