Linux: added support for 64 bit JVMs
This commit is contained in:
parent
8efeea4d53
commit
e2bbb739aa
|
@ -358,14 +358,14 @@
|
|||
</jar>
|
||||
|
||||
<!-- create each of the native jars -->
|
||||
<jar destfile="applet/win32_natives.jar" taskname="win32_natives.jar">
|
||||
<jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar">
|
||||
<fileset dir="${lwjgl.lib}/win32">
|
||||
<patternset refid="lwjgl-win32.fileset"/>
|
||||
<patternset refid="lwjgl-win32_optional.fileset"/>
|
||||
<include name="fmod.dll"/>
|
||||
</fileset>
|
||||
</jar>
|
||||
<signjar jar="applet/win32_natives.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/>
|
||||
<signjar jar="applet/windows_natives.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/>
|
||||
|
||||
<jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar">
|
||||
<fileset dir="${lwjgl.lib}/linux">
|
||||
|
@ -388,12 +388,12 @@
|
|||
<!-- add it to a natives jar -->
|
||||
<jar destfile="applet/natives.jar" taskname="natives.jar">
|
||||
<fileset dir="applet">
|
||||
<include name="win32_natives.jar"/>
|
||||
<include name="windows_natives.jar"/>
|
||||
<include name="linux_natives.jar"/>
|
||||
<include name="macosx_natives.jar"/>
|
||||
</fileset>
|
||||
</jar>
|
||||
<delete file="applet/win32_natives.jar"/>
|
||||
<delete file="applet/windows_natives.jar"/>
|
||||
<delete file="applet/linux_natives.jar"/>
|
||||
<delete file="applet/macosx_natives.jar"/>
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
<project name="lwjgl native code, linux" basedir="../../bin" default="compile">
|
||||
<property name="native" location="../src/native"/>
|
||||
<property name="libname" value="liblwjgl.so"/>
|
||||
<property name="libname32" value="liblwjgl.so"/>
|
||||
<property name="libname64" value="liblwjgl64.so"/>
|
||||
<property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lpthread -L${java.home}/lib/i386 -ljawt -Wl,-static,-lXxf86vm,-lXcursor,-lXrender,-lXrandr,-lXfixes,-call_shared"/>
|
||||
<property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lpthread -L${java.home}/lib/amd64 -ljawt -lXxf86vm -lXcursor -lXrender -lXrandr -lXfixes"/>
|
||||
<property name="cflags" value="-O2 -Wall -c -fPIC -std=c99 -pthread"/>
|
||||
|
@ -21,6 +22,9 @@
|
|||
<condition property="libs" value="${libs64}" else="${libs32}">
|
||||
<equals arg1="${hwplatform}" arg2="x86_64"/>
|
||||
</condition>
|
||||
<condition property="libname" value="${libname64}" else="${libname32}">
|
||||
<equals arg1="${hwplatform}" arg2="x86_64"/>
|
||||
</condition>
|
||||
<property name="linker_flags" value="-Wl,--version-script=${native}/linux/lwjgl.map -shared -O2 -Wall -o ${libname} ${libs}"/>
|
||||
<apply dir="." executable="cc" dest="." skipemptyfilesets="true" failonerror="true">
|
||||
<arg line="${cflags}"/>
|
||||
|
|
|
@ -46,6 +46,10 @@ abstract class DefaultSysImplementation implements SysImplementation {
|
|||
return 1000;
|
||||
}
|
||||
|
||||
public boolean has64Bit() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract long getTime();
|
||||
public abstract void alert(String title, String message);
|
||||
public abstract String getClipboard();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class LWJGLUtil {
|
|||
public static final int PLATFORM_WINDOWS = 3;
|
||||
public static final String PLATFORM_LINUX_NAME = "linux";
|
||||
public static final String PLATFORM_MACOSX_NAME = "macosx";
|
||||
public static final String PLATFORM_WINDOWS_NAME = "win32";
|
||||
public static final String PLATFORM_WINDOWS_NAME = "windows";
|
||||
|
||||
/** LWJGL Logo - 16 by 16 pixels */
|
||||
public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] {
|
||||
|
|
|
@ -71,4 +71,8 @@ class LinuxSysImplementation extends J2SESysImplementation {
|
|||
// Seems to have failed
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean has64Bit() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,8 +58,10 @@ public final class Sys {
|
|||
|
||||
/** The implementation instance to delegate platform specific behavior to */
|
||||
private final static SysImplementation implementation;
|
||||
|
||||
private final static String POSTFIX64BIT = "64";
|
||||
|
||||
private static void loadLibrary(final String lib_name) {
|
||||
private static void doLoadLibrary(final String lib_name) {
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
String library_path = System.getProperty("org.lwjgl.librarypath");
|
||||
|
@ -72,6 +74,21 @@ public final class Sys {
|
|||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void loadLibrary(final String lib_name) {
|
||||
try {
|
||||
loadLibrary(lib_name);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
if (implementation.has64Bit()) {
|
||||
try {
|
||||
loadLibrary(lib_name + POSTFIX64BIT);
|
||||
} catch (UnsatisfiedLinkError e2) {
|
||||
LWJGLUtil.log("Failed to load 64 bit library:" + e2.getMessage());
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -44,22 +44,28 @@ interface SysImplementation {
|
|||
/**
|
||||
* Return the version of the native library
|
||||
*/
|
||||
public String getNativeLibraryVersion();
|
||||
String getNativeLibraryVersion();
|
||||
|
||||
public void setDebug(boolean debug);
|
||||
void setDebug(boolean debug);
|
||||
|
||||
/**
|
||||
* Obtains the number of ticks that the hires timer does in a second.
|
||||
*
|
||||
* @return timer resolution in ticks per second or 0 if no timer is present.
|
||||
*/
|
||||
public long getTimerResolution();
|
||||
long getTimerResolution();
|
||||
|
||||
public long getTime();
|
||||
long getTime();
|
||||
|
||||
public void alert(String title, String message);
|
||||
void alert(String title, String message);
|
||||
|
||||
boolean openURL(String url);
|
||||
|
||||
public String getClipboard();
|
||||
String getClipboard();
|
||||
|
||||
/**
|
||||
* Returns true there exists a separate 64 bit library
|
||||
* on the platform
|
||||
*/
|
||||
boolean has64Bit();
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public class LWJGLInstaller {
|
|||
* the user's temp directory, and instruct the LWJGL subsystem to load its
|
||||
* native files from there.
|
||||
* The file required by the installer, is gotten from the classloader via its
|
||||
* getResource command, and is expected to be named <win32 | linux | macosx>_natives.jar.
|
||||
* getResource command, and is expected to be named <windows | linux | macosx>_natives.jar.
|
||||
* Note: Due to the nature of native libraries, we cannot actually uninstall the currently
|
||||
* loaded files, but rather the "last" installed. This means that the most recent install of LWJGL
|
||||
* will always be present in the users temp dir. When invoking the tempInstall method, all old installations
|
||||
|
|
Loading…
Reference in New Issue