summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-03-01 23:41:30 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-03-01 23:41:30 +0000
commit1331637681273dc8391d7a7caa6175405dceb735 (patch)
tree57acd1953dffe9d8e88a0735a76115e20fa09d26 /eclass
parent5d5b0e27ed33330cca5636eb792368fbbf46774c (diff)
gentoo auto-resync : 01:03:2024 - 23:41:29
Diffstat (limited to 'eclass')
-rw-r--r--eclass/Manifest.gzbin39610 -> 39610 bytes
-rw-r--r--eclass/meson.eclass95
2 files changed, 67 insertions, 28 deletions
diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz
index 1033c43fb425..a65e6573a27d 100644
--- a/eclass/Manifest.gz
+++ b/eclass/Manifest.gz
Binary files differ
diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index d8bd93082ea5..3bf0ba9ebe97 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -41,7 +41,7 @@ esac
if [[ -z ${_MESON_ECLASS} ]]; then
_MESON_ECLASS=1
-inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs
+inherit flag-o-matic multiprocessing ninja-utils python-utils-r1 toolchain-funcs
BDEPEND=">=dev-build/meson-1.2.1
${NINJA_DEPEND}
@@ -277,14 +277,43 @@ meson_feature() {
usex "$1" "-D${2-$1}=enabled" "-D${2-$1}=disabled"
}
-# @FUNCTION: meson_src_configure
-# @USAGE: [extra meson arguments]
+# @FUNCTION: setup_meson_src_configure
# @DESCRIPTION:
-# This is the meson_src_configure function.
-meson_src_configure() {
- debug-print-function ${FUNCNAME} "$@"
-
- [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
+# Calculate the command line which meson should use, and other relevant
+# variables. Invoke via "${MESONARGS[@]}" in the calling environment.
+# This function is called from meson_src_configure.
+setup_meson_src_configure() {
+ MESONARGS=()
+ if tc-is-lto; then
+ # We want to connect -flto in *FLAGS to the dedicated meson option,
+ # to ensure that meson has visibility into what the user set. Although
+ # it is unlikely projects will check `get_option('b_lto')` and change
+ # their behavior, individual targets which are broken with LTO can
+ # disable it per target. Injecting via *FLAGS means that meson cannot
+ # strip -flto from that target.
+ MESONARGS+=( -Db_lto=true )
+
+ # respect -flto value, e.g. -flto=8, -flto=thin
+ local v=$(get-flag flto)
+ case ${v} in
+ thin)
+ MESONARGS+=( -Db_lto_mode=thin )
+ ;;
+ ''|*[!0-9]*)
+ ;;
+ *)
+ MESONARGS+=( -Db_lto_threads=${v} )
+ ;;
+ esac
+ # finally, remove it from *FLAGS to avoid passing it:
+ # - twice, with potentially different values
+ # - on excluded targets
+ filter-lto
+ else
+ # Prevent projects from enabling LTO by default. In Gentoo, LTO is
+ # enabled via setting *FLAGS appropriately.
+ MESONARGS+=( -Db_lto=false )
+ fi
local BUILD_CFLAGS=${BUILD_CFLAGS}
local BUILD_CPPFLAGS=${BUILD_CPPFLAGS}
@@ -314,8 +343,7 @@ meson_src_configure() {
: "${BUILD_PKG_CONFIG_PATH:=${PKG_CONFIG_PATH}}"
fi
- local mesonargs=(
- meson setup
+ MESONARGS+=(
--libdir "$(get_libdir)"
--localstatedir "${EPREFIX}/var/lib"
--prefix "${EPREFIX}/usr"
@@ -335,25 +363,21 @@ meson_src_configure() {
# an upstream development matter. bug #754279.
-Dwerror=false
- # Prevent projects from enabling LTO by default. In Gentoo, LTO is
- # enabled via setting *FLAGS appropriately.
- -Db_lto=false
+ "${ltoflags[@]}"
)
if [[ -n ${EMESON_BUILDTYPE} ]]; then
- mesonargs+=( --buildtype "${EMESON_BUILDTYPE}" )
+ MESONARGS+=( -Dbuildtype="${EMESON_BUILDTYPE}" )
fi
if tc-is-cross-compiler; then
- mesonargs+=( --cross-file "$(_meson_create_cross_file)" )
+ MESONARGS+=( --cross-file "$(_meson_create_cross_file)" )
fi
- BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
-
# Handle quoted whitespace
eval "local -a MYMESONARGS=( ${MYMESONARGS} )"
- mesonargs+=(
+ MESONARGS+=(
# Arguments from ebuild
"${emesonargs[@]}"
@@ -362,12 +386,6 @@ meson_src_configure() {
# Arguments from user
"${MYMESONARGS[@]}"
-
- # Source directory
- "${EMESON_SOURCE:-${S}}"
-
- # Build directory
- "${BUILD_DIR}"
)
# Used by symbolextractor.py
@@ -379,13 +397,34 @@ meson_src_configure() {
python_export_utf8_locale
# https://bugs.gentoo.org/721786
- local -x BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}"
- local -x BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}"
+ export BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}"
+ export BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}"
+}
+
+# @FUNCTION: meson_src_configure
+# @USAGE: [extra meson arguments]
+# @DESCRIPTION:
+# This is the meson_src_configure function.
+meson_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}"
+
+ BUILD_DIR="${BUILD_DIR:-${WORKDIR}/${P}-build}"
(
+ setup_meson_src_configure "$@"
+ MESONARGS+=(
+ # Source directory
+ "${EMESON_SOURCE:-${S}}"
+
+ # Build directory
+ "${BUILD_DIR}"
+ )
+
export -n {C,CPP,CXX,F,OBJC,OBJCXX,LD}FLAGS PKG_CONFIG_{LIBDIR,PATH}
- echo "${mesonargs[@]}" >&2
- "${mesonargs[@]}"
+ echo meson setup "${MESONARGS[@]}" >&2
+ meson setup "${MESONARGS[@]}"
) || die
}