llvm@19: add a work-around so that llvm can detect/use both "-lcurses -lterminfo" when using "ncurses+termlib"

This commit is contained in:
Satish Balay 2024-09-24 16:34:25 -05:00
parent 4e033e4940
commit 9ea2612650
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,52 @@
commit 5053d62162ad01d78da42a405f683aaf53c5724e
Author: Satish Balay <balay@mcs.anl.gov>
Date: Tue Sep 24 15:18:47 2024 -0500
llvm: patch to work when ncurses is built with --with-termlib [i.e. ncurses~termlib]
diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214b..98242cdf5 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,13 @@
# FindCursesAndPanel
# -----------
#
-# Find the curses and panel library as a whole.
+# Find the curses tinfo and panel library as a whole.
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
set(CURSESANDPANEL_FOUND TRUE)
else()
find_package(Curses QUIET)
+ find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" QUIET)
find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" QUIET)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +17,10 @@ else()
REQUIRED_VARS
CURSES_INCLUDE_DIRS
CURSES_LIBRARIES
+ TINFO_LIBRARIES
PANEL_LIBRARIES)
- if(CURSES_FOUND AND PANEL_LIBRARIES)
- mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+ if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+ mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES PANEL_LIBRARIES)
endif()
endif()
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index dbc620b91..83003818d 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
set(LLDB_LIBEDIT_LIBS)
if (LLDB_ENABLE_CURSES)
- list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+ list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES} ${TINFO_LIBRARIES})
if (LLVM_BUILD_STATIC)
list(APPEND LLDB_CURSES_LIBS gpm)
endif()

View File

@ -345,7 +345,7 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage):
depends_on("libedit")
depends_on("libxml2")
depends_on("lua@5.3", when="+lua") # purposefully not a range
depends_on("ncurses~termlib", when="@19:")
depends_on("ncurses")
depends_on("ncurses", when="@:19")
depends_on("py-six", when="+python")
depends_on("swig", when="+lua")
@ -428,6 +428,12 @@ class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage):
# Fixed in upstream versions of both
conflicts("^cmake@3.19.0", when="@6:11.0.0")
# llvm-19.0.1
patch(
"llvm-19.0.1-ncurses-termlib.patch",
when="@19: ^ncurses+termlib"
)
# Fix lld templates: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230463
patch(
"https://raw.githubusercontent.com/freebsd/freebsd-ports/f8f9333d8e1e5a7a6b28c5ef0ca73785db06136e/devel/llvm50/files/lld/patch-tools_lld_ELF_Symbols.cpp",