summaryrefslogtreecommitdiff
path: root/dev-qt
diff options
context:
space:
mode:
authorIonen Wolkens <ionen@gentoo.org>2023-09-02 02:09:58 -0400
committerIonen Wolkens <ionen@gentoo.org>2023-09-05 09:01:11 -0400
commitaa6feab907d063181e5bebeb052c3bd72843449b (patch)
tree23e50ba5394b972fe8142d2f4f0f9e9901aa3ef0 /dev-qt
parentqt6-build.eclass: move filter-lto to src_prepare (diff)
downloadgentoo-aa6feab907d063181e5bebeb052c3bd72843449b.tar.gz
gentoo-aa6feab907d063181e5bebeb052c3bd72843449b.tar.bz2
gentoo-aa6feab907d063181e5bebeb052c3bd72843449b.zip
dev-qt/qtbase: workaround x86intrin test and feature selection
qtbase does a single "big" test for all basic cpu features, and if CXXFLAGS have any matching -mno-* then they will override Qt's flags and the test fails. Surprised by this, Qt aborts unless explicitly disable the feature. Test can be bypassed, but then it does not perform per-flags tests and will fail to build as-is. Like bug #913400, debated a few options: 1. cpu_flags_x86_* to enable each feature, but given this is tied to compiler flags we'd still need to test them to avoid failures and not much better off, not to mention bug #913400 may have added its own -mno-* that go against these. 2. Patching cmake files so it always pass its e.g. -mavx2 after the user's flags (when needed), and does not rely on -march=haswell given that does not override. But fwiw these files do get installed and will alter expected behavior, and handling -march is more annoying. 3. Patch out the bit that makes the x86intrin test prevent building unless explicitly disabled, and let it auto-disable x86intrin entirely if tests fail (subpar for performance if ignored). 4. Do self-tests and disable features that will fail, this has the advantage that revdeps will not try to use these either. 5. One option to bug #913400 was to force simpler flags, which would also solve this. Picked #4 for now, not that particularly like it given it feels like automagic. Hoping will be more temporary than qsimd_p.h workarounds. Better than doing nothing either way, is a no-op for non-affected users. Bug: https://bugs.gentoo.org/908420 Closes: https://bugs.gentoo.org/913400 Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'dev-qt')
-rw-r--r--dev-qt/qtbase/qtbase-6.5.2-r1.ebuild36
-rw-r--r--dev-qt/qtbase/qtbase-6.5.9999.ebuild36
-rw-r--r--dev-qt/qtbase/qtbase-6.9999.ebuild36
3 files changed, 105 insertions, 3 deletions
diff --git a/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild b/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild
index 5fa82d9c7db0..57694adc046b 100644
--- a/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild
+++ b/dev-qt/qtbase/qtbase-6.5.2-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit qt6-build
+inherit flag-o-matic qt6-build toolchain-funcs
DESCRIPTION="Cross-platform application development framework"
@@ -222,6 +222,40 @@ src_configure() {
-DQT_FEATURE_sql_tds=OFF # currently a no-op in CMakeLists.txt
)
+ if use amd64 || use x86; then
+ # see bug #913400 for explanations
+ local cpufeats=(
+ # list of checked cpu features in configure.cmake
+ avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl}
+ f16c rdrnd rdseed sse2 sse3 sse4_1 sse4_2 ssse3 vaes
+ )
+ # handle odd ones out not matching -m* and macros (keep same order)
+ local cpuflags=( "${cpufeats[@]}" aes sha )
+ local cpufeats+=( aesni shani )
+
+ local -a intrins
+ IFS=' ' read -ra intrins < <(
+ : "$(test-flags-CXX "${cpuflags[@]/#/-m}")"
+ $(tc-getCXX) -E -P ${_} ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1
+ #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
+ #include <x86intrin.h>
+ #endif
+ $(printf '__%s__ ' "${cpuflags[@]^^}")
+ EOF
+ assert
+ )
+
+ # do nothing and leave to qtbase if no macros expanded (test failed?)
+ if [[ \ ${intrins[*]} == *\ [^_\ ]* ]]; then
+ local -i i
+ for ((i=0; i<${#cpufeats[@]}; i++)); do
+ [[ ${intrins[i]} == __* ]] &&
+ mycmakeargs+=( -DQT_FEATURE_${cpufeats[i]}=OFF )
+ done
+ mycmakeargs+=( -DTEST_x86intrin=ON )
+ fi
+ fi
+
qt6-build_src_configure
}
diff --git a/dev-qt/qtbase/qtbase-6.5.9999.ebuild b/dev-qt/qtbase/qtbase-6.5.9999.ebuild
index 3c339f31f8b7..a71f3078a605 100644
--- a/dev-qt/qtbase/qtbase-6.5.9999.ebuild
+++ b/dev-qt/qtbase/qtbase-6.5.9999.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit qt6-build
+inherit flag-o-matic qt6-build toolchain-funcs
DESCRIPTION="Cross-platform application development framework"
@@ -217,6 +217,40 @@ src_configure() {
-DQT_FEATURE_sql_tds=OFF # currently a no-op in CMakeLists.txt
)
+ if use amd64 || use x86; then
+ # see bug #913400 for explanations
+ local cpufeats=(
+ # list of checked cpu features in configure.cmake
+ avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl}
+ f16c rdrnd rdseed sse2 sse3 sse4_1 sse4_2 ssse3 vaes
+ )
+ # handle odd ones out not matching -m* and macros (keep same order)
+ local cpuflags=( "${cpufeats[@]}" aes sha )
+ local cpufeats+=( aesni shani )
+
+ local -a intrins
+ IFS=' ' read -ra intrins < <(
+ : "$(test-flags-CXX "${cpuflags[@]/#/-m}")"
+ $(tc-getCXX) -E -P ${_} ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1
+ #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
+ #include <x86intrin.h>
+ #endif
+ $(printf '__%s__ ' "${cpuflags[@]^^}")
+ EOF
+ assert
+ )
+
+ # do nothing and leave to qtbase if no macros expanded (test failed?)
+ if [[ \ ${intrins[*]} == *\ [^_\ ]* ]]; then
+ local -i i
+ for ((i=0; i<${#cpufeats[@]}; i++)); do
+ [[ ${intrins[i]} == __* ]] &&
+ mycmakeargs+=( -DQT_FEATURE_${cpufeats[i]}=OFF )
+ done
+ mycmakeargs+=( -DTEST_x86intrin=ON )
+ fi
+ fi
+
qt6-build_src_configure
}
diff --git a/dev-qt/qtbase/qtbase-6.9999.ebuild b/dev-qt/qtbase/qtbase-6.9999.ebuild
index 3c339f31f8b7..a71f3078a605 100644
--- a/dev-qt/qtbase/qtbase-6.9999.ebuild
+++ b/dev-qt/qtbase/qtbase-6.9999.ebuild
@@ -3,7 +3,7 @@
EAPI=8
-inherit qt6-build
+inherit flag-o-matic qt6-build toolchain-funcs
DESCRIPTION="Cross-platform application development framework"
@@ -217,6 +217,40 @@ src_configure() {
-DQT_FEATURE_sql_tds=OFF # currently a no-op in CMakeLists.txt
)
+ if use amd64 || use x86; then
+ # see bug #913400 for explanations
+ local cpufeats=(
+ # list of checked cpu features in configure.cmake
+ avx avx2 avx512{bw,cd,dq,er,f,ifma,pf,vbmi,vbmi2,vl}
+ f16c rdrnd rdseed sse2 sse3 sse4_1 sse4_2 ssse3 vaes
+ )
+ # handle odd ones out not matching -m* and macros (keep same order)
+ local cpuflags=( "${cpufeats[@]}" aes sha )
+ local cpufeats+=( aesni shani )
+
+ local -a intrins
+ IFS=' ' read -ra intrins < <(
+ : "$(test-flags-CXX "${cpuflags[@]/#/-m}")"
+ $(tc-getCXX) -E -P ${_} ${CXXFLAGS} ${CPPFLAGS} - <<-EOF | tail -n 1
+ #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
+ #include <x86intrin.h>
+ #endif
+ $(printf '__%s__ ' "${cpuflags[@]^^}")
+ EOF
+ assert
+ )
+
+ # do nothing and leave to qtbase if no macros expanded (test failed?)
+ if [[ \ ${intrins[*]} == *\ [^_\ ]* ]]; then
+ local -i i
+ for ((i=0; i<${#cpufeats[@]}; i++)); do
+ [[ ${intrins[i]} == __* ]] &&
+ mycmakeargs+=( -DQT_FEATURE_${cpufeats[i]}=OFF )
+ done
+ mycmakeargs+=( -DTEST_x86intrin=ON )
+ fi
+ fi
+
qt6-build_src_configure
}