commit:     89c3fd669808db42d622817849840ca069c8b6f7
Author:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  6 20:01:31 2023 +0000
Commit:     Ionen Wolkens <ionen <AT> gentoo <DOT> org>
CommitDate: Thu Sep  7 10:01:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89c3fd66

dev-qt/qtwebengine: fix build with >=libcxx-17

May(?) need a revbump given updating to libcxx-17 while built against
<17 unpatched could give symbol issues, ...but let's spare having
everyone rebuild, esp given by the time llvm:17 is released may have
qtwebengine-6.5.3 in the tree to trigger a build.

Thanks-to: Violet Purcell <vimproved <AT> inventati.org>
Signed-off-by: Ionen Wolkens <ionen <AT> gentoo.org>

 .../files/qtwebengine-6.5.2-libcxx17.patch         | 83 ++++++++++++++++++++++
 dev-qt/qtwebengine/qtwebengine-6.5.2-r1.ebuild     |  1 +
 dev-qt/qtwebengine/qtwebengine-6.5.9999.ebuild     |  1 +
 3 files changed, 85 insertions(+)

diff --git a/dev-qt/qtwebengine/files/qtwebengine-6.5.2-libcxx17.patch 
b/dev-qt/qtwebengine/files/qtwebengine-6.5.2-libcxx17.patch
new file mode 100644
index 000000000000..8acbbf4463ce
--- /dev/null
+++ b/dev-qt/qtwebengine/files/qtwebengine-6.5.2-libcxx17.patch
@@ -0,0 +1,83 @@
+Patch status: fixed in >=chromium-116.0.5809.0
+
+Backport of [2][3] in order to fix building with libcxx-17
+(and hopefully runtime if upgrade from 16->17 without rebuilding).
+
+In order to apply cleanly, also needed [4] which seems fine to have.
+
+[1] https://crbug.com/1449299
+[2] https://crrev.com/9bfbbffdba73668fdb483e5a850911d2b64c35d7
+[3] https://crrev.com/4878976cd7391fbc02f87af4b7fb539b5c1f3817
+[4] https://crrev.com/5b5551edd3961481e617e510276b9f015a35b861
+--- a/src/3rdparty/chromium/base/containers/checked_iterators.h
++++ b/src/3rdparty/chromium/base/containers/checked_iterators.h
+@@ -24,4 +24,7 @@
+   using reference = T&;
+   using iterator_category = std::random_access_iterator_tag;
++#if defined(__cpp_lib_ranges)
++  using iterator_concept = std::contiguous_iterator_tag;
++#endif
+ 
+   // Required for converting constructor below.
+@@ -31,8 +34,6 @@
+   // Required for certain libc++ algorithm optimizations that are not 
available
+   // for NaCl.
+-#if defined(_LIBCPP_VERSION) && !BUILDFLAG(IS_NACL)
+   template <typename Ptr>
+   friend struct std::pointer_traits;
+-#endif
+ 
+   constexpr CheckedContiguousIterator() = default;
+@@ -147,4 +148,10 @@
+   }
+ 
++  constexpr friend CheckedContiguousIterator operator+(
++      difference_type lhs,
++      const CheckedContiguousIterator& rhs) {
++    return rhs + lhs;
++  }
++
+   constexpr CheckedContiguousIterator& operator-=(difference_type rhs) {
+     if (rhs < 0) {
+@@ -218,5 +225,4 @@
+ }  // namespace base
+ 
+-#if defined(_LIBCPP_VERSION) && !BUILDFLAG(IS_NACL)
+ // Specialize both std::__is_cpp17_contiguous_iterator and std::pointer_traits
+ // for CCI in case we compile with libc++ outside of NaCl. The former is
+@@ -236,11 +242,28 @@
+ // [2] https://wg21.link/std.iterator.tags
+ // [3] https://wg21.link/pointer.traits.optmem
+-namespace std {
++
++#if defined(_LIBCPP_VERSION)
++
++_LIBCPP_BEGIN_NAMESPACE_STD
+ 
+ template <typename T>
++struct __is_cpp17_contiguous_iterator;
++template <typename T>
+ struct __is_cpp17_contiguous_iterator<::base::CheckedContiguousIterator<T>>
+     : true_type {};
+ 
+ template <typename T>
++struct __libcpp_is_contiguous_iterator;
++template <typename T>
++struct __libcpp_is_contiguous_iterator<::base::CheckedContiguousIterator<T>>
++    : true_type {};
++
++_LIBCPP_END_NAMESPACE_STD
++
++#endif
++
++namespace std {
++
++template <typename T>
+ struct pointer_traits<::base::CheckedContiguousIterator<T>> {
+   using pointer = ::base::CheckedContiguousIterator<T>;
+@@ -261,5 +284,4 @@
+ 
+ }  // namespace std
+-#endif
+ 
+ #endif  // BASE_CONTAINERS_CHECKED_ITERATORS_H_

diff --git a/dev-qt/qtwebengine/qtwebengine-6.5.2-r1.ebuild 
b/dev-qt/qtwebengine/qtwebengine-6.5.2-r1.ebuild
index 45ffa95a789a..4f2f7fbf799d 100644
--- a/dev-qt/qtwebengine/qtwebengine-6.5.2-r1.ebuild
+++ b/dev-qt/qtwebengine/qtwebengine-6.5.2-r1.ebuild
@@ -101,6 +101,7 @@ PATCHES=( "${WORKDIR}"/patches/${PN} )
 
 PATCHES+=(
        # add extras as needed here, may merge in set if carries across versions
+       "${FILESDIR}"/${PN}-6.5.2-libcxx17.patch
 )
 
 python_check_deps() {

diff --git a/dev-qt/qtwebengine/qtwebengine-6.5.9999.ebuild 
b/dev-qt/qtwebengine/qtwebengine-6.5.9999.ebuild
index 45ffa95a789a..4f2f7fbf799d 100644
--- a/dev-qt/qtwebengine/qtwebengine-6.5.9999.ebuild
+++ b/dev-qt/qtwebengine/qtwebengine-6.5.9999.ebuild
@@ -101,6 +101,7 @@ PATCHES=( "${WORKDIR}"/patches/${PN} )
 
 PATCHES+=(
        # add extras as needed here, may merge in set if carries across versions
+       "${FILESDIR}"/${PN}-6.5.2-libcxx17.patch
 )
 
 python_check_deps() {

Reply via email to