From 206246fc9d9d83812b65a349e34b1ae2a3e839b3 Mon Sep 17 00:00:00 2001 From: Butta Date: Thu, 17 Dec 2020 21:46:26 +0530 Subject: [PATCH] libllvm: update from 10.0.1 to 11.0.0 and merge lldb --- packages/libllvm/build.sh | 69 ++++++++----------- ...h => clang-lib-Driver-ToolChain.cpp.patch} | 6 +- ...clang-lib-Driver-ToolChains-Gnu.cpp.patch} | 5 +- ...ang-lib-Driver-ToolChains-Linux.cpp.patch} | 6 +- packages/libllvm/clang.subpackage.sh | 9 ++- ...patch => compiler-rt-CMakeLists.txt.patch} | 4 +- packages/libllvm/cxx-libm.patch | 6 +- .../libllvm/include-llvm-ADT-Triple.h.patch | 15 ---- packages/libllvm/lld.subpackage.sh | 1 + .../lldb-include-lldb-Host-Editline.h.patch | 13 ++++ ...t-posix-ProcessLauncherPosixFork.cpp.patch | 15 ++++ .../lldb-source-Utility-ArchSpec.cpp.patch} | 10 +-- packages/libllvm/lldb.subpackage.sh | 10 +++ ...lvm-tools-llvm-shlib-CMakeLists.txt.patch} | 4 +- packages/libllvm/llvm.subpackage.sh | 14 ++-- packages/libllvm/openmp-config-ix-m32.patch | 4 +- ...> openmp-runtime-src-CMakeLists.txt.patch} | 4 +- packages/lldb/Editline.h.patch | 14 ---- .../lldb/ProcessLauncherPosixFork.cpp.patch | 13 ---- packages/lldb/build.sh | 47 ------------- packages/lldb/cmakelists.txt.patch | 21 ------ .../lldb-tblgen-native.patch.beforehostbuild | 52 -------------- 22 files changed, 108 insertions(+), 234 deletions(-) rename packages/libllvm/{tools-clang-lib-Driver-ToolChain.cpp.patch => clang-lib-Driver-ToolChain.cpp.patch} (71%) rename packages/libllvm/{tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch => clang-lib-Driver-ToolChains-Gnu.cpp.patch} (71%) rename packages/libllvm/{tools-clang-lib-Driver-ToolChains-Linux.cpp.patch => clang-lib-Driver-ToolChains-Linux.cpp.patch} (85%) rename packages/libllvm/{projects-compiler-rt-CMakeLists.txt.patch => compiler-rt-CMakeLists.txt.patch} (86%) delete mode 100644 packages/libllvm/include-llvm-ADT-Triple.h.patch create mode 100644 packages/libllvm/lldb-include-lldb-Host-Editline.h.patch create mode 100644 packages/libllvm/lldb-source-Host-posix-ProcessLauncherPosixFork.cpp.patch rename packages/{lldb/ArchSpec.cpp.patch => libllvm/lldb-source-Utility-ArchSpec.cpp.patch} (55%) create mode 100644 packages/libllvm/lldb.subpackage.sh rename packages/libllvm/{tools-llvm-shlib-CMakeLists.txt.patch => llvm-tools-llvm-shlib-CMakeLists.txt.patch} (74%) rename packages/libllvm/{project-openmp-runtime-src-CMakeLists.txt.patch => openmp-runtime-src-CMakeLists.txt.patch} (77%) delete mode 100644 packages/lldb/Editline.h.patch delete mode 100644 packages/lldb/ProcessLauncherPosixFork.cpp.patch delete mode 100644 packages/lldb/build.sh delete mode 100644 packages/lldb/cmakelists.txt.patch delete mode 100644 packages/lldb/lldb-tblgen-native.patch.beforehostbuild diff --git a/packages/libllvm/build.sh b/packages/libllvm/build.sh index 64bfb7880..9d5823908 100644 --- a/packages/libllvm/build.sh +++ b/packages/libllvm/build.sh @@ -1,23 +1,10 @@ TERMUX_PKG_HOMEPAGE=https://clang.llvm.org/ TERMUX_PKG_DESCRIPTION="Modular compiler and toolchain technologies library" TERMUX_PKG_LICENSE="NCSA" -TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=10.0.1 -TERMUX_PKG_REVISION=4 -TERMUX_PKG_SHA256=(c5d8e30b57cbded7128d78e5e8dad811bff97a8d471896812f57fa99ee82cdf3 - f99afc382b88e622c689b6d96cadfa6241ef55dca90e87fc170352e12ddb2b24 - 591449e0aa623a6318d5ce2371860401653c48bb540982ccdd933992cb88df7a - d19f728c8e04fb1e94566c8d76aef50ec926cd2f95ef3bf1e0a5de4909b28b44 - d093782bcfcd0c3f496b67a5c2c997ab4b85816b62a7dd5b27026634ccf5c11a - d90dc8e121ca0271f0fd3d639d135bfaa4b6ed41e67bd6eb77808f72629658fa - d2fb0bb86b21db1f52402ba231da7c119c35c21dfb843c9496fe901f2d6aa25a) -TERMUX_PKG_SRCURL=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/clang-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/lld-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/openmp-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/clang-tools-extra-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/compiler-rt-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/polly-$TERMUX_PKG_VERSION.src.tar.xz) +TERMUX_PKG_MAINTAINER="@buttaface" +TERMUX_PKG_VERSION=11.0.0 +TERMUX_PKG_SHA256=b7b639fc675fa1c86dd6d0bc32267be9eb34451748d2efd03f674b773000e92b +TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-project-$TERMUX_PKG_VERSION.tar.xz TERMUX_PKG_HOSTBUILD=true TERMUX_PKG_RM_AFTER_INSTALL=" lib/libgomp.a @@ -33,6 +20,7 @@ TERMUX_PKG_REPLACES="gcc, libclang, libclang-dev, libllvm-dev" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DPYTHON_EXECUTABLE=$(which python3) -DLLVM_ENABLE_PIC=ON +-DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;compiler-rt;lld;lldb;openmp;polly -DLLVM_ENABLE_LIBEDIT=OFF -DLLVM_INCLUDE_TESTS=OFF -DCLANG_DEFAULT_CXX_STDLIB=libc++ @@ -40,6 +28,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF -DDEFAULT_SYSROOT=$(dirname $TERMUX_PREFIX) -DLLVM_LINK_LLVM_DYLIB=ON +-DLLDB_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/lldb-tblgen -DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/llvm-tblgen -DCLANG_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/clang-tblgen -DLIBOMP_ENABLE_SHARED=FALSE @@ -47,6 +36,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DLLVM_BINUTILS_INCDIR=$TERMUX_PREFIX/include -DLLVM_ENABLE_SPHINX=ON -DSPHINX_OUTPUT_MAN=ON +-DSPHINX_WARNINGS_AS_ERRORS=OFF -DLLVM_TARGETS_TO_BUILD=all -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=AVR;RISCV -DPERL_EXECUTABLE=$(which perl) @@ -65,41 +55,30 @@ TERMUX_PKG_HAS_DEBUG=false # cp: cannot stat '../src/projects/openmp/runtime/exports/common.min.50.ompt.optional/include/omp.h': No such file or directory # common.min.50.ompt.optional should be common.deb.50.ompt.optional when doing debug build -termux_step_post_get_source() { - if [ "$TERMUX_PKG_QUICK_REBUILD" = "false" ]; then - mv clang-${TERMUX_PKG_VERSION}.src tools/clang - mv clang-tools-extra-${TERMUX_PKG_VERSION}.src tools/clang/tools/extra - mv lld-${TERMUX_PKG_VERSION}.src tools/lld - mv openmp-${TERMUX_PKG_VERSION}.src projects/openmp - mv compiler-rt-${TERMUX_PKG_VERSION}.src projects/compiler-rt - mv polly-${TERMUX_PKG_VERSION}.src tools/polly - fi -} - termux_step_host_build() { termux_setup_cmake termux_setup_ninja - cmake -G Ninja $TERMUX_PKG_SRCDIR - ninja -j $TERMUX_MAKE_PROCESSES clang-tblgen llvm-tblgen + cmake -G Ninja -DLLVM_ENABLE_PROJECTS='clang;lldb' $TERMUX_PKG_SRCDIR/llvm + ninja -j $TERMUX_MAKE_PROCESSES clang-tblgen lldb-tblgen llvm-tblgen } termux_step_pre_configure() { if [ "$TERMUX_PKG_QUICK_REBUILD" = "false" ]; then - mkdir projects/openmp/runtime/src/android - cp $TERMUX_PKG_BUILDER_DIR/nl_types.h projects/openmp/runtime/src/android - cp $TERMUX_PKG_BUILDER_DIR/nltypes_stubs.cpp projects/openmp/runtime/src/android + mkdir openmp/runtime/src/android + cp $TERMUX_PKG_BUILDER_DIR/nl_types.h openmp/runtime/src/android + cp $TERMUX_PKG_BUILDER_DIR/nltypes_stubs.cpp openmp/runtime/src/android fi - export LLVM_DEFAULT_TARGET_TRIPLE=$TERMUX_HOST_PLATFORM + # Add unknown vendor, otherwise it screws with the default LLVM triple + # detection. + export LLVM_DEFAULT_TARGET_TRIPLE=${CCTERMUX_HOST_PLATFORM/-/-unknown-} export LLVM_TARGET_ARCH if [ $TERMUX_ARCH = "arm" ]; then LLVM_TARGET_ARCH=ARM elif [ $TERMUX_ARCH = "aarch64" ]; then LLVM_TARGET_ARCH=AArch64 - elif [ $TERMUX_ARCH = "i686" ]; then - LLVM_TARGET_ARCH=X86 - elif [ $TERMUX_ARCH = "x86_64" ]; then + elif [ $TERMUX_ARCH = "i686" ] || [ $TERMUX_ARCH = "x86_64" ]; then LLVM_TARGET_ARCH=X86 else termux_error_exit "Invalid arch: $TERMUX_ARCH" @@ -107,22 +86,30 @@ termux_step_pre_configure() { # see CMakeLists.txt and tools/clang/CMakeLists.txt TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_TARGET_ARCH=$LLVM_TARGET_ARCH" TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DLLVM_HOST_TRIPLE=$LLVM_DEFAULT_TARGET_TRIPLE" + export TERMUX_SRCDIR_SAVE=$TERMUX_PKG_SRCDIR + TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/llvm +} + +termux_step_post_configure() { + TERMUX_PKG_SRCDIR=$TERMUX_SRCDIR_SAVE } termux_step_post_make_install() { if [ $TERMUX_ARCH = "arm" ]; then - cp $TERMUX_PKG_SRCDIR/projects/openmp/runtime/exports/common/include/omp.h $TERMUX_PREFIX/include + cp $TERMUX_PKG_SRCDIR/openmp/runtime/exports/common/include/omp.h $TERMUX_PREFIX/include else - cp $TERMUX_PKG_SRCDIR/projects/openmp/runtime/exports/common.ompt.optional/include/omp.h $TERMUX_PREFIX/include + cp $TERMUX_PKG_SRCDIR/openmp/runtime/exports/common.ompt.optional/include/omp.h $TERMUX_PREFIX/include fi if [ "$TERMUX_CMAKE_BUILD" = Ninja ]; then - ninja docs-llvm-man + ninja docs-llvm-man docs-lldb-man docs-clang-man else - make docs-llvm-man + make docs-llvm-man docs-lldb-man docs-clang-man fi cp docs/man/* $TERMUX_PREFIX/share/man/man1 + cp tools/clang/docs/man/clang.1 $TERMUX_PREFIX/share/man/man1 + cp tools/lldb/docs/man/lldb.1 $TERMUX_PREFIX/share/man/man1 cd $TERMUX_PREFIX/bin for tool in clang clang++ cc c++ cpp gcc g++ ${TERMUX_HOST_PLATFORM}-{clang,clang++,gcc,g++,cpp}; do diff --git a/packages/libllvm/tools-clang-lib-Driver-ToolChain.cpp.patch b/packages/libllvm/clang-lib-Driver-ToolChain.cpp.patch similarity index 71% rename from packages/libllvm/tools-clang-lib-Driver-ToolChain.cpp.patch rename to packages/libllvm/clang-lib-Driver-ToolChain.cpp.patch index 4610fa8cc..4ca6fbe8e 100644 --- a/packages/libllvm/tools-clang-lib-Driver-ToolChain.cpp.patch +++ b/packages/libllvm/clang-lib-Driver-ToolChain.cpp.patch @@ -1,7 +1,7 @@ -diff --git a/tools/clang/lib/Driver/ToolChain.cpp b/tools/clang/lib/Driver/ToolChain.cpp +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 469ef62f1a9d..218f5af748f4 100644 ---- a/tools/clang/lib/Driver/ToolChain.cpp -+++ b/tools/clang/lib/Driver/ToolChain.cpp +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp @@ -374,6 +374,6 @@ StringRef ToolChain::getOSLibName() const { case llvm::Triple::Solaris: return "sunos"; diff --git a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch b/packages/libllvm/clang-lib-Driver-ToolChains-Gnu.cpp.patch similarity index 71% rename from packages/libllvm/tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch rename to packages/libllvm/clang-lib-Driver-ToolChains-Gnu.cpp.patch index df480ee26..10b1de096 100644 --- a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Gnu.cpp.patch +++ b/packages/libllvm/clang-lib-Driver-ToolChains-Gnu.cpp.patch @@ -1,6 +1,5 @@ -diff -u -r ../llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp ./tools/clang/lib/Driver/ToolChains/Gnu.cpp ---- ../llvm-5.0.0.src/tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-08-11 03:47:32.000000000 +0200 -+++ ./tools/clang/lib/Driver/ToolChains/Gnu.cpp 2017-09-10 20:14:54.636653647 +0200 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp 2017-08-11 03:47:32.000000000 +0200 ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp 2017-09-10 20:14:54.636653647 +0200 @@ -152,14 +152,11 @@ } } diff --git a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch b/packages/libllvm/clang-lib-Driver-ToolChains-Linux.cpp.patch similarity index 85% rename from packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch rename to packages/libllvm/clang-lib-Driver-ToolChains-Linux.cpp.patch index 0385ec02f..d719c58b3 100644 --- a/packages/libllvm/tools-clang-lib-Driver-ToolChains-Linux.cpp.patch +++ b/packages/libllvm/clang-lib-Driver-ToolChains-Linux.cpp.patch @@ -1,5 +1,5 @@ ---- tools/clang/lib/Driver/ToolChains/Linux.cpp.orig 2019-12-21 22:30:03.676720096 +0000 -+++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:34:42.941719383 +0000 +--- a/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:30:03.676720096 +0000 ++++ b/clang/lib/Driver/ToolChains/Linux.cpp 2019-12-21 22:34:42.941719383 +0000 @@ -374,7 +374,7 @@ // those searched. // FIXME: It's not clear whether we should use the driver's installed @@ -28,7 +28,7 @@ addPathIfExists(D, SysRoot + "/lib", Paths); - addPathIfExists(D, SysRoot + "/usr/lib", Paths); -+ bool nativeBuild = MultiarchTriple == llvm::sys::getDefaultTargetTriple(); ++ bool nativeBuild = MultiarchTriple == getMultiarchTriple(D, llvm::Triple(llvm::sys::getDefaultTargetTriple()), SysRoot); + if (nativeBuild || !IsAndroid) + addPathIfExists(D, SysRoot + "/usr/lib", Paths); + diff --git a/packages/libllvm/clang.subpackage.sh b/packages/libllvm/clang.subpackage.sh index ebfa92dc8..e715e5642 100644 --- a/packages/libllvm/clang.subpackage.sh +++ b/packages/libllvm/clang.subpackage.sh @@ -3,13 +3,19 @@ bin/c++ bin/cc bin/*clang* bin/*cpp +bin/diagtool +bin/find-all-symbols bin/*g++ bin/*gcc bin/git-clang-format +bin/hmaptool +bin/modularize +bin/pp-trace bin/scan-* include/clang* -include/omp.h +include/omp*.h lib/clang/*/include/*.h +lib/clang/*/include/*.modulemap lib/clang/*/include/openmp_wrappers/ lib/clang/*/include/ppc_wrappers/ lib/clang/*/include/cuda_wrappers/ @@ -19,6 +25,7 @@ lib/libomp.a libexec/ share/clang share/scan-* +share/man/man1/clang.1.gz share/man/man1/scan-* " TERMUX_SUBPKG_DESCRIPTION="C language frontend for LLVM" diff --git a/packages/libllvm/projects-compiler-rt-CMakeLists.txt.patch b/packages/libllvm/compiler-rt-CMakeLists.txt.patch similarity index 86% rename from packages/libllvm/projects-compiler-rt-CMakeLists.txt.patch rename to packages/libllvm/compiler-rt-CMakeLists.txt.patch index 6082a0f8f..9b3bf3655 100644 --- a/packages/libllvm/projects-compiler-rt-CMakeLists.txt.patch +++ b/packages/libllvm/compiler-rt-CMakeLists.txt.patch @@ -1,5 +1,5 @@ ---- ../projects-compiler-rt-CMakeLists.txt.orig 2020-09-22 14:12:54.771097201 +0000 -+++ ./projects/compiler-rt/CMakeLists.txt 2020-09-22 16:11:07.568559345 +0000 +--- a/compiler-rt/CMakeLists.txt 2020-09-22 14:12:54.771097201 +0000 ++++ b/compiler-rt/CMakeLists.txt 2020-09-22 16:11:07.568559345 +0000 @@ -182,6 +182,9 @@ elseif (FUCHSIA) set(${var}_LIBNAME "libc++") diff --git a/packages/libllvm/cxx-libm.patch b/packages/libllvm/cxx-libm.patch index 22258cee7..a4434782f 100644 --- a/packages/libllvm/cxx-libm.patch +++ b/packages/libllvm/cxx-libm.patch @@ -1,7 +1,7 @@ -diff --git a/tools/clang/lib/Driver/ToolChains/Gnu.cpp~ b/tools/clang/lib/Driver/ToolChains/Gnu.cpp +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp~ b/clang/lib/Driver/ToolChains/Gnu.cpp index 2ad4509..4d0b060 100644 ---- a/tools/clang/lib/Driver/ToolChains/Gnu.cpp~ -+++ b/tools/clang/lib/Driver/ToolChains/Gnu.cpp +--- a/clang/lib/Driver/ToolChains/Gnu.cpp~ ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -483,7 +483,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (OnlyLibstdcxxStatic) CmdArgs.push_back("-Bdynamic"); diff --git a/packages/libllvm/include-llvm-ADT-Triple.h.patch b/packages/libllvm/include-llvm-ADT-Triple.h.patch deleted file mode 100644 index 0eddc04e6..000000000 --- a/packages/libllvm/include-llvm-ADT-Triple.h.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h -index 926039ca5982..0e4b55733f5e 100644 ---- a/include/llvm/ADT/Triple.h -+++ b/include/llvm/ADT/Triple.h -@@ -666,6 +666,10 @@ public: - unsigned Env[3]; - getEnvironmentVersion(Env[0], Env[1], Env[2]); - -+ // If not specified, set a default Android API. -+ if (Env[0] == 0) -+ Env[0] = __ANDROID_API__; -+ - // 64-bit targets did not exist before API level 21 (Lollipop). - if (isArch64Bit() && Env[0] < 21) - Env[0] = 21; diff --git a/packages/libllvm/lld.subpackage.sh b/packages/libllvm/lld.subpackage.sh index 557b04435..d360d481d 100644 --- a/packages/libllvm/lld.subpackage.sh +++ b/packages/libllvm/lld.subpackage.sh @@ -1,5 +1,6 @@ TERMUX_SUBPKG_INCLUDE=" include/lld/ +lib/cmake/lld/ lib/liblld*.a bin/lld bin/lld-link diff --git a/packages/libllvm/lldb-include-lldb-Host-Editline.h.patch b/packages/libllvm/lldb-include-lldb-Host-Editline.h.patch new file mode 100644 index 000000000..511d165d9 --- /dev/null +++ b/packages/libllvm/lldb-include-lldb-Host-Editline.h.patch @@ -0,0 +1,13 @@ +diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h +index 356e8f734732..c717f7b0cebb 100644 +--- a/lldb/include/lldb/Host/Editline.h ++++ b/lldb/include/lldb/Host/Editline.h +@@ -43,7 +43,7 @@ + + #if defined(_WIN32) + #include "lldb/Host/windows/editlinewin.h" +-#elif !defined(__ANDROID__) ++#else + #include + #endif + diff --git a/packages/libllvm/lldb-source-Host-posix-ProcessLauncherPosixFork.cpp.patch b/packages/libllvm/lldb-source-Host-posix-ProcessLauncherPosixFork.cpp.patch new file mode 100644 index 000000000..16aa3a6b5 --- /dev/null +++ b/packages/libllvm/lldb-source-Host-posix-ProcessLauncherPosixFork.cpp.patch @@ -0,0 +1,15 @@ +diff --git a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +index 35482341d3e6..90daaf9ef16d 100644 +--- a/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp ++++ b/lldb/source/Host/posix/ProcessLauncherPosixFork.cpp +@@ -136,8 +136,10 @@ static void LLVM_ATTRIBUTE_NORETURN ChildFunc(int error_fd, + + if (info.GetFlags().Test(eLaunchFlagDebug)) { + // Do not inherit setgid powers. ++#if !defined(__ANDROID__) + if (setgid(getgid()) != 0) + ExitWithError(error_fd, "setgid"); ++#endif + + // HACK: + // Close everything besides stdin, stdout, and stderr that has no file diff --git a/packages/lldb/ArchSpec.cpp.patch b/packages/libllvm/lldb-source-Utility-ArchSpec.cpp.patch similarity index 55% rename from packages/lldb/ArchSpec.cpp.patch rename to packages/libllvm/lldb-source-Utility-ArchSpec.cpp.patch index 573e44c36..b4f31b521 100644 --- a/packages/lldb/ArchSpec.cpp.patch +++ b/packages/libllvm/lldb-source-Utility-ArchSpec.cpp.patch @@ -1,10 +1,12 @@ ---- source/Utility/ArchSpec.cpp.orig 2019-03-29 01:49:35.969953714 +0000 -+++ ./source/Utility/ArchSpec.cpp 2019-03-29 01:49:39.102006003 +0000 -@@ -197,7 +197,11 @@ +diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp +index c7b56a8385f7..01887e37eb38 100644 +--- a/lldb/source/Utility/ArchSpec.cpp ++++ b/lldb/source/Utility/ArchSpec.cpp +@@ -198,7 +198,11 @@ static const CoreDefinition g_core_definitions[] = { "i486"}, {eByteOrderLittle, 4, 1, 15, llvm::Triple::x86, ArchSpec::eCore_x86_32_i486sx, "i486sx"}, -+#ifndef __ANDROID__ ++#ifndef __ANDROID__ {eByteOrderLittle, 4, 1, 15, llvm::Triple::x86, ArchSpec::eCore_x86_32_i686, +#else + {eByteOrderLittle, 4, 1, 15, llvm::Triple::x86, ArchSpec::eCore_x86_32_i386, diff --git a/packages/libllvm/lldb.subpackage.sh b/packages/libllvm/lldb.subpackage.sh new file mode 100644 index 000000000..a7e3aa5df --- /dev/null +++ b/packages/libllvm/lldb.subpackage.sh @@ -0,0 +1,10 @@ +TERMUX_SUBPKG_INCLUDE=" +bin/lldb* +include/lldb/ +lib/liblldb.so +share/man/man1/lldb.1.gz +" +TERMUX_SUBPKG_DESCRIPTION="LLVM-based debugger" +TERMUX_SUBPKG_DEPENDS="libc++, libedit, libllvm, libxml2, ncurses-ui-libs" +TERMUX_SUBPKG_BREAKS="lldb-dev, lldb-static" +TERMUX_SUBPKG_REPLACES="lldb-dev, lldb-static" diff --git a/packages/libllvm/tools-llvm-shlib-CMakeLists.txt.patch b/packages/libllvm/llvm-tools-llvm-shlib-CMakeLists.txt.patch similarity index 74% rename from packages/libllvm/tools-llvm-shlib-CMakeLists.txt.patch rename to packages/libllvm/llvm-tools-llvm-shlib-CMakeLists.txt.patch index 94c6a33cc..8e9eaea04 100644 --- a/packages/libllvm/tools-llvm-shlib-CMakeLists.txt.patch +++ b/packages/libllvm/llvm-tools-llvm-shlib-CMakeLists.txt.patch @@ -1,5 +1,5 @@ ---- ./tools/llvm-shlib/CMakeLists.txt.orig 2019-03-20 21:24:00.144316380 +0000 -+++ ./tools/llvm-shlib/CMakeLists.txt 2019-03-20 21:25:26.117941452 +0000 +--- a/llvm/tools/llvm-shlib/CMakeLists.txt 2019-03-20 21:24:00.144316380 +0000 ++++ b/llvm/tools/llvm-shlib/CMakeLists.txt 2019-03-20 21:25:26.117941452 +0000 @@ -48,6 +48,7 @@ OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD") OR ("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia") diff --git a/packages/libllvm/llvm.subpackage.sh b/packages/libllvm/llvm.subpackage.sh index 78f09b2de..07c765920 100644 --- a/packages/libllvm/llvm.subpackage.sh +++ b/packages/libllvm/llvm.subpackage.sh @@ -1,5 +1,6 @@ TERMUX_SUBPKG_INCLUDE=" bin/bugpoint +bin/dsymutil bin/llc bin/lli bin/llvm* @@ -10,11 +11,12 @@ bin/sanstats bin/verify-uselistorder bin/yaml2obj share/opt-viewer -share/man/man1/llc.1 -share/man/man1/lli.1 +share/man/man1/llc.1.gz +share/man/man1/lli.1.gz share/man/man1/llvm* -share/man/man1/opt.1 -share/man/man1/bugpoint.1 -share/man/man1/tblgen.1 +share/man/man1/opt.1.gz +share/man/man1/bugpoint.1.gz +share/man/man1/dsymutil.1.gz +share/man/man1/tblgen.1.gz " -TERMUX_SUBPKG_DESCRIPTION="Modular compiler and toolchain technologies executables" +TERMUX_SUBPKG_DESCRIPTION="LLVM modular compiler and toolchain executables" diff --git a/packages/libllvm/openmp-config-ix-m32.patch b/packages/libllvm/openmp-config-ix-m32.patch index 7d572c07a..7c1d67720 100644 --- a/packages/libllvm/openmp-config-ix-m32.patch +++ b/packages/libllvm/openmp-config-ix-m32.patch @@ -1,5 +1,5 @@ ---- projects/openmp/runtime/cmake/config-ix.cmake.orig 2019-04-04 21:32:58.195143957 +0000 -+++ ./projects/openmp/runtime/cmake/config-ix.cmake 2019-04-04 21:33:43.999700683 +0000 +--- a/openmp/runtime/cmake/config-ix.cmake 2019-04-04 21:32:58.195143957 +0000 ++++ b/openmp/runtime/cmake/config-ix.cmake 2019-04-04 21:33:43.999700683 +0000 @@ -71,7 +71,6 @@ check_c_compiler_flag(-msse2 LIBOMP_HAVE_MSSE2_FLAG) check_c_compiler_flag(-ftls-model=initial-exec LIBOMP_HAVE_FTLS_MODEL_FLAG) diff --git a/packages/libllvm/project-openmp-runtime-src-CMakeLists.txt.patch b/packages/libllvm/openmp-runtime-src-CMakeLists.txt.patch similarity index 77% rename from packages/libllvm/project-openmp-runtime-src-CMakeLists.txt.patch rename to packages/libllvm/openmp-runtime-src-CMakeLists.txt.patch index a2a84faa9..12e698ffd 100644 --- a/packages/libllvm/project-openmp-runtime-src-CMakeLists.txt.patch +++ b/packages/libllvm/openmp-runtime-src-CMakeLists.txt.patch @@ -1,5 +1,5 @@ ---- ../../cache/llvm-project-20170507-release_600/openmp/runtime/src/CMakeLists.txt 2018-03-02 09:50:00.000000000 +0000 -+++ ./projects/openmp/runtime/src/CMakeLists.txt 2018-03-08 03:39:14.548490023 +0000 +--- a/openmp/runtime/src/CMakeLists.txt 2018-03-02 09:50:00.000000000 +0000 ++++ b/openmp/runtime/src/CMakeLists.txt 2018-03-08 03:39:14.548490023 +0000 @@ -50,6 +50,9 @@ if(${LIBOMP_USE_HWLOC}) include_directories(${LIBOMP_HWLOC_INSTALL_DIR}/include) diff --git a/packages/lldb/Editline.h.patch b/packages/lldb/Editline.h.patch deleted file mode 100644 index 1e4f399e8..000000000 --- a/packages/lldb/Editline.h.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../cache/lldb-6.0.0.src/include/lldb/Host/Editline.h 2017-05-25 20:12:30.000000000 +0000 -+++ ./include/lldb/Host/Editline.h 2018-04-13 09:51:29.606274657 +0000 -@@ -56,10 +56,9 @@ - - #if defined(_WIN32) - #include "lldb/Host/windows/editlinewin.h" --#elif !defined(__ANDROID__) --#include - #endif - -+#include - #include - #include - #include diff --git a/packages/lldb/ProcessLauncherPosixFork.cpp.patch b/packages/lldb/ProcessLauncherPosixFork.cpp.patch deleted file mode 100644 index cf426e4ad..000000000 --- a/packages/lldb/ProcessLauncherPosixFork.cpp.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- source/Host/posix/ProcessLauncherPosixFork.cpp.orig 2019-11-03 00:42:25.977205716 +0000 -+++ ./source/Host/posix/ProcessLauncherPosixFork.cpp 2019-11-03 00:43:11.313499292 +0000 -@@ -136,8 +136,8 @@ - - if (info.GetFlags().Test(eLaunchFlagDebug)) { - // Do not inherit setgid powers. -- if (setgid(getgid()) != 0) -- ExitWithError(error_fd, "setgid"); -+ // if (setgid(getgid()) != 0) -+ // ExitWithError(error_fd, "setgid"); - - // HACK: - // Close everything besides stdin, stdout, and stderr that has no file diff --git a/packages/lldb/build.sh b/packages/lldb/build.sh deleted file mode 100644 index 5833f991e..000000000 --- a/packages/lldb/build.sh +++ /dev/null @@ -1,47 +0,0 @@ -TERMUX_PKG_HOMEPAGE=https://lldb.llvm.org -TERMUX_PKG_DESCRIPTION="LLVM based debugger" -TERMUX_PKG_LICENSE="NCSA" -TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION=10.0.1 -TERMUX_PKG_SRCURL=(https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/lldb-$TERMUX_PKG_VERSION.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-$TERMUX_PKG_VERSION.src.tar.xz) -TERMUX_PKG_SHA256=(07abe87c25876aa306e73127330f5f37d270b6b082d50cc679e31b4fc02a3714 - c5d8e30b57cbded7128d78e5e8dad811bff97a8d471896812f57fa99ee82cdf3) -TERMUX_PKG_DEPENDS="libc++, libedit, libllvm, libxml2, ncurses-ui-libs" -TERMUX_PKG_BUILD_DEPENDS="libllvm-static" -TERMUX_PKG_BREAKS="lldb-dev, lldb-static" -TERMUX_PKG_REPLACES="lldb-dev, lldb-static" -TERMUX_PKG_HOSTBUILD=true -TERMUX_PKG_HAS_DEBUG=false -TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" --DLLDB_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/bin/lldb-tblgen --DLLVM_ENABLE_SPHINX=ON --DLLVM_ENABLE_TERMINFO=1 --DLLVM_LINK_LLVM_DYLIB=ON --DLLVM_DIR=$TERMUX_PREFIX/lib/cmake/llvm --DLLVM_TABLEGEN=$TERMUX_PKG_HOSTBUILD_DIR/llvm/bin/llvm-tblgen -" - -termux_step_host_build() { - termux_setup_cmake - termux_setup_ninja - - mkdir llvm - cd llvm - - cmake -G Ninja $TERMUX_PKG_SRCDIR/llvm-${TERMUX_PKG_VERSION}.src - ninja -j $TERMUX_MAKE_PROCESSES llvm-tblgen - - cd .. - cmake -G Ninja $TERMUX_PKG_SRCDIR -DLLDB_INCLUDE_TESTS=OFF \ - -DLLVM_DIR=$TERMUX_PKG_HOSTBUILD_DIR/llvm/lib/cmake/llvm - ninja -j $TERMUX_MAKE_PROCESSES lldb-tblgen -} - -termux_step_make() { - ninja -w dupbuild=warn -j $TERMUX_MAKE_PROCESSES all docs-lldb-man -} - -termux_step_post_make_install() { - cp $TERMUX_PKG_BUILDDIR/docs/man/lldb.1 $TERMUX_PREFIX/share/man/man1 -} diff --git a/packages/lldb/cmakelists.txt.patch b/packages/lldb/cmakelists.txt.patch deleted file mode 100644 index 55d311125..000000000 --- a/packages/lldb/cmakelists.txt.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- ./CMakeLists.txt.orig 2019-10-28 02:55:47.051030643 +0000 -+++ ./CMakeLists.txt 2019-10-28 02:55:59.659010243 +0000 -@@ -39,18 +39,6 @@ - add_subdirectory(scripts) - endif () - --if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE) -- set(LLVM_USE_HOST_TOOLS ON) -- include(CrossCompile) -- if (NOT NATIVE_LLVM_DIR OR NOT NATIVE_Clang_DIR) -- message(FATAL_ERROR -- "Crosscompiling standalone requires the variables NATIVE_{CLANG,LLVM}_DIR -- for building the native lldb-tblgen used during the build process.") -- endif() -- llvm_create_cross_target(lldb NATIVE "" Release -- -DLLVM_DIR=${NATIVE_LLVM_DIR} -- -DClang_DIR=${NATIVE_Clang_DIR}) --endif() - - add_subdirectory(utils/TableGen) - add_subdirectory(source) diff --git a/packages/lldb/lldb-tblgen-native.patch.beforehostbuild b/packages/lldb/lldb-tblgen-native.patch.beforehostbuild deleted file mode 100644 index 9af67b19b..000000000 --- a/packages/lldb/lldb-tblgen-native.patch.beforehostbuild +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 26cefbf3758b..78cd146aee7e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -103,7 +103,9 @@ endif() - # TableGen - add_subdirectory(utils/TableGen) - -+if(CMAKE_CROSSCOMPILING) - add_subdirectory(source) -+endif() - add_subdirectory(tools) - add_subdirectory(docs) - -diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake -index 1079a1636fa7..1049303b1242 100644 ---- a/cmake/modules/LLDBStandalone.cmake -+++ b/cmake/modules/LLDBStandalone.cmake -@@ -1,7 +1,9 @@ - option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) - - find_package(LLVM REQUIRED CONFIG HINTS ${LLVM_DIR} NO_CMAKE_FIND_ROOT_PATH) --find_package(Clang REQUIRED CONFIG HINTS ${Clang_DIR} ${LLVM_DIR}/../clang NO_CMAKE_FIND_ROOT_PATH) -+if(CMAKE_CROSSCOMPILING) -+ find_package(Clang REQUIRED CONFIG HINTS ${Clang_DIR} ${LLVM_DIR}/../clang NO_CMAKE_FIND_ROOT_PATH) -+endif() - - # We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc - set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules") -@@ -87,14 +90,22 @@ - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - endif() - -+if(CMAKE_CROSSCOMPILING) - set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "lldb misc") -+endif() - set_target_properties(intrinsics_gen PROPERTIES FOLDER "lldb misc") - - set(CMAKE_INCLUDE_CURRENT_DIR ON) -+if(CMAKE_CROSSCOMPILING) - include_directories( - "${CMAKE_BINARY_DIR}/include" - "${LLVM_INCLUDE_DIRS}" - "${CLANG_INCLUDE_DIRS}") -+else() -+include_directories( -+ "${CMAKE_BINARY_DIR}/include" -+ "${LLVM_INCLUDE_DIRS}") -+endif() - - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})