1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
Description: Modify the build scipts for being built in Debian
Author: Kai-Chung Yan ()
Last-Update: 2016-10-27
Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -32,9 +32,6 @@
repositories {
mavenDeployer {
if (project.hasProperty('release')) {
- repository(url: uri("https://gradle.artifactoryonline.com/gradle/libs-releases-local")) {
- authentication(userName: artifactoryUserName, password: artifactoryPassword)
- }
} else if (project.hasProperty('snapshot')) {
repository(url: uri("https://gradle.artifactoryonline.com/gradle/libs-snapshots-local")) {
authentication(userName: artifactoryUserName, password: artifactoryPassword)
@@ -91,47 +88,21 @@
model {
platforms {
- osx_i386 {
- architecture "i386"
- operatingSystem "osx"
- }
- osx_amd64 {
- architecture "amd64"
- operatingSystem "osx"
- }
- linux_i386 {
- architecture "i386"
- operatingSystem "linux"
- }
- linux_amd64 {
- architecture "amd64"
- operatingSystem "linux"
- }
- windows_i386 {
- architecture "i386"
- operatingSystem "windows"
- }
- windows_amd64 {
- architecture "amd64"
- operatingSystem "windows"
- }
- freebsd_i386 {
- architecture "i386"
- operatingSystem "freebsd"
- }
- freebsd_amd64 {
- architecture "amd64"
- operatingSystem "freebsd"
+ debian {
+ architecture "${"dpkg-architecture --query DEB_HOST_ARCH".execute().text}"
+ operatingSystem "${"dpkg-architecture --query DEB_HOST_ARCH_OS".execute().text}"
+ }
+ }
+ toolChains {
+ cxx(Gcc) {
+ //path '/usr/bin/c++'
+ target 'debian'
}
}
-
components {
nativePlatform(NativeLibrarySpec) {
baseName 'native-platform'
- // TODO - this should be the default. Figure out why this is not working
- $.platforms.each { p ->
- targetPlatform p.name
- }
+ targetPlatform 'debian'
sources {
cpp {
source.srcDirs = ['src/shared/cpp', 'src/main/cpp']
@@ -142,11 +113,7 @@
nativePlatformCurses(NativeLibrarySpec) {
baseName 'native-platform-curses'
- $.platforms.each { p ->
- if (!p.operatingSystem.windows) {
- targetPlatform p.name
- }
- }
+ targetPlatform 'debian'
sources {
cpp {
source.srcDirs = ['src/shared/cpp', 'src/curses/cpp']
@@ -165,7 +132,7 @@
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/darwin"
cppCompiler.args '-mmacosx-version-min=10.4'
linker.args '-mmacosx-version-min=10.4'
- } else if (targetPlatform.operatingSystem.linux) {
+ } else if (targetPlatform.operatingSystem.linux || targetPlatform.operatingSystem.name.contains('hurd')) {
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"
cppCompiler.args '-D_FILE_OFFSET_BITS=64'
@@ -173,14 +140,23 @@
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
linker.args "Shlwapi.lib", "Advapi32.lib"
- } else if (targetPlatform.operatingSystem.freeBSD) {
+ } else if (targetPlatform.operatingSystem.freeBSD || targetPlatform.operatingSystem.name.contains('bsd')) {
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', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/bsd"
}
cppCompiler.args "-I${nativeHeadersDir}"
tasks.withType(CppCompile) { task ->
task.dependsOn project.tasks.nativeHeaders
}
+ "${"dpkg-buildflags --get CXXFLAGS".execute().text}".split().each {
+ cppCompiler.args it
+ }
+ "${"dpkg-buildflags --get CPPFLAGS".execute().text}".split().each {
+ cppCompiler.args it
+ }
+ "${"dpkg-buildflags --get LDFLAGS".execute().text}".split().each {
+ linker.args it
+ }
}
// Using internal class here to make this simple
@@ -190,40 +166,6 @@
if (!buildable) {
return
}
-
- if (targetPlatform.operatingSystem.name in ['linux', 'freebsd'] && targetPlatform.architecture != arch) {
- // Native plugins don't detect whether multilib support is available or not. Assume not for now
- return
- }
-
- def variantName = targetPlatform.name.replace('_', '-')
- def taskName = "jar-${variantName}"
- def nativeJar = project.tasks.findByName(taskName)
- if (nativeJar == null) {
- nativeJar = project.tasks.create(taskName, Jar) {
- baseName = "native-platform-$variantName"
- }
- artifacts {
- jni nativeJar
- runtime nativeJar
- }
- def jniPom = deployer.addFilter(variantName) { artifact, file ->
- return file == nativeJar.archivePath
- }
- jniPom.groupId = project.group
- jniPom.artifactId = nativeJar.baseName
- jniPom.version = project.version
- jniPom.scopeMappings.mappings.clear()
- }
-
- binary.tasks.withType(LinkSharedLibrary) { builderTask ->
- nativeJar.into("net/rubygrapefruit/platform/$variantName") { from builderTask.outputFile }
- nativeJar.dependsOn builderTask
- }
- project.tasks.test {
- dependsOn nativeJar
- classpath.from nativeJar
- }
}
}
}
|