From: Andreas Sturmlechner <asturm@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH v2 2/4] cmake.eclass: Enforce CMAKE_REMOVE_MODULES_LIST be an array
Date: Wed, 01 Sep 2021 19:59:15 +0200 [thread overview]
Message-ID: <4623564.OV4Wx5bFTl@tuxbrain> (raw)
In-Reply-To: <4471705.vXUDI8C0e8@tuxbrain>
[-- Attachment #1: Type: text/plain, Size: 2694 bytes --]
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
eclass/cmake.eclass | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/eclass/cmake.eclass b/eclass/cmake.eclass
index 137dbc66017..7a8059ba071 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
--
2.33.0
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
next prev parent reply other threads:[~2021-09-01 17:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 17:58 [gentoo-dev] [PATCH v2 1/4] cmake.eclass: Support EAPI-8 Andreas Sturmlechner
2021-09-01 17:59 ` Andreas Sturmlechner [this message]
2021-09-01 17:59 ` [gentoo-dev] [PATCH v2 3/4] cmake.eclass: Enable CMAKE_INSTALL_ALWAYS Andreas Sturmlechner
2021-09-01 18:00 ` [gentoo-dev] [PATCH v2 4/4] cmake.eclass: Default CMAKE_BUILD_TYPE=RelWithDebInfo in EAPI 8 Andreas Sturmlechner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4623564.OV4Wx5bFTl@tuxbrain \
--to=asturm@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox