commit:     7278f61cc96f4c79a1a50281f24ca2af3224211d
Author:     Philip Miess <Philip_Miess <AT> yahoo <DOT> com>
AuthorDate: Sun Mar 26 16:34:21 2023 +0000
Commit:     Philip Miess <Phil_miess <AT> yahoo <DOT> com>
CommitDate: Sun Mar 26 16:34:21 2023 +0000
URL:        
https://gitweb.gentoo.org/repo/user/superposition.git/commit/?id=7278f61c

resurrect jinput

Signed-off-by: Philip Miess <Philip_Miess <AT> yahoo.com>

 dev-java/jinput/Manifest                           |  7 ++
 dev-java/jinput/files/javah-classpath.patch        | 10 +++
 dev-java/jinput/files/nostrip.patch                | 12 +++
 .../jinput/files/remove-getDeviceUsageBits.patch   | 90 ++++++++++++++++++++++
 dev-java/jinput/files/unbundle.patch               | 10 +++
 dev-java/jinput/jinput-2.0.6-r1.ebuild             | 50 ++++++++++++
 dev-java/jinput/metadata.xml                       | 12 +++
 7 files changed, 191 insertions(+)

diff --git a/dev-java/jinput/Manifest b/dev-java/jinput/Manifest
new file mode 100644
index 0000000..eaf1aab
--- /dev/null
+++ b/dev-java/jinput/Manifest
@@ -0,0 +1,7 @@
+AUX javah-classpath.patch 469 BLAKE2B 
6cf9c5c6fb5048a074fd8e654cd4851779d1df9155ba81b7a38c716af1acda9eafc5e1fb2392cd05c9e2f14859daf93ec93fa5acf5d09784d3367a24f76af1a0
 SHA512 
a10b34e593980e24e0d9dbf0419cdacdb9c03059b54d3a811f3dadc8838d223cc3e4800feeb1ad0cf3b65d75117a0dbc7061740b40e051c683c4180a323bc916
+AUX nostrip.patch 431 BLAKE2B 
5633db9dd6cf803c8a960dbfa38dce803b247efe107d20430b41c24aad057041750e1f05af1cc2e26d3d4b241260a0a3cdc5d295d713ae91c1748487d3f4f760
 SHA512 
0f1cccfef58afca9c1db074ae179bc9d06c0ae758a859671e362c229279d2b3c570356ca2e06bd319f1ba6674f601f4fd15479adf1e1410779a52eec9e1172c9
+AUX remove-getDeviceUsageBits.patch 4109 BLAKE2B 
89518857ae50e74688fa1f9c0f493c8bcd34a0db44b39e5768c581019cced7d9c568813f3add70ba26eb42963291da9131238c9b3c96b703bd73e15897d55663
 SHA512 
e5d5a2c4715b00a08b909965079fffb2a0797a0a762481c76135692a66f208bc86b7610db525ed82997c90bb5c70f590ba1062833c00104b86112b0a1e0d6176
+AUX unbundle.patch 354 BLAKE2B 
87bbc929c3449e786c61810bd4f3ef2beeb9d8bd7efdc006afede6898a6608accea69a6a935ab383cd5d5689f4c0956367043c5d1f856486c379f0b2b997deb1
 SHA512 
99d933a2bf501fe209df2bdfe8dbc0f756b78715c322f6f4c605e40b96aa3773cb8592c52ac2d752e720245bbb310e7bcf52409e97a74e06175f3c995a55454e
+DIST jinput-2.0.6.tar.gz 1590738 BLAKE2B 
ceb296af7ca4309913708fac5c67c6fec9cd94ef3dad454c41a99ffee7e390545ab6424354dd0dc9755dfb4c0711b449b29b423b395c0f2f504a73d2d7019645
 SHA512 
770b3a0724334b9182098797923cc11e575b42cb67c5583d8aac7aeb432ec80189199daf1ef624a56923c4ecce271f05adf0481c13b8cd6997bb1862a7a91eba
+EBUILD jinput-2.0.6-r1.ebuild 1248 BLAKE2B 
0d9ee4df974c0dd4ae674a979346dd4db6f110618ff2ca61eb98803d97ccb2509dd229596881f54757c40746ade3b549154762e7a7913bf8cba41424cfc5f696
 SHA512 
5014f9d9ea1c4bb334d308b9fca7aeb5d411546a6846665c9976ab7be4dcf454fc3e2626bbe2b3af6b0cef3b12d951ce92c9827943e33d8fa321387285c70ab2
+MISC metadata.xml 657 BLAKE2B 
17302de7620eb88fba8aca2a04148cd31cb9176a0e2e539e3e181d68ca0e98f98c6a2a1a2fc254c16e2f19c4a8d206af893e80581c0be3f18c9280376868f08a
 SHA512 
2fa1026b4a776a5c527de51e4291b4cf12f58e0b526e329101b6c1cc9cd05b405919b4187b96b35c93977da3c8e80722984aff841d77a78d5e2ea6e6911073ac

diff --git a/dev-java/jinput/files/javah-classpath.patch 
b/dev-java/jinput/files/javah-classpath.patch
new file mode 100644
index 0000000..ae90584
--- /dev/null
+++ b/dev-java/jinput/files/javah-classpath.patch
@@ -0,0 +1,10 @@
+--- plugins/linux/build.xml.orig       2006-07-11 22:07:38.000000000 +0100
++++ plugins/linux/build.xml    2011-11-16 15:49:21.140789781 +0000
+@@ -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"/>

diff --git a/dev-java/jinput/files/nostrip.patch 
b/dev-java/jinput/files/nostrip.patch
new file mode 100644
index 0000000..8627c0d
--- /dev/null
+++ b/dev-java/jinput/files/nostrip.patch
@@ -0,0 +1,12 @@
+--- plugins/linux/src/native/build.xml.orig    2013-03-25 18:01:56.000000000 
+0000
++++ plugins/linux/src/native/build.xml 2015-04-12 17:36:36.020105790 +0100
+@@ -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/dev-java/jinput/files/remove-getDeviceUsageBits.patch 
b/dev-java/jinput/files/remove-getDeviceUsageBits.patch
new file mode 100644
index 0000000..038473d
--- /dev/null
+++ b/dev-java/jinput/files/remove-getDeviceUsageBits.patch
@@ -0,0 +1,90 @@
+From 3f8a5394be4cddfb5bec584170678aac0f28b763 Mon Sep 17 00:00:00 2001
+From: Endolf <[email protected]>
+Date: Fri, 22 Aug 2014 14:38:30 +0100
+Subject: [PATCH] Remove usage_bits call as it doesn't work on v3 kernels.
+
+---
+ .../net/java/games/input/LinuxEventDevice.java     | 32 ----------------------
+ .../native/net_java_games_input_LinuxEventDevice.c | 14 ----------
+ 2 files changed, 46 deletions(-)
+
+diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java 
b/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java
+index a28c4c7..41a4fee 100644
+--- a/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java
++++ b/plugins/linux/src/java/net/java/games/input/LinuxEventDevice.java
+@@ -94,34 +94,11 @@ private final static int countComponents(List components, 
Class id_type, boolean
+       }
+ 
+       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;
+               int num_rel_axes = countComponents(components, 
Component.Identifier.Axis.class, true);
+               int num_abs_axes = countComponents(components, 
Component.Identifier.Axis.class, false);
+-              int num_keys = countComponents(components, 
Component.Identifier.Key.class, false);
+               int mouse_traits = 0;
+               int keyboard_traits = 0;
+               int joystick_traits = 0;
+@@ -342,15 +319,6 @@ private final List getDeviceComponents() throws 
IOException {
+       }
+       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);
+       }
+diff --git a/plugins/linux/src/native/net_java_games_input_LinuxEventDevice.c 
b/plugins/linux/src/native/net_java_games_input_LinuxEventDevice.c
+index 90eff09..18913c2 100644
+--- a/plugins/linux/src/native/net_java_games_input_LinuxEventDevice.c
++++ b/plugins/linux/src/native/net_java_games_input_LinuxEventDevice.c
+@@ -112,20 +112,6 @@ JNIEXPORT jint JNICALL 
Java_net_java_games_input_LinuxEventDevice_nGetNumEffects
+       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/dev-java/jinput/files/unbundle.patch 
b/dev-java/jinput/files/unbundle.patch
new file mode 100644
index 0000000..1a86863
--- /dev/null
+++ b/dev-java/jinput/files/unbundle.patch
@@ -0,0 +1,10 @@
+--- build.xml.orig     2013-03-25 18:01:56.000000000 +0000
++++ build.xml  2015-04-12 17:11:45.869203820 +0100
+@@ -137,7 +137,6 @@
+                       <fileset dir="plugins/wintab/classes">
+                               <include name="**/*.class"/>
+                       </fileset>
+-                      <zipfileset src="lib/jutils.jar" includes="**/*.class"/>
+                       <manifest>
+                               <attribute name="Sealed" value="true"/>
+                       </manifest>

diff --git a/dev-java/jinput/jinput-2.0.6-r1.ebuild 
b/dev-java/jinput/jinput-2.0.6-r1.ebuild
new file mode 100644
index 0000000..c86fa33
--- /dev/null
+++ b/dev-java/jinput/jinput-2.0.6-r1.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+COMMIT="790b666"
+JAVA_PKG_IUSE="doc source"
+
+inherit epatch toolchain-funcs java-pkg-2 java-ant-2 vcs-snapshot
+
+DESCRIPTION="An implementation of an API for game controller discovery and 
polled input"
+HOMEPAGE="https://java.net/projects/jinput";
+SRC_URI="https://github.com/${PN}/${PN}/archive/${COMMIT}.tar.gz -> 
${P}.tar.gz"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+CDEPEND="dev-java/jutils:0"
+
+RDEPEND=">=virtual/jre-1.4
+       ${CDEPEND}"
+
+DEPEND=">=virtual/jdk-1.4
+       ${CDEPEND}"
+
+JAVA_PKG_BSFIX="off"
+EANT_BUILD_TARGET="dist"
+
+src_prepare() {
+       # http://java.net/jira/browse/JINPUT-44
+       # http://java.net/jira/browse/JINPUT-45
+       epatch 
"${FILESDIR}"/{javah-classpath,nostrip,remove-getDeviceUsageBits,unbundle}.patch
+
+       sed -i \
+               -e "s/\"cc\"/\"$(tc-getCC)\"/g" \
+               -e "s/-O[0-9]/${CFLAGS} ${LDFLAGS}/g" \
+               plugins/linux/src/native/build.xml || die
+
+       java-pkg_jar-from --into lib jutils
+}
+
+src_install() {
+       java-pkg_dojar dist/${PN}.jar
+       java-pkg_doso dist/lib${PN}-*.so
+
+       # Only core API docs, others would conflict.
+       use doc && java-pkg_dojavadoc coreAPI/apidocs
+       use source && java-pkg_dosrc */src/java/* */**/src/java/*
+}

diff --git a/dev-java/jinput/metadata.xml b/dev-java/jinput/metadata.xml
new file mode 100644
index 0000000..bf2bb95
--- /dev/null
+++ b/dev-java/jinput/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="project">
+    <email>[email protected]</email>
+    <name>Java</name>
+  </maintainer>
+  <longdescription>The JInput Project hosts 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 intention of making the development of high performance games 
in Java a reality.</longdescription>
+  <upstream>
+    <remote-id type="github">jinput/jinput</remote-id>
+  </upstream>
+</pkgmetadata>

Reply via email to