From 06b1646605f0a83a7cce88ac6a8c220a077fc2e9 Mon Sep 17 00:00:00 2001 From: its-pointless Date: Mon, 28 Oct 2019 21:47:55 +1100 Subject: [PATCH] lldb fixes (#4468) --- packages/lldb/LLDBStandalone.cmake.patch | 16 ++++++++++++++++ packages/lldb/build.sh | 24 +++++++++++++++++------- packages/lldb/cmakelists.txt.patch | 21 +++++++++++++++++++++ scripts/build/ci/cirrus-ci_dispatcher.sh | 2 +- 4 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 packages/lldb/LLDBStandalone.cmake.patch create mode 100644 packages/lldb/cmakelists.txt.patch diff --git a/packages/lldb/LLDBStandalone.cmake.patch b/packages/lldb/LLDBStandalone.cmake.patch new file mode 100644 index 000000000..bc99b202f --- /dev/null +++ b/packages/lldb/LLDBStandalone.cmake.patch @@ -0,0 +1,16 @@ +--- cmake/modules/LLDBStandalone.cmake.orig 2019-10-28 03:16:27.880770642 +0000 ++++ ./cmake/modules/LLDBStandalone.cmake 2019-10-28 03:16:53.936718250 +0000 +@@ -32,12 +32,7 @@ + set(LLVM_DEFAULT_EXTERNAL_LIT ${lit_full_path} CACHE PATH "Path to llvm-lit") + + if(CMAKE_CROSSCOMPILING) +- set(LLVM_NATIVE_BUILD "${LLVM_BINARY_DIR}/NATIVE") +- if (NOT EXISTS "${LLVM_NATIVE_BUILD}") +- message(FATAL_ERROR +- "Attempting to cross-compile LLDB standalone but no native LLVM build +- found. Please cross-compile LLVM as well.") +- endif() ++ set(LLVM_NATIVE_BUILD "${LLVM_BINARY_DIR}/") + + if (CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(HOST_EXECUTABLE_SUFFIX ".exe") diff --git a/packages/lldb/build.sh b/packages/lldb/build.sh index 7a1705972..0a21eb024 100644 --- a/packages/lldb/build.sh +++ b/packages/lldb/build.sh @@ -5,8 +5,9 @@ TERMUX_PKG_VERSION=9.0.0 TERMUX_PKG_SRCURL=https://releases.llvm.org/$TERMUX_PKG_VERSION/lldb-$TERMUX_PKG_VERSION.src.tar.xz TERMUX_PKG_SHA256=1e4c2f6a1f153f4b8afa2470d2e99dab493034c1ba8b7ffbbd7600de016d0794 TERMUX_PKG_DEPENDS="libc++, libedit, libllvm, libxml2, ncurses-ui-libs" -TERMUX_PKG_BREAKS="lldb-dev" -TERMUX_PKG_REPLACES="lldb-dev" +TERMUX_PKG_BUILD_DEPENDS="libllvm-static" +TERMUX_PKG_BREAKS="lldb-dev, lldb-static" +TERMUX_PKG_REPLACES="lldb-dev, lldb-static" TERMUX_PKG_HAS_DEBUG=false TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DLLDB_DISABLE_CURSES=0 @@ -15,15 +16,24 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" -DLLVM_CONFIG=$TERMUX_PREFIX/bin/llvm-config -DLLVM_ENABLE_TERMINFO=1 -DLLVM_LINK_LLVM_DYLIB=ON +-DLLVM_DIR=$TERMUX_PREFIX/lib/cmake/llvm +-DClang_DIR=$TERMUX_PREFIX/lib/cmake/clang +-DLLVM_NATIVE_BUILD=$TERMUX_PREFIX/bin " - -# Can't be compiled for x86_64 due to 'llvm-tblgen' error. -TERMUX_PKG_BLACKLISTED_ARCHES="x86_64" - termux_step_pre_configure() { - LDFLAGS+=" -Wl,--exclude-libs=libLLVMSupport.a" + cd $TERMUX_PKG_TMPDIR + termux_download https://its-pointless.github.io/tblgen-llvm-lldb-9.tar.xz tblgen-llvm-lldb-9.tar.xz \ + 0022ca75adeeda6c87f0fde352888e7a55747de05bc93035c2172535bb35f6c5 + tar xvf tblgen-llvm-lldb-9.tar.xz + mv llvm-tblgen $TERMUX_PREFIX/bin + PATH=$PATH:$TERMUX_PKG_TMPDIR + if [ $TERMUX_ARCH = "x86_64" ]; then + export LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/ + fi + touch $TERMUX_PREFIX/bin/clang-import-test } termux_step_post_make_install() { cp $TERMUX_PKG_SRCDIR/docs/lldb.1 $TERMUX_PREFIX/share/man/man1 + rm -f $TERMUX_PREFIX/bin/llvm-tblgen $TERMUX_PREFIX/bin/clang-import-test } diff --git a/packages/lldb/cmakelists.txt.patch b/packages/lldb/cmakelists.txt.patch new file mode 100644 index 000000000..55d311125 --- /dev/null +++ b/packages/lldb/cmakelists.txt.patch @@ -0,0 +1,21 @@ +--- ./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/scripts/build/ci/cirrus-ci_dispatcher.sh b/scripts/build/ci/cirrus-ci_dispatcher.sh index 161b1ddcc..812622123 100755 --- a/scripts/build/ci/cirrus-ci_dispatcher.sh +++ b/scripts/build/ci/cirrus-ci_dispatcher.sh @@ -6,7 +6,7 @@ set -e ## Some packages should be excluded from auto builds. -EXCLUDED_PACKAGES="lldb texlive" +EXCLUDED_PACKAGES="texlive" ############################################################################### ##