summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2023-08-19 11:28:22 -0400
committerIonen Wolkens <ionen@gentoo.org>2023-09-05 09:01:00 -0400
commit2d5ab5b4b68554877a566db555c5b8cd471100b8 (patch)
tree3754e6974018be8240c2afb542cd14291b787300 /eclass/qt6-build.eclass
parentqt6-build.eclass: add cmake to @PROVIDES (diff)
downloadgentoo-2d5ab5b4b68554877a566db555c5b8cd471100b8.tar.gz
gentoo-2d5ab5b4b68554877a566db555c5b8cd471100b8.tar.bz2
gentoo-2d5ab5b4b68554877a566db555c5b8cd471100b8.zip
qt6-build.eclass: support+unrestrict tests, export src_test+install
Qt5's may be a lost cause at this point wrt bug #457182, but can do this fairly easily for Qt6 going forward (or at least for most components, qtbase, qttools, and qtdeclarative are messier). About src_install, it was defined but not exported. Not an issue before but now we need it for cleanups. Bug: https://bugs.gentoo.org/457182 Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'eclass/qt6-build.eclass')
-rw-r--r--eclass/qt6-build.eclass58
1 files changed, 48 insertions, 10 deletions
diff --git a/eclass/qt6-build.eclass b/eclass/qt6-build.eclass
index 3814df3b78f1..1eaae9b99587 100644
--- a/eclass/qt6-build.eclass
+++ b/eclass/qt6-build.eclass
@@ -70,22 +70,19 @@ HOMEPAGE="https://www.qt.io/"
LICENSE="|| ( GPL-2 GPL-3 LGPL-3 ) FDL-1.3"
SLOT=6/${PV%.*}
-IUSE="test"
-
-if [[ ${QT6_BUILD_TYPE} == release ]]; then
- RESTRICT="test" # bug 457182
-else
+if [[ ${PN} != qttranslations ]]; then
+ IUSE="test"
RESTRICT="!test? ( test )"
+
+ # testlib is currently enabled by USE=gui
+ [[ ${PN} != qtbase ]] &&
+ DEPEND="test? ( =dev-qt/qtbase-${PV}*:6[gui] )"
fi
BDEPEND="
dev-lang/perl
virtual/pkgconfig
"
-# TODO: Tests have not been split from qtbase.
-#if [[ ${PN} != qttest ]]; then
-# DEPEND+=" test? ( ~dev-qt/qttest-${PV} )"
-#fi
###### Phase functions ######
@@ -97,6 +94,13 @@ BDEPEND="
qt6-build_src_prepare() {
cmake_src_prepare
+ if in_iuse test && use test && [[ -e tests/auto/CMakeLists.txt ]]; then
+ # upstream seems to install before running tests, and cmake
+ # subdir that is present in about half of the Qt6 components
+ # cause a dependency on itself and sometimes install test junk
+ sed -i '/add_subdirectory(cmake)/d' tests/auto/CMakeLists.txt || die
+ fi
+
_qt6-build_prepare_env
}
@@ -104,14 +108,48 @@ qt6-build_src_prepare() {
# @DESCRIPTION:
# Run cmake_src_configure and handle anything else generic as needed.
qt6-build_src_configure() {
+ if [[ ${mycmakeargs@a} == *a* ]]; then
+ local mycmakeargs=("${mycmakeargs[@]}")
+ else
+ local mycmakeargs=()
+ fi
+
+ mycmakeargs+=(
+ # note that if qtbase was built with tests, this is default ON
+ -DQT_BUILD_TESTS=$(in_iuse test && usev test ON || echo OFF)
+ )
+
cmake_src_configure
}
+# @FUNCTION: qt6-build_src_test
+# @USAGE: [<cmake_src_test argument>...]
+# @DESCRIPTION:
+# Run cmake_src_test and handle anything else generic as-needed.
+qt6-build_src_test() {
+ # helps a few tests but is not always respected
+ local -x QML_IMPORT_PATH=${BUILD_DIR}${QT6_QMLDIR#"${QT6_PREFIX}"}
+
+ local -x QT_QPA_PLATFORM=offscreen
+
+ # TODO?: CMAKE_SKIP_TESTS skips a whole group of tests and, when
+ # only want to skip a sepcific sub-test, the BLACKLIST files
+ # could potentially be modified by implementing a QT6_SKIP_TESTS
+
+ cmake_src_test "${@}"
+}
+
# @FUNCTION: qt6-build_src_install
# @DESCRIPTION:
# Run cmake_src_install and handle anything else generic as needed.
qt6-build_src_install() {
cmake_src_install
+
+ # 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)
+ rm -rf -- "${D}${QT6_PREFIX}"/tests \
+ "${D}${QT6_LIBDIR}/objects-${CMAKE_BUILD_TYPE}" || die
}
###### Public helpers ######
@@ -167,4 +205,4 @@ _qt6-build_prepare_env() {
fi
-EXPORT_FUNCTIONS src_prepare src_configure
+EXPORT_FUNCTIONS src_prepare src_configure src_test src_install