From f0447d63adb4100d855ff6d3958a25adfd31ae3a Mon Sep 17 00:00:00 2001 From: "Nichols A. Romero" Date: Fri, 25 Aug 2023 17:46:33 -0500 Subject: [PATCH] llvm: fix `+lldb` optional deps and add `lua` variant (#39579) * llvm: fix +lldb optional deps, add lua variant * use good old conflicts --------- Co-authored-by: Harmen Stoppels --- .../repos/builtin/packages/llvm/package.py | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 63826fc6c9..e8a013b249 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -221,6 +221,7 @@ class Llvm(CMakePackage, CudaPackage): description="Enable code-signing on macOS", ) variant("python", default=False, description="Install python bindings") + variant("lua", default=True, description="Enable lua scripting inside lldb") variant("version_suffix", default="none", description="Add a symbol suffix") variant( "shlib_symbol_version", @@ -231,6 +232,8 @@ class Llvm(CMakePackage, CudaPackage): variant("z3", default=False, description="Use Z3 for the clang static analyzer") conflicts("+z3", when="@:7") conflicts("+z3", when="~clang") + conflicts("+lua", when="@:10") + conflicts("+lua", when="~lldb") variant( "zstd", @@ -289,13 +292,24 @@ class Llvm(CMakePackage, CudaPackage): depends_on("zstd build_system=cmake", when="+zstd") # lldb dependencies - with when("+lldb +python"): - depends_on("swig") + with when("+lldb"): + depends_on("libedit") + depends_on("libxml2") + depends_on("lua@5.3", when="+lua") # purposefully not a range + depends_on("ncurses") + depends_on("py-six", when="+python") + depends_on("swig", when="+lua") + depends_on("swig", when="+python") + depends_on("xz") + + # Use ^swig cause it's triggered by both python & lua scripting in lldb + with when("^swig"): depends_on("swig@2:", when="@10:") depends_on("swig@3:", when="@12:") - depends_on("libedit", when="+lldb") - depends_on("ncurses", when="+lldb") - depends_on("py-six", when="+lldb+python") + depends_on("swig@4:", when="@17:") + # Commits f0a25fe0b746f56295d5c02116ba28d2f965c175 and + # 81fc5f7909a4ef5a8d4b5da2a10f77f7cb01ba63 fixed swig 4.1 support + depends_on("swig@:4.0", when="@:15") # gold support, required for some features depends_on("binutils+gold+ld+plugins+headers", when="+gold") @@ -798,13 +812,19 @@ def cmake_args(self): if "+lldb" in spec: projects.append("lldb") - cmake_args.append(define("LLDB_ENABLE_LIBEDIT", True)) - cmake_args.append(define("LLDB_ENABLE_CURSES", True)) + cmake_args.extend( + [ + define("LLDB_ENABLE_LIBEDIT", True), + define("LLDB_ENABLE_CURSES", True), + define("LLDB_ENABLE_LIBXML2", True), + from_variant("LLDB_ENABLE_LUA", "lua"), + define("LLDB_ENABLE_LZMA", True), + ] + ) if spec["ncurses"].satisfies("+termlib"): cmake_args.append(define("LLVM_ENABLE_TERMINFO", True)) else: cmake_args.append(define("LLVM_ENABLE_TERMINFO", False)) - cmake_args.append(define("LLDB_ENABLE_LIBXML2", False)) if spec.version >= Version("10"): cmake_args.append(from_variant("LLDB_ENABLE_PYTHON", "python")) else: