commit:     0b6386e9c6a803f72182310d5832c32069f625f6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 26 16:26:34 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jan  7 11:36:43 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b6386e9

meson.eclass: Pass -Db_lto=false globally

Pass `-Db_lto=false` globally to force-disable appending `-flto`
in projects that default to it.  In Gentoo, users enable LTO via setting
`*FLAGS` manually.

If a package really needs to pass `-Db_lto=true` because the build
system enables some custom logic based on it, `tc-is-lto` can be used
to determine whether LTO is enabled, and then `-Db_lto=true` can be
passed explicitly by the ebuild.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/meson.eclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index f7cf8a0722ba..12e9dd4bd9a6 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -1,4 +1,4 @@
-# Copyright 2017-2023 Gentoo Authors
+# Copyright 2017-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: meson.eclass
@@ -334,6 +334,10 @@ meson_src_configure() {
                # It's Gentoo policy to not have builds die on blanket -Werror, 
as it's
                # 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
        )
 
        if [[ -n ${EMESON_BUILDTYPE} ]]; then

Reply via email to