Merge pull request #5 from tinca/master
- first shot on FreeBSD support
This commit is contained in:
16
build.gradle
16
build.gradle
@@ -95,6 +95,14 @@ model {
|
|||||||
architecture "amd64"
|
architecture "amd64"
|
||||||
operatingSystem "windows"
|
operatingSystem "windows"
|
||||||
}
|
}
|
||||||
|
create("freebsd_i386") {
|
||||||
|
architecture "i386"
|
||||||
|
operatingSystem "freebsd"
|
||||||
|
}
|
||||||
|
create("freebsd_amd64") {
|
||||||
|
architecture "amd64"
|
||||||
|
operatingSystem "freebsd"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +112,7 @@ libraries {
|
|||||||
}
|
}
|
||||||
nativePlatformCurses {
|
nativePlatformCurses {
|
||||||
baseName 'native-platform-curses'
|
baseName 'native-platform-curses'
|
||||||
targetPlatforms "osx_i386", "osx_amd64", "linux_i386", "linux_amd64"
|
targetPlatforms "osx_i386", "osx_amd64", "linux_i386", "linux_amd64", "freebsd_i386", "freebsd_amd64"
|
||||||
binaries.all {
|
binaries.all {
|
||||||
linker.args "-lcurses"
|
linker.args "-lcurses"
|
||||||
}
|
}
|
||||||
@@ -124,6 +132,9 @@ libraries {
|
|||||||
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
|
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
|
||||||
cppCompiler.define("WIN32")
|
cppCompiler.define("WIN32")
|
||||||
linker.args "Shlwapi.lib", "Advapi32.lib"
|
linker.args "Shlwapi.lib", "Advapi32.lib"
|
||||||
|
} else if (targetPlatform.operatingSystem.name == "freebsd") {
|
||||||
|
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
|
||||||
|
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/freebsd"
|
||||||
}
|
}
|
||||||
cppCompiler.args "-I${nativeHeadersDir}"
|
cppCompiler.args "-I${nativeHeadersDir}"
|
||||||
tasks.withType(CppCompile) { task ->
|
tasks.withType(CppCompile) { task ->
|
||||||
@@ -214,7 +225,8 @@ mainPom.scopeMappings.mappings.clear()
|
|||||||
mainPom.withXml { provider ->
|
mainPom.withXml { provider ->
|
||||||
def node = provider.asNode()
|
def node = provider.asNode()
|
||||||
def deps = node.appendNode('dependencies')
|
def deps = node.appendNode('dependencies')
|
||||||
['osx-i386', 'osx-amd64', 'linux-amd64', 'linux-i386', 'windows-amd64', 'windows-i386'].each { platform ->
|
['osx-i386', 'osx-amd64', 'linux-amd64', 'linux-i386',
|
||||||
|
'windows-amd64', 'windows-i386', 'freebsd_i386', 'freebsd_amd64'].each { platform ->
|
||||||
def dep = deps.appendNode('dependency')
|
def dep = deps.appendNode('dependency')
|
||||||
dep.appendNode('groupId', project.group)
|
dep.appendNode('groupId', project.group)
|
||||||
dep.appendNode('artifactId', "native-platform-${platform}")
|
dep.appendNode('artifactId', "native-platform-${platform}")
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ public abstract class Platform {
|
|||||||
platform = new OsX64Bit();
|
platform = new OsX64Bit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (osName.contains("freebsd")) {
|
||||||
|
if (arch.equals("amd64")) {
|
||||||
|
platform = new FreeBSD64Bit();
|
||||||
|
}
|
||||||
|
else if (arch.equals("i386") || arch.equals("x86")) {
|
||||||
|
platform = new FreeBSD32Bit();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (platform == null) {
|
if (platform == null) {
|
||||||
platform = new Unsupported();
|
platform = new Unsupported();
|
||||||
}
|
}
|
||||||
@@ -200,6 +208,20 @@ public abstract class Platform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class FreeBSD32Bit extends Linux {
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "freebsd-i386";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class FreeBSD64Bit extends Linux {
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "freebsd-amd64";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static abstract class OsX extends Posix {
|
private static abstract class OsX extends Posix {
|
||||||
@Override
|
@Override
|
||||||
public <T extends NativeIntegration> T get(Class<T> type, NativeLibraryLoader nativeLibraryLoader) {
|
public <T extends NativeIntegration> T get(Class<T> type, NativeLibraryLoader nativeLibraryLoader) {
|
||||||
|
|||||||
Reference in New Issue
Block a user