diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index d861676cbd6..5860a647599 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -141,10 +141,7 @@ private fun Properties.defaultCompilerOpts(target: String, dependencies: String, val llvmHome = "$dependencies/$llvmHomeDir" val llvmVersion = this.getProperty("llvmVersion")!! - val dependencyList = mutableListOf(sysRoot, targetSysRoot, llvmHome) - if (target == "linux") { - dependencyList.add("$dependencies/${getOsSpecific("gccToolChain", target)!!}") - } + val dependencyList = getOsSpecific("dependencies", target)?.split(' ') ?: listOf() maybeExecuteHelper(dependencies, konanFileName, dependencyList) // StubGenerator passes the arguments to libclang which diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt index 29ac5d194b7..c32043c6541 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/Distribution.kt @@ -25,7 +25,8 @@ class Distribution(val config: CompilerConfiguration) { val lib = "$konanHome/lib/$target" // We can override dependency directory using konan.dependencies system property. - val dependencies = System.getProperty("konan.dependencies", "$konanHome/dependencies") + val dependenciesDir = System.getProperty("konan.dependencies", "$konanHome/dependencies") + val dependencies = properties.propertyList("dependencies.$suffix") val stdlib = "$lib/stdlib.kt.bc" val start = "$lib/start.kt.bc" @@ -33,12 +34,12 @@ class Distribution(val config: CompilerConfiguration) { val runtime = config.get(KonanConfigKeys.RUNTIME_FILE) ?: "$lib/runtime.bc" - val llvmHome = "$dependencies/${properties.propertyString("llvmHome.$suffix")}" - val sysRoot = "$dependencies/${properties.propertyString("sysRoot.$suffix")}" - val libGcc = "$dependencies/${properties.propertyString("libGcc.$suffix")}" + val llvmHome = "$dependenciesDir/${properties.propertyString("llvmHome.$suffix")}" + val sysRoot = "$dependenciesDir/${properties.propertyString("sysRoot.$suffix")}" + val libGcc = "$dependenciesDir/${properties.propertyString("libGcc.$suffix")}" val targetSysRoot = if (properties.hasProperty("targetSysRoot.$suffix")) { - "$dependencies/${properties.propertyString("targetSysRoot.$suffix")}" + "$dependenciesDir/${properties.propertyString("targetSysRoot.$suffix")}" } else { sysRoot } diff --git a/backend.native/konan.properties b/backend.native/konan.properties index c67c08fe828..0355fef6eb5 100644 --- a/backend.native/konan.properties +++ b/backend.native/konan.properties @@ -1,9 +1,9 @@ -// TODO: Do we need a $variable substitution mechanism here? +# TODO: Do we need a $variable substitution mechanism here? llvmVersion = 3.9.0 dependenciesUrl = https://jetbrains.bintray.com/kotlin-native-dependencies -// macbook +# macbook arch.osx = x86_64 sysRoot.osx = target-sysroot-1-darwin-macos llvmHome.osx = clang+llvm-3.9.0-darwin-macos @@ -13,8 +13,9 @@ linkerKonanFlags.osx = -lc++ linkerOptimizationFlags.osx = -dead_strip osVersionMin.osx = -macosx_version_min 10.10.0 entrySelector.osx = -alias _Konan_main _main +dependencies.osx = target-sysroot-1-darwin-macos clang+llvm-3.9.0-darwin-macos -// iphone +# iphone arch.osx-ios = arm64 sysRoot.osx-ios = target-sysroot-1-darwin-macos targetSysRoot.osx-ios = target-sysroot-2-darwin-ios @@ -25,8 +26,11 @@ linkerKonanFlags.osx-ios = -lc++ linkerOptimizationFlags.osx-ios = -dead_strip osVersionMin.osx-ios = -iphoneos_version_min 5.0.0 entrySelector.osx-ios = -alias _Konan_main _main +dependencies.osx-ios = target-sysroot-1-darwin-macos \ + clang+llvm-3.9.0-darwin-macos \ + target-sysroot-2-darwin-ios -// iphone_sim +# iphone_sim arch.osx-ios-sim = x86_64 sysRoot.osx-ios-sim = target-sysroot-1-darwin-macos targetSysRoot.osx-ios-sim = target-sysroot-1-darwin-ios-sim @@ -37,8 +41,11 @@ linkerKonanFlags.osx-ios-sim = -lc++ linkerOptimizationFlags.osx-ios-sim = -dead_strip osVersionMin.osx-ios-sim = -ios_simulator_version_min 5.0.0 entrySelector.osx-ios-sim = -alias _Konan_main _main +dependencies.osx-ios-sim = target-sysroot-1-darwin-macos \ + clang+llvm-3.9.0-darwin-macos \ + target-sysroot-1-darwin-ios-sim -// linux +# linux sysRoot.linux = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot llvmHome.linux = clang+llvm-3.9.0-linux-x86-64 libGcc.linux = target-gcc-toolchain-3-linux-x86-64/lib/gcc/x86_64-unknown-linux-gnu/4.8.5 @@ -49,8 +56,9 @@ linkerKonanFlags.linux = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lpthread linkerOptimizationFlags.linux = --gc-sections pluginOptimizationFlags.linux = -plugin-opt=mcpu=x86-64 -plugin-opt=O3 entrySelector.linux = --defsym main=Konan_main +dependencies.linux = clang+llvm-3.9.0-linux-x86-64 target-gcc-toolchain-3-linux-x86-64 -// Raspberry Pi +# Raspberry Pi arch.linux-raspberrypi = armv7 sysRoot.linux-raspberrypi = target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/sysroot targetSysRoot.linux-raspberrypi = target-sysroot-1-raspberrypi @@ -59,3 +67,6 @@ libGcc.linux-raspberrypi = target-sysroot-1-raspberrypi/lib/gcc/arm-linux-gnueab gccToolChain.linux-raspberrypi = target-gcc-toolchain-3-linux-x86-64 llvmLlcFlags.linux-raspberrypi = -mtriple=armv7-unknown-linux-gnueabihf --disable-fp-elim -mfloat-abi=hard linkerKonanFlags.linux-raspberrypi = -Bstatic -lstdc++ -Bdynamic -ldl -lm -lc -lpthread -fuse-ld=gold +dependencies.raspberrypi = clang+llvm-3.9.0-linux-x86-64 \ + target-gcc-toolchain-3-linux-x86-64 \ + target-sysroot-1-raspberrypi diff --git a/tools/helpers/src/main/kotlin/CompilerHelper0.kt b/tools/helpers/src/main/kotlin/CompilerHelper0.kt index c9f3f42ccc7..1e9652299f8 100644 --- a/tools/helpers/src/main/kotlin/CompilerHelper0.kt +++ b/tools/helpers/src/main/kotlin/CompilerHelper0.kt @@ -1,22 +1,11 @@ package org.jetbrains.kotlin.konan import org.jetbrains.kotlin.backend.konan.Distribution -import org.jetbrains.kotlin.backend.konan.KonanTarget -import org.jetbrains.kotlin.backend.konan.TargetManager import java.io.File class CompilerHelper0(val dist: Distribution): Runnable { override fun run() { - val dependencies = mutableListOf() - dependencies.add(dist.sysRoot) - dependencies.add(dist.llvmHome) - if (dist.sysRoot != dist.targetSysRoot) { - dependencies.add(dist.targetSysRoot) - } - if (TargetManager.host == KonanTarget.LINUX) { - dependencies.add(dist.libGcc) - } - DependencyDownloader(File(dist.dependencies), dist.properties.properties, dependencies).run() + DependencyDownloader(File(dist.dependenciesDir), dist.properties.properties, dist.dependencies).run() } } \ No newline at end of file diff --git a/tools/helpers/src/main/kotlin/InteropHelper0.kt b/tools/helpers/src/main/kotlin/InteropHelper0.kt index a00e7cc2a80..6e235da6fd6 100644 --- a/tools/helpers/src/main/kotlin/InteropHelper0.kt +++ b/tools/helpers/src/main/kotlin/InteropHelper0.kt @@ -1,6 +1,5 @@ package org.jetbrains.kotlin.konan -import org.jetbrains.kotlin.backend.konan.KonanProperties import java.io.File import java.util.*