Files
RedBear-OS/local/recipes/dev/libclc/source/lldb/cmake/modules/FindCursesAndPanel.cmake
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

69 lines
2.6 KiB
CMake

#.rst:
# FindCursesAndPanel
# -----------
#
# Find the curses, terminfo, and panel library as a whole.
include(CMakePushCheckState)
function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES CURSES_HAS_TINFO)
cmake_reset_check_state()
set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
# acs_map is one of many symbols that are part of tinfo but could
# be bundled in curses.
check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
endfunction()
if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
if(NOT HAS_TERMINFO_SYMBOLS)
lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
"${CURSES_LIBRARIES}"
CURSES_HAS_TINFO)
if(NOT CURSES_HAS_TINFO)
message(WARNING "CURSES_LIBRARIES was provided manually but is missing terminfo symbols")
endif()
mark_as_advanced(CURSES_HAS_TINFO)
endif()
set(CURSESANDPANEL_FOUND TRUE)
else()
find_package(Curses QUIET)
find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" QUIET)
include(FindPackageHandleStandardArgs)
if(CURSES_FOUND AND PANEL_LIBRARIES)
# Sometimes the curses libraries define their own terminfo symbols,
# other times they're extern and are defined by a separate terminfo library.
# Auto-detect which.
lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
"${CURSES_LIBRARIES}"
CURSES_HAS_TINFO)
if(NOT CURSES_HAS_TINFO)
message(STATUS "curses library missing terminfo symbols, looking for tinfo separately")
find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" QUIET)
list(APPEND CURSES_LIBRARIES "${TINFO_LIBRARIES}")
endif()
set(HAS_TERMINFO_SYMBOLS "$<OR:$<BOOL:${TERMINFO_LIBRARIES}>,$<BOOL:${CURSES_HAS_TINFO}>>")
endif()
find_package_handle_standard_args(CursesAndPanel
FOUND_VAR
CURSESANDPANEL_FOUND
REQUIRED_VARS
CURSES_INCLUDE_DIRS
CURSES_LIBRARIES
PANEL_LIBRARIES
HAS_TERMINFO_SYMBOLS)
if(CURSES_FOUND AND PANEL_LIBRARIES AND HAS_TERMINFO_SYMBOLS)
mark_as_advanced(CURSES_INCLUDE_DIRS
PANEL_LIBRARIES
HAS_TERMINFO_SYMBOLS
CURSES_HAS_TINFO)
endif()
if(TINFO_LIBRARIES)
mark_as_advanced(TINFO_LIBRARIES)
endif()
endif()