cb424d7448
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).
88 lines
2.7 KiB
CMake
88 lines
2.7 KiB
CMake
include(GNUInstallDirs)
|
|
include(LLVMDistributionSupport)
|
|
|
|
macro(add_lld_library name)
|
|
cmake_parse_arguments(ARG
|
|
"SHARED"
|
|
""
|
|
""
|
|
${ARGN})
|
|
if(ARG_SHARED)
|
|
set(ARG_ENABLE_SHARED SHARED)
|
|
endif()
|
|
llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS})
|
|
|
|
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
|
get_target_export_arg(${name} LLD export_to_lldtargets UMBRELLA lld-libraries)
|
|
install(TARGETS ${name}
|
|
COMPONENT ${name}
|
|
${export_to_lldtargets}
|
|
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
|
|
|
if (NOT CMAKE_CONFIGURATION_TYPES)
|
|
add_llvm_install_targets(install-${name}
|
|
DEPENDS ${name}
|
|
COMPONENT ${name})
|
|
endif()
|
|
set_property(GLOBAL APPEND PROPERTY LLD_ALL_LIBS ${name})
|
|
set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
|
|
endif()
|
|
endmacro(add_lld_library)
|
|
|
|
macro(add_lld_executable name)
|
|
add_llvm_executable(${name} ${ARGN})
|
|
endmacro(add_lld_executable)
|
|
|
|
macro(add_lld_tool name)
|
|
cmake_parse_arguments(ARG "DEPENDS;GENERATE_DRIVER" "" "" ${ARGN})
|
|
if (NOT LLD_BUILD_TOOLS)
|
|
set(EXCLUDE_FROM_ALL ON)
|
|
endif()
|
|
if(ARG_GENERATE_DRIVER
|
|
AND LLVM_TOOL_LLVM_DRIVER_BUILD
|
|
AND (NOT LLVM_DISTRIBUTION_COMPONENTS OR ${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)
|
|
)
|
|
set(get_obj_args ${ARGN})
|
|
list(FILTER get_obj_args EXCLUDE REGEX "^SUPPORT_PLUGINS$")
|
|
generate_llvm_objects(${name} ${get_obj_args})
|
|
add_custom_target(${name} DEPENDS llvm-driver)
|
|
else()
|
|
add_lld_executable(${name} ${ARGN})
|
|
|
|
if (LLD_BUILD_TOOLS)
|
|
get_target_export_arg(${name} LLD export_to_lldtargets)
|
|
install(TARGETS ${name}
|
|
${export_to_lldtargets}
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
|
COMPONENT ${name})
|
|
|
|
if (LLVM_ENABLE_PDB)
|
|
install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name} OPTIONAL)
|
|
endif()
|
|
|
|
if(NOT CMAKE_CONFIGURATION_TYPES)
|
|
add_llvm_install_targets(install-${name}
|
|
DEPENDS ${name}
|
|
COMPONENT ${name})
|
|
endif()
|
|
set_property(GLOBAL APPEND PROPERTY LLD_EXPORTS ${name})
|
|
endif()
|
|
endif()
|
|
endmacro()
|
|
|
|
macro(add_lld_symlink name dest)
|
|
get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
|
|
if(LLVM_TOOL_LLVM_DRIVER_BUILD
|
|
AND ${dest} IN_LIST LLVM_DRIVER_TOOLS
|
|
AND (NOT LLVM_DISTRIBUTION_COMPONENTS OR ${dest} IN_LIST LLVM_DISTRIBUTION_COMPONENTS)
|
|
)
|
|
set_property(GLOBAL APPEND PROPERTY LLVM_DRIVER_TOOL_ALIASES_${dest} ${name})
|
|
else()
|
|
llvm_add_tool_symlink(LLD ${name} ${dest} ALWAYS_GENERATE)
|
|
# Always generate install targets
|
|
llvm_install_symlink(LLD ${name} ${dest} ALWAYS_GENERATE)
|
|
endif()
|
|
endmacro()
|