diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass index c97f74e8a2eda..f327521e9fc1f 100644 --- a/eclass/cmake.eclass +++ b/eclass/cmake.eclass @@ -117,6 +117,12 @@ fi # for econf and is needed to pass TRY_RUN results when cross-compiling. # Should be set by user in a per-package basis in /etc/portage/package.env. +# @ECLASS_VARIABLE: CMAKE_QA_COMPAT_SKIP +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set, skip detection of CMakeLists.txt unsupported in CMake 4 in case of +# false positives (e.g. unused outdated bundled libs). + # @ECLASS_VARIABLE: CMAKE_QA_SRC_DIR_READONLY # @USER_VARIABLE # @DEFAULT_UNSET @@ -445,6 +451,19 @@ cmake_src_configure() { # Fix xdg collision with sandbox xdg_environment_reset + local file ver cmreq_isold + if ! [[ ${CMAKE_QA_COMPAT_SKIP} ]]; then + while read -d '' -r file ; do + ver=$(sed -ne "/cmake_minimum_required/I{s/.*\(\.\.\.*\|\s\)\([0-9.]*\)\([)]\|\s\).*$/\2/p;q}" \ + "${file}" 2>/dev/null \ + ) + + if [[ -n $ver ]] && ver_test $ver -lt "3.5"; then + cmreq_isold=true + fi + done < <(find "${CMAKE_USE_DIR}" -type f -iname "CMakeLists.txt" -print0) + fi + # Prepare Gentoo override rules (set valid compiler, append CPPFLAGS etc.) local build_rules=${BUILD_DIR}/gentoo_rules.cmake @@ -625,6 +644,21 @@ cmake_src_configure() { cmakeargs+=( -C "${CMAKE_EXTRA_CACHE_FILE}" ) fi + if [[ ${cmreq_isold} ]]; then + eqawarn "QA Notice: Compatibility with CMake < 3.5 has been removed from CMake 4," + eqawarn "${CATEGORY}/${PN} will fail to build w/o a fix." + eqawarn "See also tracker bug #951350; check existing bug or file a new one for" + eqawarn "this package, and take it upstream." + if [[ ${EAPI} == 7 ]]; then + eqawarn "QA Notice: EAPI=7 detected; this package is now a prime last-rites target." + fi + if has_version -b ">=dev-build/cmake-4"; then + eqawarn "QA Notice: CMake 4 detected; building with -DCMAKE_POLICY_VERSION_MINIMUM=3.5" + eqawarn "This is merely a workaround and *not* a permanent fix." + cmakeargs+=( -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ) + fi + fi + pushd "${BUILD_DIR}" > /dev/null || die debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: mycmakeargs is ${mycmakeargs_local[*]}" echo "${CMAKE_BINARY}" "${cmakeargs[@]}" "${CMAKE_USE_DIR}" diff --git a/profiles/package.mask b/profiles/package.mask index f490fb1941921..4bd3ba2c6576c 100644 --- a/profiles/package.mask +++ b/profiles/package.mask @@ -263,10 +263,6 @@ dev-libs/libxml2-compat net-im/transwhat net-im/yowsup -# Sam James (2025-03-27) -# Large-scale breakage (bug #951350). -=dev-build/cmake-4* - # Michał Górny (2025-03-17) # Xfce 4.22 prereleases. Masked because they tend to be quite unstable. >=xfce-base/exo-4.21