summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2023-08-26 16:40:44 -0400
committerIonen Wolkens <ionen@gentoo.org>2023-09-05 09:01:09 -0400
commitea3d847a8b9e50f49b0f3a8fcf24e0e67f2298c3 (patch)
tree00dab4e9ffc7c7ddf3d4ee95e46827b803b5fb51 /eclass/qt6-build.eclass
parentdev-qt/qtmultimedia: tighten deps, make X+qml optional (qt6) (diff)
downloadgentoo-ea3d847a8b9e50f49b0f3a8fcf24e0e67f2298c3.tar.gz
gentoo-ea3d847a8b9e50f49b0f3a8fcf24e0e67f2298c3.tar.bz2
gentoo-ea3d847a8b9e50f49b0f3a8fcf24e0e67f2298c3.zip
qt6-build.eclass: use upstream intended user_facing_tool_links.txt
Primary goal is to reduce the amount of things we need to track, both what to install and when the symlink needs to be created based on USE. Without this, a module could introduce a new tool and may not even notice that it needs a symlink. Essentially replaces qt6_symlink_binary_to_path which I do not believe will have further uses (thus marking deprecated). That is, unless we want to diverge from upstream intended links, but even then may as well use a normal dosym in ebuilds. Also re-arrange mycmakeargs a bit because yet again qttranslations is the odd one out. Bug: https://bugs.gentoo.org/863395 Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'eclass/qt6-build.eclass')
-rw-r--r--eclass/qt6-build.eclass46
1 files changed, 42 insertions, 4 deletions
diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index e2fbb3191eda..6e600d5d166e 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -104,6 +104,12 @@ qt6-build_src_prepare() {
# @DESCRIPTION:
# Run cmake_src_configure and handle anything else generic as needed.
qt6-build_src_configure() {
+ if [[ ${PN} == qttranslations ]]; then
+ # does not compile anything, further options would be unrecognized
+ cmake_src_configure
+ return
+ fi
+
if [[ ${mycmakeargs@a} == *a* ]]; then
local mycmakeargs=("${mycmakeargs[@]}")
else
@@ -111,13 +117,14 @@ qt6-build_src_configure() {
fi
mycmakeargs+=(
+ # see _qt6-build_create_user_facing_links
+ -DINSTALL_PUBLICBINDIR="${QT6_PREFIX}"/bin
# note that if qtbase was built with tests, this is default ON
- -DQT_BUILD_TESTS=$(in_iuse test && usev test ON || echo OFF)
+ -DQT_BUILD_TESTS=$(usex test ON OFF)
+ # avoid appending -O2 after user's C(XX)FLAGS (bug #911822)
+ -DQT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ON
)
- [[ ${PN} != qttranslations ]] && # compiles nothing (unused option)
- mycmakeargs+=( -DQT_USE_DEFAULT_CMAKE_OPTIMIZATION_FLAGS=ON ) #911822
-
# LTO cause test failures in several components (e.g. qtcharts,
# multimedia, scxml, wayland, webchannel, ...).
#
@@ -155,6 +162,8 @@ qt6-build_src_test() {
qt6-build_src_install() {
cmake_src_install
+ _qt6-build_create_user_facing_links
+
# hack: trim typical junk with currently no known "proper" way
# to avoid that primarily happens with tests (e.g. qt5compat and
# qtsvg tests, but qtbase[gui,-test] currently does some too)
@@ -179,6 +188,9 @@ qt_feature() {
# @DESCRIPTION:
# Symlink a given binary from QT6_BINDIR to QT6_PREFIX/bin, with
# optional suffix.
+#
+# Note: deprecated, will be removed when no consumers left in-tree,
+# see internal the _qt6-build_create_user_facing_links
qt6_symlink_binary_to_path() {
[[ ${#} -ge 1 ]] || die "${FUNCNAME}() requires at least one argument"
@@ -187,6 +199,32 @@ qt6_symlink_binary_to_path() {
###### Internal functions ######
+# @FUNCTION: _qt6-build_create_user_facing_links
+# @INTERNAL
+# @DESCRIPTION:
+# Create links for user facing tools (bug #863395) as suggested in:
+# https://doc.qt.io/qt-6/packaging-recommendations.html
+_qt6-build_create_user_facing_links() {
+ # user_facing_tool_links.txt is always created (except for qttranslations)
+ # even if no links (empty), if missing will assume that it is an error
+ [[ ${PN} == qttranslations ]] && return
+
+ # loop and match using paths (upstream suggests `xargs ln -s < ${links}`
+ # but, for what it is worth, that will fail if paths have spaces)
+ local link
+ while IFS= read -r link; do
+ if [[ -z ${link} ]]; then
+ continue
+ elif [[ ${link} =~ ^("${QT6_PREFIX}"/.+)\ ("${QT6_PREFIX}"/bin/.+) ]]
+ then
+ dosym -r "${BASH_REMATCH[1]#"${EPREFIX}"}" \
+ "${BASH_REMATCH[2]#"${EPREFIX}"}"
+ else
+ die "unrecognized line '${link}' in '${links}'"
+ fi
+ done < "${BUILD_DIR}"/user_facing_tool_links.txt || die
+}
+
# @FUNCTION: _qt6-build_prepare_env
# @INTERNAL
# @DESCRIPTION: