initial support for Solaris

This commit is contained in:
Adam
2012-08-06 13:48:40 +10:00
parent 5853d69ab5
commit 3cf9618427
4 changed files with 25 additions and 4 deletions

View File

@@ -32,10 +32,14 @@ libraries {
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"]) includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"])
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"]) includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"])
args("/DWIN32") args("/DWIN32")
} else { } else if (org.gradle.internal.os.OperatingSystem.current().linux) {
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"]) includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"])
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"]) includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"])
args("-lcurses") args("-lcurses")
} else {
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include"])
includes(["${org.gradle.internal.jvm.Jvm.current().javaHome}/include/solaris"])
args("-DSOLARIS", "-lcurses")
} }
} }
} }

View File

@@ -1,5 +1,4 @@
Provides Java bindings for various native APIs. Provides Java bindings for various native APIs.
# Available bindings # Available bindings
@@ -42,6 +41,10 @@ You need to install Visual studio, and build from a Visual studio command prompt
The g++ compiler is required to build the native library. You will need to install the XCode tools. The g++ compiler is required to build the native library. You will need to install the XCode tools.
## Solaris
For Solaris 11, you need to install the `gcc-45` and `system/header` packages.
# TODO # TODO
* Fix TERM=dumb * Fix TERM=dumb

View File

@@ -92,7 +92,13 @@ Java_net_rubygrapefruit_platform_internal_jni_PosixTerminalFunctions_getTerminal
int current_terminal = -1; int current_terminal = -1;
int write_to_terminal(int ch) { #ifdef SOLARIS
#define TERMINAL_CHAR_TYPE char
#else
#define TERMINAL_CHAR_TYPE int
#endif
int write_to_terminal(TERMINAL_CHAR_TYPE ch) {
write(current_terminal, &ch, 1); write(current_terminal, &ch, 1);
} }

View File

@@ -13,6 +13,8 @@ public abstract class Platform {
platform = new Linux(); platform = new Linux();
} else if (osName.contains("os x")) { } else if (osName.contains("os x")) {
platform = new OsX(); platform = new OsX();
} else if (osName.contains("sunos")) {
platform = new Solaris();
} else { } else {
platform = new Unsupported(); platform = new Unsupported();
} }
@@ -54,13 +56,19 @@ public abstract class Platform {
} }
} }
private static class Linux extends Posix { private static class Unix extends Posix {
@Override @Override
public String getLibraryName() { public String getLibraryName() {
return "libnative-platform.so"; return "libnative-platform.so";
} }
} }
private static class Linux extends Unix {
}
private static class Solaris extends Unix {
}
private static class OsX extends Posix { private static class OsX extends Posix {
@Override @Override
public String getLibraryName() { public String getLibraryName() {