summaryrefslogtreecommitdiff
path: root/dev-qt/qtcore
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-06-29 12:04:12 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-06-29 12:04:12 +0100
commit0f558761aa2dee1017b4751e4017205e015a9560 (patch)
tree037df795519468a25d9362b4e95cdaeb84eb1cf9 /dev-qt/qtcore
parent752d6256e5204b958b0ef7905675a940b5e9172f (diff)
gentoo resync : 29.12.2022
Diffstat (limited to 'dev-qt/qtcore')
-rw-r--r--dev-qt/qtcore/Manifest14
-rw-r--r--dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch61
-rw-r--r--dev-qt/qtcore/qtcore-5.15.4-r2.ebuild121
-rw-r--r--dev-qt/qtcore/qtcore-5.15.4-r3.ebuild121
-rw-r--r--dev-qt/qtcore/qtcore-5.15.5-r1.ebuild (renamed from dev-qt/qtcore/qtcore-5.15.3.ebuild)4
-rw-r--r--dev-qt/qtcore/qtcore-5.15.5.ebuild117
6 files changed, 433 insertions, 5 deletions
diff --git a/dev-qt/qtcore/Manifest b/dev-qt/qtcore/Manifest
index f598d6af9a4c..a35f024d7167 100644
--- a/dev-qt/qtcore/Manifest
+++ b/dev-qt/qtcore/Manifest
@@ -1,5 +1,13 @@
AUX qtcore-5.15.3-pthread.patch 1570 BLAKE2B f484f7aab89ba92bc33861abc1a4c5fe5f15139a7b14bb6a84a02d8f064dd6465d6ad3ea39ee35cdbb2dae6a2879a824b23068b8e94d3a6ebb2e6639b11a1612 SHA512 492199fdd7f7252c9ec03ed735a015df51e8de7aa2b20b2a4bb391a133e1dd0d88ce9dbafb600071e07abc9b426a9040f64a738361b71dd891186a59087515e4
-DIST qtbase-5.15.3-gentoo-kde-1.tar.xz 337032 BLAKE2B a5a3ff6c6002e386d15dd3122faec8e09fba19df12db59a6cdff1f04b7cc9919cf5cc30f4ae936ee3cb29cf110e714bb727929330ced292b699472367adfef4c SHA512 042743816f3c08dc3313be76da31e206c37dd7dc5b2604b36ef4be18ad66a89d9d29a61f9cccaa169665f742f7fbfb60822189e8cab0d23f3d4efe293a79f78c
-DIST qtbase-everywhere-opensource-src-5.15.3.tar.xz 50204364 BLAKE2B 9c011e8d6033e340a1d7be6bd9100a05d55638cfd53f647752853382574b6c444668eae36bf88cfedde0e7c0e00ecb1f91d025fc59c23be5438ba0ef91a5246c SHA512 01723eff5116a1d7d136fa32d2aee2691b227a241dbc160953ee72a8c0f3bc7ab771c17434629cabef419983ef43bb38aa6956ddcc09c9a82e116a50073b0079
-EBUILD qtcore-5.15.3.ebuild 2218 BLAKE2B a3ec0dc1be8d59c8b5ef97e68b42b68311f1658ee1ddebf3abaef05838bbdb388eec2823e9d057222e9f0d3e4de6355de4c9c5f37678443f411fdfbb7509dd58 SHA512 19f5af7688e875dd7a029034c45a13b1bfde5d9a9fa190d4cea9cb5f6fc7d7e7cfcd237e0852c9fde15184fd6ad26791d70599905a9df976c5b6d3c562d38f78
+AUX qtcore-5.15.5-fortify-source-3.patch 2353 BLAKE2B c2eaf28a3daca0ccac7ace1f8a915f44e705ae848a9e5e46756a77178a442345c8d6b1c3d3dfec1fa092ac0e7ee2d83b2cdd825d8471cef3b2b81444e99587f2 SHA512 df7e570417564d14993eb91fbaf691a15bea896b3ee6a8b7f5ac654b74fccda9f7dac52f022626df8aa3955aac073250d7b50840fd3aae3aa443f180084d29de
+DIST qtbase-5.15-gentoo-patchset-1.tar.xz 4204 BLAKE2B 1399eb6f4c776d370e1837351a72b604440658a3a2d1bd0c725b9ef149b09d236347f5f4b37f652c33310048a0a7df54e24453b404dc45507fd4f7c5fdf144cd SHA512 c857fc746bacb047321cdb762f3c7c48ce2a0d24045a9e708edd38532568dbbc74e9e971425a72a3c2a5ca0662b3e6333831f6c1b7746525b99d46000b63111f
+DIST qtbase-5.15.4-gentoo-kde-2.tar.xz 508404 BLAKE2B 315a65bc62ceba98edeaf2e9e212d25d08dd99a309a65000fe4397a69593a30f06a48f208b5506849115ffb8b34a92928d2a8505cbc46567cf37da540be48a08 SHA512 ac4a21f6ee2a1a897b25c8fb4a127ae5b47c7dc5ada5c382dd6976c37e2e1a90cbc5e3d457fc240d8939b20947b0e83a666e141adc66c16188749114f783af4c
+DIST qtbase-5.15.4-gentoo-kde-3.tar.xz 516480 BLAKE2B b7f94dd5315b9a16647c2d035fefc9021c4fcfe72a9010713ff6e47ebd1aca575778a02f96c81256fd38b6b58138a6ecd4ce046a6e4e3b0e0a4edfc64100c4f0 SHA512 f616fbd226390e8995008d22dbc35607f26eb5feaf436cd9b35d9ff0c2e428a4b75d0c91ba28660b488b03e1acccf8a2998dfdfc988335b3b37f6b6ae17106b3
+DIST qtbase-5.15.5-gentoo-kde-1.tar.xz 520224 BLAKE2B 48807bc79cede557b114786ee072d8d94545f4ada3d96aa4fe04dbf79a356dc6c17d9299014ed70aa10296346c30c7512fb7d9f88ee4b301e9a54a241363be8b SHA512 ab9f27d506d7aa1a9339ba52d51daffb4c6f9abb5d858fd728ef2110528bc0f2ae101b4e2e7c344836b42e4aafa2c5a4ab5c5fa37465e692cce500c0f3347fa7
+DIST qtbase-everywhere-opensource-src-5.15.4.tar.xz 50225468 BLAKE2B 3525126791ca168ea4227bc58bef0202f4cec68396c958b0e7f09e7b41ca9d70bbcf0e78b5e7997bc3e4a59e889128f93964b5d0a9db7d012403581cff3dc30b SHA512 91a1d95c2891939ae55134e8897cbc423142bd8eda954a1e65bb563b0932ed9e2da34db374fd86858b4a819e8abe824a967b31f4fb316528ec8aaf15016c6ad3
+DIST qtbase-everywhere-opensource-src-5.15.5.tar.xz 50247388 BLAKE2B e9bbfe8e73e6f25ccadeef722818b5aeb82d1f136bec21fcbc3b26bf76044b38f25c7268010c648e1161e9b61013b8b775f17b9fdcfdd70402bdfbf70bf7f9d5 SHA512 ce80eedc88abbd5a200bacc10a8e94adc1ef2122ac220715ba084adf1e32d67f2dc66168503de5fb5b5a6ab15f7a75ca23dc9956aed12ead994a8ffa6291ef87
+EBUILD qtcore-5.15.4-r2.ebuild 2956 BLAKE2B 32119950e009c6fe4d5505041b9983df746f4e81e1bb3c11aa9ba8ad64833ec6e74ffc006d5c4714a9f790ca6c43c20d1248737bf6106ddc8074a7754bedb154 SHA512 c59634fd539c68b6248300e7f219510a879cda5c9328a410224a42041599afa65e941b40a43b60575f26751506a96f93fddae0e46d394992e89a062657b754a9
+EBUILD qtcore-5.15.4-r3.ebuild 2958 BLAKE2B fadcaebdc061509ca1ba53db9e08c876907ee1815edf160ca7343a21b1bb4be5cfcebae2cb3ade0d7540e76cd0cf4e3132ab5133f878d475bec6bf9a9c22a16e SHA512 8a4aa2bce191f9a524a487e48facf5fbd09690e1e944b9d390a1ca42a6b872997f3baba9a91b74df63d9d9e6983b8fb36bcf70e1bd18bac3d1a1f03683de8c7d
+EBUILD qtcore-5.15.5-r1.ebuild 2219 BLAKE2B 91f69a07bd8f3b8a5cf83afb7f2e8cbc3f4b4971d75b8b4e7d24cbafc9606ce498f079afa4af58414d3d46ec44029bb3f17a0c55b073691da7d6a0bdd22dc7ff SHA512 a69159b1814b2b5493c54bdd8e9ccd9478b7f8993b227e1c74a64bdd490805254e3cddb63db0c7f40cbe6f3e8f4dfe32e7df0a5fea5946fb850e2b6e0d391540
+EBUILD qtcore-5.15.5.ebuild 2894 BLAKE2B 1d2ae5d8eb978b55b53dceebac8b45cf6f46503ead0747e1a152a14378fd5bfdb4a903608e6a358af220c65387eb4921cae932866e231f04ed29511af37fe2a0 SHA512 256058b5c47de92fe9880af0f33df97f7804d555f700c3dc957f928b4aa98e5c9109fa57334c3cdae02eec89faa1985c9866534516856beafdee7dc26feeb7a1
MISC metadata.xml 833 BLAKE2B 79b441c34e55017f23dd85cdb062ef4cbcfce05dff74936de887256ba8b9b596632b570b55b7014c38467829751771bb116f067cd6a246a11309f20b67fb55f0 SHA512 f1ffedc2ad17d198ba14a9a93e6c8dd35a7709e6f1e07dae606c16c05868f2f8e696f25fa5cf2602ed50f41eb5a914ff0d652b9ac37163e5130ddbfb475a1ff5
diff --git a/dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch b/dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch
new file mode 100644
index 000000000000..1be46b496cf9
--- /dev/null
+++ b/dev-qt/qtcore/files/qtcore-5.15.5-fortify-source-3.patch
@@ -0,0 +1,61 @@
+https://invent.kde.org/qt/qt/qtbase/-/commit/6d3d164bec17876f5b24ae9102767ef1236aa37b
+
+From 6d3d164bec17876f5b24ae9102767ef1236aa37b Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Mon, 20 Jun 2022 20:35:12 +0100
+Subject: [PATCH] QArrayData: fix UB via reinterpret_cast (crash with
+ FORTIFY_SOURCE=3)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+FORTIFY_SOURCE=3 is a new level of FORTIFY_SOURCE available with GCC 12+.
+
+With Qt 5.15, it ends up triggering UB in the pointer arithmetic
+in QArrayData which breaks various FOSS applications using qtcore.
+
+Qt upstream fixed this independently for 6.x (in at least
+eab6eb64d2fab21c4791738323ca7d670a907de1) but did so at the same time as
+various internal changes and hence is not appropriate for cherry-picking to 5.15.x.
+
+I reported the issue to Qt (QTBUG-103782) and they've created a fix for 5.15 which
+is not yet public but based on the description in the bug, should be functionally
+the same as this. They have not backported the intrusive internal changes
+from 6.x.
+
+Originally grabbed from https://build.opensuse.org/package/view_file/KDE:Qt:5.15/libqt5-qtbase/mitigate-FORTIFY_SOURCE-3.patch.
+
+Bug: https://bugs.gentoo.org/847145
+Bug: https://bugs.gentoo.org/852974
+Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104964
+Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709
+Task-number: QTBUG-103782
+Thanks-to: Martin Liška <mliska@suse.cz>
+--- a/src/corelib/tools/qarraydata.h
++++ b/src/corelib/tools/qarraydata.h
+@@ -42,6 +42,7 @@
+
+ #include <QtCore/qrefcount.h>
+ #include <string.h>
++#include <cstdint>
+
+ QT_BEGIN_NAMESPACE
+
+@@ -58,14 +59,14 @@ struct Q_CORE_EXPORT QArrayData
+ {
+ Q_ASSERT(size == 0
+ || offset < 0 || size_t(offset) >= sizeof(QArrayData));
+- return reinterpret_cast<char *>(this) + offset;
++ return reinterpret_cast<void *> (reinterpret_cast<uintptr_t>(this) + offset);
+ }
+
+ const void *data() const
+ {
+ Q_ASSERT(size == 0
+ || offset < 0 || size_t(offset) >= sizeof(QArrayData));
+- return reinterpret_cast<const char *>(this) + offset;
++ return reinterpret_cast<void *> (reinterpret_cast<uintptr_t>(this) + offset);
+ }
+
+ // This refers to array data mutability, not "header data" represented by
+GitLab
diff --git a/dev-qt/qtcore/qtcore-5.15.4-r2.ebuild b/dev-qt/qtcore/qtcore-5.15.4-r2.ebuild
new file mode 100644
index 000000000000..8f50567db7fb
--- /dev/null
+++ b/dev-qt/qtcore/qtcore-5.15.4-r2.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+QT5_KDEPATCHSET_REV=2
+QT5_MODULE="qtbase"
+inherit linux-info flag-o-matic qt5-build
+
+DESCRIPTION="Cross-platform application development framework"
+SLOT=5/${QT5_PV}
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+ KEYWORDS="amd64 arm arm64 ~hppa ~loong ppc ppc64 ~riscv ~sparc x86"
+fi
+
+IUSE="icu old-kernel systemd"
+
+DEPEND="
+ dev-libs/double-conversion:=
+ dev-libs/glib:2
+ dev-libs/libpcre2[pcre16,unicode]
+ sys-libs/zlib:=
+ icu? ( dev-libs/icu:= )
+ !icu? ( virtual/libiconv )
+ systemd? ( sys-apps/systemd:= )
+"
+RDEPEND="${DEPEND}"
+
+QT5_TARGET_SUBDIRS=(
+ src/tools/bootstrap
+ src/tools/moc
+ src/tools/rcc
+ src/corelib
+ src/tools/qlalr
+ doc
+)
+
+QT5_GENTOO_PRIVATE_CONFIG=(
+ !:network
+ !:sql
+ !:testlib
+ !:xml
+)
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.15.3-pthread.patch # bug 803470
+)
+
+pkg_pretend() {
+ use kernel_linux || return
+ get_running_version
+ if kernel_is -lt 4 11 && ! use old-kernel; then
+ ewarn "The running kernel is older than 4.11. USE=old-kernel is needed for"
+ ewarn "dev-qt/qtcore to function on this kernel properly. Bugs #669994, #672856"
+ fi
+}
+
+src_prepare() {
+ # don't add -O3 to CXXFLAGS, bug 549140
+ sed -i -e '/CONFIG\s*+=/s/optimize_full//' src/corelib/corelib.pro || die
+
+ # fix missing qt_version_tag symbol w/ LTO, bug 674382
+ sed -i -e 's/^gcc:ltcg/gcc/' src/corelib/global/global.pri || die
+
+ # Broken with FORTIFY_SOURCE=3
+ # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
+ # to unset F_S first, then explicitly set 2, to negate any default
+ # and anything set by the user if they're choosing 3 (or if they've
+ # modified GCC to set 3).
+ #
+ # Refs:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105078
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709
+ # https://bugreports.qt.io/browse/QTBUG-103782
+ # bug #847145
+ if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
+ # We can't unconditionally do this b/c we fortify needs
+ # some level of optimisation.
+ filter-flags -D_FORTIFY_SOURCE=3
+ # (Qt doesn't seem to respect CPPFLAGS?)
+ append-flags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+ fi
+
+ qt5-build_src_prepare
+}
+
+src_configure() {
+ local myconf=(
+ $(qt_use icu)
+ $(qt_use !icu iconv)
+ $(qt_use systemd journald)
+ )
+ use old-kernel && myconf+=(
+ -no-feature-renameat2 # needs Linux 3.16, bug 669994
+ -no-feature-getentropy # needs Linux 3.17, bug 669994
+ -no-feature-statx # needs Linux 4.11, bug 672856
+ )
+ qt5-build_src_configure
+}
+
+src_install() {
+ qt5-build_src_install
+ qt5_symlink_binary_to_path qmake 5
+
+ local flags=(
+ DBUS FREETYPE IMAGEFORMAT_JPEG IMAGEFORMAT_PNG
+ OPENGL OPENSSL SSL WIDGETS
+ )
+
+ for flag in ${flags[@]}; do
+ cat >> "${D}"/${QT5_HEADERDIR}/QtCore/qconfig.h <<- _EOF_ || die
+
+ #if defined(QT_NO_${flag}) && defined(QT_${flag})
+ # undef QT_NO_${flag}
+ #elif !defined(QT_NO_${flag}) && !defined(QT_${flag})
+ # define QT_NO_${flag}
+ #endif
+ _EOF_
+ done
+}
diff --git a/dev-qt/qtcore/qtcore-5.15.4-r3.ebuild b/dev-qt/qtcore/qtcore-5.15.4-r3.ebuild
new file mode 100644
index 000000000000..a3855efd1db1
--- /dev/null
+++ b/dev-qt/qtcore/qtcore-5.15.4-r3.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+QT5_KDEPATCHSET_REV=3
+QT5_MODULE="qtbase"
+inherit linux-info flag-o-matic qt5-build
+
+DESCRIPTION="Cross-platform application development framework"
+SLOT=5/${QT5_PV}
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+ KEYWORDS="amd64 ~arm ~arm64 ~hppa ~loong ppc ppc64 ~riscv ~sparc x86"
+fi
+
+IUSE="icu old-kernel systemd"
+
+DEPEND="
+ dev-libs/double-conversion:=
+ dev-libs/glib:2
+ dev-libs/libpcre2[pcre16,unicode]
+ sys-libs/zlib:=
+ icu? ( dev-libs/icu:= )
+ !icu? ( virtual/libiconv )
+ systemd? ( sys-apps/systemd:= )
+"
+RDEPEND="${DEPEND}"
+
+QT5_TARGET_SUBDIRS=(
+ src/tools/bootstrap
+ src/tools/moc
+ src/tools/rcc
+ src/corelib
+ src/tools/qlalr
+ doc
+)
+
+QT5_GENTOO_PRIVATE_CONFIG=(
+ !:network
+ !:sql
+ !:testlib
+ !:xml
+)
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-5.15.3-pthread.patch # bug 803470
+)
+
+pkg_pretend() {
+ use kernel_linux || return
+ get_running_version
+ if kernel_is -lt 4 11 && ! use old-kernel; then
+ ewarn "The running kernel is older than 4.11. USE=old-kernel is needed for"
+ ewarn "dev-qt/qtcore to function on this kernel properly. Bugs #669994, #672856"
+ fi
+}
+
+src_prepare() {
+ # don't add -O3 to CXXFLAGS, bug 549140
+ sed -i -e '/CONFIG\s*+=/s/optimize_full//' src/corelib/corelib.pro || die
+
+ # fix missing qt_version_tag symbol w/ LTO, bug 674382
+ sed -i -e 's/^gcc:ltcg/gcc/' src/corelib/global/global.pri || die
+
+ # Broken with FORTIFY_SOURCE=3
+ # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
+ # to unset F_S first, then explicitly set 2, to negate any default
+ # and anything set by the user if they're choosing 3 (or if they've
+ # modified GCC to set 3).
+ #
+ # Refs:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105078
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709
+ # https://bugreports.qt.io/browse/QTBUG-103782
+ # bug #847145
+ if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
+ # We can't unconditionally do this b/c we fortify needs
+ # some level of optimisation.
+ filter-flags -D_FORTIFY_SOURCE=3
+ # (Qt doesn't seem to respect CPPFLAGS?)
+ append-flags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+ fi
+
+ qt5-build_src_prepare
+}
+
+src_configure() {
+ local myconf=(
+ $(qt_use icu)
+ $(qt_use !icu iconv)
+ $(qt_use systemd journald)
+ )
+ use old-kernel && myconf+=(
+ -no-feature-renameat2 # needs Linux 3.16, bug 669994
+ -no-feature-getentropy # needs Linux 3.17, bug 669994
+ -no-feature-statx # needs Linux 4.11, bug 672856
+ )
+ qt5-build_src_configure
+}
+
+src_install() {
+ qt5-build_src_install
+ qt5_symlink_binary_to_path qmake 5
+
+ local flags=(
+ DBUS FREETYPE IMAGEFORMAT_JPEG IMAGEFORMAT_PNG
+ OPENGL OPENSSL SSL WIDGETS
+ )
+
+ for flag in ${flags[@]}; do
+ cat >> "${D}"/${QT5_HEADERDIR}/QtCore/qconfig.h <<- _EOF_ || die
+
+ #if defined(QT_NO_${flag}) && defined(QT_${flag})
+ # undef QT_NO_${flag}
+ #elif !defined(QT_NO_${flag}) && !defined(QT_${flag})
+ # define QT_NO_${flag}
+ #endif
+ _EOF_
+ done
+}
diff --git a/dev-qt/qtcore/qtcore-5.15.3.ebuild b/dev-qt/qtcore/qtcore-5.15.5-r1.ebuild
index fca2881a9617..c2235698ecbf 100644
--- a/dev-qt/qtcore/qtcore-5.15.3.ebuild
+++ b/dev-qt/qtcore/qtcore-5.15.5-r1.ebuild
@@ -11,7 +11,7 @@ DESCRIPTION="Cross-platform application development framework"
SLOT=5/${QT5_PV}
if [[ ${QT5_BUILD_TYPE} == release ]]; then
- KEYWORDS="amd64 arm arm64 ~hppa ppc ppc64 ~riscv ~sparc x86"
+ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
IUSE="icu old-kernel systemd"
@@ -44,7 +44,7 @@ QT5_GENTOO_PRIVATE_CONFIG=(
)
PATCHES=(
- "${FILESDIR}"/${PN}-5.15.3-pthread.patch # bug 803470
+ "${FILESDIR}"/${P}-fortify-source-3.patch
)
pkg_pretend() {
diff --git a/dev-qt/qtcore/qtcore-5.15.5.ebuild b/dev-qt/qtcore/qtcore-5.15.5.ebuild
new file mode 100644
index 000000000000..5ae91ec69b8c
--- /dev/null
+++ b/dev-qt/qtcore/qtcore-5.15.5.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+QT5_KDEPATCHSET_REV=1
+QT5_MODULE="qtbase"
+inherit linux-info flag-o-matic qt5-build
+
+DESCRIPTION="Cross-platform application development framework"
+SLOT=5/${QT5_PV}
+
+if [[ ${QT5_BUILD_TYPE} == release ]]; then
+ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
+fi
+
+IUSE="icu old-kernel systemd"
+
+DEPEND="
+ dev-libs/double-conversion:=
+ dev-libs/glib:2
+ dev-libs/libpcre2[pcre16,unicode]
+ sys-libs/zlib:=
+ icu? ( dev-libs/icu:= )
+ !icu? ( virtual/libiconv )
+ systemd? ( sys-apps/systemd:= )
+"
+RDEPEND="${DEPEND}"
+
+QT5_TARGET_SUBDIRS=(
+ src/tools/bootstrap
+ src/tools/moc
+ src/tools/rcc
+ src/corelib
+ src/tools/qlalr
+ doc
+)
+
+QT5_GENTOO_PRIVATE_CONFIG=(
+ !:network
+ !:sql
+ !:testlib
+ !:xml
+)
+
+pkg_pretend() {
+ use kernel_linux || return
+ get_running_version
+ if kernel_is -lt 4 11 && ! use old-kernel; then
+ ewarn "The running kernel is older than 4.11. USE=old-kernel is needed for"
+ ewarn "dev-qt/qtcore to function on this kernel properly. Bugs #669994, #672856"
+ fi
+}
+
+src_prepare() {
+ # don't add -O3 to CXXFLAGS, bug 549140
+ sed -i -e '/CONFIG\s*+=/s/optimize_full//' src/corelib/corelib.pro || die
+
+ # fix missing qt_version_tag symbol w/ LTO, bug 674382
+ sed -i -e 's/^gcc:ltcg/gcc/' src/corelib/global/global.pri || die
+
+ # Broken with FORTIFY_SOURCE=3
+ # Our toolchain sets F_S=2 by default w/ >= -O2, so we need
+ # to unset F_S first, then explicitly set 2, to negate any default
+ # and anything set by the user if they're choosing 3 (or if they've
+ # modified GCC to set 3).
+ #
+ # Refs:
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105078
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105709
+ # https://bugreports.qt.io/browse/QTBUG-103782
+ # bug #847145
+ if is-flagq '-O[23]' || is-flagq '-Ofast' ; then
+ # We can't unconditionally do this b/c we fortify needs
+ # some level of optimisation.
+ filter-flags -D_FORTIFY_SOURCE=3
+ # (Qt doesn't seem to respect CPPFLAGS?)
+ append-flags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
+ fi
+
+ qt5-build_src_prepare
+}
+
+src_configure() {
+ local myconf=(
+ $(qt_use icu)
+ $(qt_use !icu iconv)
+ $(qt_use systemd journald)
+ )
+ use old-kernel && myconf+=(
+ -no-feature-renameat2 # needs Linux 3.16, bug 669994
+ -no-feature-getentropy # needs Linux 3.17, bug 669994
+ -no-feature-statx # needs Linux 4.11, bug 672856
+ )
+ qt5-build_src_configure
+}
+
+src_install() {
+ qt5-build_src_install
+ qt5_symlink_binary_to_path qmake 5
+
+ local flags=(
+ DBUS FREETYPE IMAGEFORMAT_JPEG IMAGEFORMAT_PNG
+ OPENGL OPENSSL SSL WIDGETS
+ )
+
+ for flag in ${flags[@]}; do
+ cat >> "${D}"/${QT5_HEADERDIR}/QtCore/qconfig.h <<- _EOF_ || die
+
+ #if defined(QT_NO_${flag}) && defined(QT_${flag})
+ # undef QT_NO_${flag}
+ #elif !defined(QT_NO_${flag}) && !defined(QT_${flag})
+ # define QT_NO_${flag}
+ #endif
+ _EOF_
+ done
+}