diff options
Diffstat (limited to 'plugins/linux')
-rw-r--r-- | plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java | 15 | ||||
-rw-r--r-- | plugins/linux/src/native/build.xml | 18 |
2 files changed, 25 insertions, 8 deletions
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java index 7ad3439..d4f7f31 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxEnvironmentPlugin.java @@ -39,12 +39,25 @@ import java.security.PrivilegedAction; * @author Jeremy Booth ([email protected]) */ public final class LinuxEnvironmentPlugin extends ControllerEnvironment implements Plugin { + private final static String LIBNAME = "jinput-linux"; + private final static String POSTFIX64BIT = "64"; + private final Controller[] controllers; private final List devices = new ArrayList(); private final static LinuxDeviceThread device_thread = new LinuxDeviceThread(); static { - DefaultControllerEnvironment.loadLibrary("jinput-linux"); + try { + DefaultControllerEnvironment.loadLibrary(LIBNAME); + } catch (UnsatisfiedLinkError e) { + try { + DefaultControllerEnvironment.loadLibrary(LIBNAME + POSTFIX64BIT); + } catch (UnsatisfiedLinkError e2) { + ControllerEnvironment.logln("Failed to load 64 bit library: " + e2.getMessage()); + // throw original error + throw e; + } + } } public final static Object execute(LinuxDeviceTask task) throws IOException { diff --git a/plugins/linux/src/native/build.xml b/plugins/linux/src/native/build.xml index c323163..c88a6ef 100644 --- a/plugins/linux/src/native/build.xml +++ b/plugins/linux/src/native/build.xml @@ -6,12 +6,10 @@ <!-- The idea is that both Ant and NetBeans have to know what the package root is --> <!-- for the classes in your application. --> <project name="JInput Linux port, Native code" basedir="." default="compileNativeJinputLib"> - <property name="libname" value="libjinput-linux.so"/> + <property name="libname64" value="libjinput-linux64.so"/> + <property name="libname32" value="libjinput-linux.so"/> - <target name="init"> - </target> - - <target depends="init" name="createNativeDefinitions.java"> + <target name="createNativeDefinitions.java"> <exec dir="." executable="gawk" os="Linux" output="../java/net/java/games/input/NativeDefinitions.java"> <arg line="-f"/> <arg line="getDefinitions"/> @@ -22,11 +20,17 @@ <target name="clean"> <delete> <fileset dir="." includes="*.o"/> - <fileset file="${libname}"/> + <fileset dir="." includes="*.so"/> </delete> </target> - <target name="compileNativeJinputLib" depends="init"> + <target name="compileNativeJinputLib"> + <exec executable="uname" outputproperty="hwplatform"> + <arg value="-i"/> + </exec> + <condition property="libname" value="${libname64}" else="${libname32}"> + <equals arg1="${hwplatform}" arg2="x86_64"/> + </condition> <apply dir="." executable="cc" os="Linux" dest="." skipemptyfilesets="true" failonerror="true"> <arg line="-O2 -Wall -c -fPIC"/> <arg value="-I${java.home}/include"/> |