commit: df41b9e1a25573053a6bc39759083666e67d3691
Author: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Fri May 23 15:22:27 2025 +0000
Commit: Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Fri May 23 15:41:45 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df41b9e1
qt6-build.eclass: use dot-a if QT6_HAS_STATIC_LIBS=1
Only relevant with USE=custom-cflags at the moment until we
potentially remove the filter-lto.
Considered QT_FEATURE_ltcg so QtModuleHelpers.cmake handles adding
-ffat-lto-objects *only* for static libs (less wasteful) but
1. FEATURE_ltcg is typo'ed there (lacks QT_), 2. it is only
activated with GCC (not clang), and 3. not 100% sure -ffat is passed
everywhere that it needs to be that way. May revisit.
Also considered adding this to ebuilds directly, but there is 5
that need this and it needs defining 1 or even 2 phases in some.
(not putting this behind USE=custom-cflags so that it will not need
adjusting if we remove filter-lto later)
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>
eclass/qt6-build.eclass | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index 858f33f2592e..e0f85283dfc2 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -23,6 +23,7 @@ _QT6_BUILD_ECLASS=1
inherit cmake flag-o-matic toolchain-funcs
[[ ${EAPI} == 8 ]] && inherit eapi9-pipestatus
+[[ ${QT6_HAS_STATIC_LIBS} ]] && inherit dot-a
# @ECLASS_VARIABLE: QT6_BUILD_TYPE
# @DESCRIPTION:
@@ -38,6 +39,14 @@ inherit cmake flag-o-matic toolchain-funcs
# Used for SRC_URI and EGIT_REPO_URI.
: "${QT6_MODULE:=${PN}}"
+# @ECLASS_VARIABLE: QT6_HAS_STATIC_LIBS
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Should be set to a non-empty value if static libraries may be
+# installed so that dot-a.eclass will be used. Using either way
+# is mostly harmless but still a bit wasteful, thus the variable.
+
# @ECLASS_VARIABLE: QT6_RESTRICT_TESTS
# @DEFAULT_UNSET
# @PRE_INHERIT
@@ -135,6 +144,8 @@ qt6-build_src_prepare() {
# issues only happen with GCC.
filter-lto
fi
+
+ [[ ${QT6_HAS_STATIC_LIBS} ]] && lto-guarantee-fat
}
# @FUNCTION: qt6-build_src_configure
@@ -192,6 +203,8 @@ qt6-build_src_test() {
qt6-build_src_install() {
cmake_src_install
+ [[ ${QT6_HAS_STATIC_LIBS} ]] && strip-lto-bytecode "${D}${QT6_LIBDIR}"
+
_qt6-build_create_user_facing_links
# Qt often install unwanted files when tests are enabled and, while