From 1331637681273dc8391d7a7caa6175405dceb735 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 1 Mar 2024 23:41:30 +0000 Subject: gentoo auto-resync : 01:03:2024 - 23:41:29 --- eclass/Manifest.gz | Bin 39610 -> 39610 bytes eclass/meson.eclass | 95 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 67 insertions(+), 28 deletions(-) (limited to 'eclass') diff --git a/eclass/Manifest.gz b/eclass/Manifest.gz index 1033c43fb425..a65e6573a27d 100644 Binary files a/eclass/Manifest.gz and b/eclass/Manifest.gz 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 } -- cgit v1.2.3