From 0673c265df80f66552d1f09bce7512c9595fbee7 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Tue, 17 Dec 2024 23:46:31 +0100 Subject: [PATCH] ecm.eclass: Introduce _ecm_handbook_optional() to support BUILD_DOC Signed-off-by: Andreas Sturmlechner --- eclass/ecm.eclass | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass index 2ca2b3a9e5..78a28adda2 100644 --- a/eclass/ecm.eclass +++ b/eclass/ecm.eclass @@ -595,6 +595,18 @@ ecm_src_prepare() { fi } +# @FUNCTION: _ecm_handbook_optional +# @DESCRIPTION: +# Use with ECM_HANDBOOK=optional; ticks either -DBUILD_DOC if available, +# or -DCMAKE_DISABLE_FIND_PACKAGE_KF${_KFSLOT}DocTools +_ecm_handbook_optional() { + if grep -Eq "option.*BUILD_DOC" CMakeLists.txt; then + echo "-DBUILD_DOC=$(usex handbook)" + else + echo "-DCMAKE_DISABLE_FIND_PACKAGE_KF${_KFSLOT}DocTools=$(usex !handbook)" + fi +} + # @FUNCTION: ecm_src_configure # @DESCRIPTION: # Wrapper for cmake_src_configure with extra logic for magic handling of @@ -621,7 +633,7 @@ ecm_src_configure() { fi if [[ ${ECM_HANDBOOK} = optional ]] ; then - cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF${_KFSLOT}DocTools=$(usex !handbook) ) + cmakeargs+=( $(_ecm_handbook_optional) ) fi if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} = true ]]; then