summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2021-07-18 20:02:54 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2021-09-02 18:46:22 +0200
commit136f9f65035a32167e0e16e8c54db3833cf18f22 (patch)
tree6049b11b94a3b43b19a7fa697c1d60940fca7ea5 /eclass
parentcmake.eclass: Support EAPI-8 (diff)
downloadgentoo-136f9f65035a32167e0e16e8c54db3833cf18f22.tar.gz
gentoo-136f9f65035a32167e0e16e8c54db3833cf18f22.tar.bz2
gentoo-136f9f65035a32167e0e16e8c54db3833cf18f22.zip
cmake.eclass: Enforce CMAKE_REMOVE_MODULES_LIST be an array
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/cmake.eclass28
1 files changed, 20 insertions, 8 deletions
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 137dbc660178..7a8059ba0711 100644
--- a/eclass/cmake.eclass
+++ b/eclass/cmake.eclass
@@ -66,11 +66,23 @@ inherit flag-o-matic multiprocessing ninja-utils toolchain-funcs xdg-utils
: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
+# @PRE_INHERIT
+# @DEFAULT_UNSET
# @DESCRIPTION:
-# Array of CMake modules that will be removed in ${CMAKE_USE_DIR}
-# (in EAPI-7: ${S}) during src_prepare, in order to force packages to use the
-# system version. Set to empty to disable removing modules entirely.
-: ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK}
+# Array of .cmake modules to be removed in ${CMAKE_USE_DIR} (in EAPI-7: ${S})
+# during src_prepare, in order to force packages to use the system version.
+# By default, contains "FindBLAS" and "FindLAPACK".
+# Set to empty to disable removing modules entirely.
+if [[ ${CMAKE_REMOVE_MODULES_LIST} ]]; then
+ if [[ ${EAPI} != 7 ]]; then
+ [[ ${CMAKE_REMOVE_MODULES_LIST@a} == *a* ]] ||
+ die "CMAKE_REMOVE_MODULES_LIST must be an array"
+ fi
+else
+ if ! [[ ${CMAKE_REMOVE_MODULES_LIST@a} == *a* && ${#CMAKE_REMOVE_MODULES_LIST[@]} -eq 0 ]]; then
+ CMAKE_REMOVE_MODULES_LIST=( FindBLAS FindLAPACK )
+ fi
+fi
# @ECLASS-VARIABLE: CMAKE_USE_DIR
# @DESCRIPTION:
@@ -108,7 +120,7 @@ inherit flag-o-matic multiprocessing ninja-utils toolchain-funcs xdg-utils
[[ ${CMAKE_MIN_VERSION} ]] && die "CMAKE_MIN_VERSION is banned; if necessary, set BDEPEND=\">=dev-util/cmake-${CMAKE_MIN_VERSION}\" directly"
[[ ${CMAKE_BUILD_DIR} ]] && die "The ebuild must be migrated to BUILD_DIR"
-[[ ${CMAKE_REMOVE_MODULES} ]] && die "CMAKE_REMOVE_MODULES is banned, set CMAKE_REMOVE_MODULES_LIST=\"\" instead"
+[[ ${CMAKE_REMOVE_MODULES} ]] && die "CMAKE_REMOVE_MODULES is banned, set CMAKE_REMOVE_MODULES_LIST array instead"
[[ ${CMAKE_UTILS_QA_SRC_DIR_READONLY} ]] && die "Use CMAKE_QA_SRC_DIR_READONLY instead"
[[ ${WANT_CMAKE} ]] && die "WANT_CMAKE has been removed and is a no-op"
[[ ${PREFIX} ]] && die "PREFIX has been removed and is a no-op"
@@ -353,10 +365,10 @@ cmake_src_prepare() {
fi
local modules_list
- if [[ $(declare -p CMAKE_REMOVE_MODULES_LIST) == "declare -a"* ]]; then
- modules_list=( "${CMAKE_REMOVE_MODULES_LIST[@]}" )
- else
+ if [[ ${EAPI} == 7 && $(declare -p CMAKE_REMOVE_MODULES_LIST) != "declare -a"* ]]; then
modules_list=( ${CMAKE_REMOVE_MODULES_LIST} )
+ else
+ modules_list=( "${CMAKE_REMOVE_MODULES_LIST[@]}" )
fi
local name