From edab17baf3d2fbc60760d13b7b3393cfc4912880 Mon Sep 17 00:00:00 2001 From: Butta Date: Fri, 6 Sep 2019 21:33:46 +0530 Subject: [PATCH] libllvm: don't add arch-specific rpath when natively compiling --- packages/libllvm/build.sh | 2 +- ...lang-lib-Driver-ToolChains-Linux.cpp.patch | 40 +++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/packages/libllvm/build.sh b/packages/libllvm/build.sh index 7bb16b1f4..abcc442ad 100644 --- a/packages/libllvm/build.sh +++ b/packages/libllvm/build.sh @@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://clang.llvm.org/ TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library" TERMUX_PKG_LICENSE="NCSA" TERMUX_PKG_VERSION=8.0.1 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SHA256=(44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7 70effd69f7a8ab249f66b0a68aba8b08af52aa2ab710dfb8a0fba102685b1646 9fba1e94249bd7913e8a6c3aadcb308b76c8c3d83c5ce36c99c3f34d73873d88 diff --git a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch b/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch index 7fd3ce02f..59e83f162 100644 --- a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch +++ b/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch @@ -1,34 +1,42 @@ --- tools/clang/lib/Driver/ToolChains/Linux.cpp.orig 2019-03-28 00:40:14.508554643 +0000 +++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2019-03-28 00:46:12.983564436 +0000 -@@ -314,6 +314,33 @@ +@@ -314,6 +314,41 @@ const std::string OSLibDir = getOSLibDir(Triple, Args); const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot); -+ ++ bool NativeBuild = true; ++ + if(IsAndroid) { -+ if (MultiarchTriple == llvm::sys::getDefaultTargetTriple()) { ++ if (MultiarchTriple == llvm::sys::getDefaultTargetTriple()) + addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/lib", Paths); ++ else ++ NativeBuild = false; ++ ++ if (Arch == llvm::Triple::aarch64) { ++ addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/aarch64-linux-android/lib", Paths); ++ addPathIfExists(D, SysRoot + "/system/lib64", Paths); ++ if (!NativeBuild) ++ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/aarch64-linux-android/lib"); + } -+ if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) { ++ else if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) { + addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/arm-linux-androideabi/lib", Paths); + addPathIfExists(D, SysRoot + "/system/lib", Paths); -+ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/arm-linux-androideabi/lib"); -+ } -+ if (Arch == llvm::Triple::x86) { -+ addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/i686-linux-android/lib", Paths); -+ addPathIfExists(D, SysRoot + "/system/lib", Paths); -+ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/i686-linux-android/lib"); ++ if (!NativeBuild) ++ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/arm-linux-androideabi/lib"); + } -+ if (Arch == llvm::Triple::x86_64) { ++ else if (Arch == llvm::Triple::x86_64) { + addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/x86_64-linux-android/lib", Paths); + addPathIfExists(D, SysRoot + "/system/lib64", Paths); -+ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/x86_64-linux-android/lib"); ++ if (!NativeBuild) ++ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/x86_64-linux-android/lib"); + } -+ if (Arch == llvm::Triple::aarch64) { -+ addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/aarch64-linux-android/lib", Paths); -+ addPathIfExists(D, SysRoot + "/system/lib64", Paths); -+ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/aarch64-linux-android/lib"); ++ else if (Arch == llvm::Triple::x86) { ++ addPathIfExists(D, SysRoot + "@TERMUX_PREFIX@/i686-linux-android/lib", Paths); ++ addPathIfExists(D, SysRoot + "/system/lib", Paths); ++ if (!NativeBuild) ++ ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/i686-linux-android/lib"); + } ++ + ExtraOpts.push_back("-rpath=@TERMUX_PREFIX@/lib"); + }