build: download llvm and libffi from the JFrog repo

This commit is contained in:
Svyatoslav Scherbina
2016-10-17 17:35:25 +03:00
parent 7ed9d9c633
commit e4bc19b145
9 changed files with 30 additions and 25 deletions
+2 -2
View File
@@ -24,11 +24,11 @@ model {
binaries.all { binaries.all {
cCompiler.args compilerArgsForJniIncludes cCompiler.args compilerArgsForJniIncludes
cCompiler.args "-I$llvmInstallPath/include" cCompiler.args "-I$llvmDir/include"
} }
binaries.withType(SharedLibraryBinarySpec) { binaries.withType(SharedLibraryBinarySpec) {
linker.args "-L$llvmInstallPath/lib", "-lclang" linker.args "-L$llvmDir/lib", "-lclang"
} }
} }
} }
+2 -3
View File
@@ -23,10 +23,9 @@ model {
} }
binaries.all { binaries.all {
cCompiler.args compilerArgsForJniIncludes cCompiler.args compilerArgsForJniIncludes
cCompiler.args "-I$ffiIncludePath" cCompiler.args "-I$libffiDir/include"
String libffiPicPath = "$ffiLibPath/libffi_pic.a" linker.args "$libffiDir/lib/libffi.a"
linker.args file(libffiPicPath).exists() ? libffiPicPath : "$ffiLibPath/libffi.a"
} }
} }
} }
+2 -2
View File
@@ -19,8 +19,8 @@ repositories {
kotlinNativeInterop { kotlinNativeInterop {
llvm { llvm {
defFile '../backend.native/llvm.def' defFile '../backend.native/llvm.def'
compilerOpts "-I$llvmInstallPath/include" compilerOpts "-I$llvmDir/include"
linkerOpts "-L$llvmInstallPath/lib" linkerOpts "-L$llvmDir/lib"
} }
} }
+2 -2
View File
@@ -36,8 +36,8 @@ sourceSets {
kotlinNativeInterop { kotlinNativeInterop {
llvm { llvm {
defFile 'llvm.def' defFile 'llvm.def'
compilerOpts "-I$llvmInstallPath/include" compilerOpts "-I$llvmDir/include"
linkerOpts "-L$llvmInstallPath/lib" linkerOpts "-L$llvmDir/lib"
} }
hash { // TODO: copy-pasted from ':common:compileHash' hash { // TODO: copy-pasted from ':common:compileHash'
@@ -70,7 +70,7 @@ class CompileCppToBitcode extends DefaultTask {
project.exec { project.exec {
workingDir objDir workingDir objDir
executable "$project.llvmInstallPath/bin/clang++" executable "$project.llvmDir/bin/clang++"
args '-std=c++11' args '-std=c++11'
args compilerArgs args compilerArgs
@@ -82,7 +82,7 @@ class CompileCppToBitcode extends DefaultTask {
} }
project.exec { project.exec {
executable "$project.llvmInstallPath/bin/llvm-link" executable "$project.llvmDir/bin/llvm-link"
args project.fileTree(objDir).include('**/*.bc') args project.fileTree(objDir).include('**/*.bc')
args linkerArgs args linkerArgs
@@ -141,10 +141,10 @@ class NamedNativeInteropConfig extends AbstractFileCollection implements Named {
new File(project.findProject(":Interop:Indexer").buildDir, "nativelibs"), new File(project.findProject(":Interop:Indexer").buildDir, "nativelibs"),
new File(project.findProject(":Interop:Runtime").buildDir, "nativelibs") new File(project.findProject(":Interop:Runtime").buildDir, "nativelibs")
).asPath ).asPath
systemProperties "llvmInstallPath" : project.llvmInstallPath systemProperties "llvmInstallPath" : project.llvmDir
environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1" environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1"
environment "DYLD_LIBRARY_PATH": "${project.llvmInstallPath}/lib" environment "DYLD_LIBRARY_PATH": "${project.llvmDir}/lib"
environment "LD_LIBRARY_PATH": "${project.llvmInstallPath}/lib" environment "LD_LIBRARY_PATH": "${project.llvmDir}/lib"
outputs.dir generatedSrcDir outputs.dir generatedSrcDir
outputs.dir nativeLibsDir outputs.dir nativeLibsDir
+9
View File
@@ -75,6 +75,15 @@ class TgzNativeDep extends NativeDep {
} }
task libffi(type: TgzNativeDep) {
baseName = "libffi-3.2.1-${target}"
}
task llvm(type: TgzNativeDep) {
baseName = "clang+llvm-3.8.0-${target}"
}
task update { task update {
dependsOn tasks.withType(NativeDep) dependsOn tasks.withType(NativeDep)
} }
-3
View File
@@ -1,4 +1 @@
kotlin_version=1.0.4 kotlin_version=1.0.4
llvmInstallPath=/opt/local/libexec/llvm-3.8
ffiIncludePath=/opt/local/lib/libffi-3.2.1/include
ffiLibPath=/opt/local/lib
+8 -8
View File
@@ -17,15 +17,15 @@ task test {
doLast { doLast {
exec { exec {
commandLine "$llvmInstallPath/bin/clang", 'src/test/c/main.c', '-c', '-emit-llvm', '-o', "$buildDir/main.bc" commandLine "$llvmDir/bin/clang", 'src/test/c/main.c', '-c', '-emit-llvm', '-o', "$buildDir/main.bc"
} }
exec { exec {
commandLine "$llvmInstallPath/bin/clang++", build.outFile, "$buildDir/main.bc", '-o', "$buildDir/main" commandLine "$llvmDir/bin/clang++", build.outFile, "$buildDir/main.bc", '-o', "$buildDir/main"
} }
exec { exec {
workingDir buildDir workingDir buildDir
commandLine './main' commandLine './main'
} }
} }
} }