From d91878de3adc5a3ef64b838cfd218050d5af43d4 Mon Sep 17 00:00:00 2001 From: Chongyun Lee Date: Wed, 4 Jun 2025 00:32:13 +0800 Subject: [PATCH 1/3] chromium-stable: bump to 137.0.7151.55 --- .../0007-remove-xorg-from-build-deps-2.patch | 13 -- ...s.patch => 7005-polyfill-atomic_ref.patch} | 107 +++++++++++- .../7008-use-SFINAE-in-base-containers.patch | 154 ++++++++++++++++++ .../7008-xnnpack-clang-18.patch | 27 --- tur-chromium/chromium-stable/build.sh | 9 +- 5 files changed, 263 insertions(+), 47 deletions(-) delete mode 100644 tur-chromium/chromium-stable/0007-remove-xorg-from-build-deps-2.patch rename tur-chromium/chromium-stable/{7005-polyfill-atomic_ref-base-atomicops.patch => 7005-polyfill-atomic_ref.patch} (86%) create mode 100644 tur-chromium/chromium-stable/7008-use-SFINAE-in-base-containers.patch delete mode 100644 tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch diff --git a/tur-chromium/chromium-stable/0007-remove-xorg-from-build-deps-2.patch b/tur-chromium/chromium-stable/0007-remove-xorg-from-build-deps-2.patch deleted file mode 100644 index 867730f..0000000 --- a/tur-chromium/chromium-stable/0007-remove-xorg-from-build-deps-2.patch +++ /dev/null @@ -1,13 +0,0 @@ -This reverts https://github.com/chromium/chromium/commit/97c864b32a7f4d64f541e2b7bf9006d2f582082f - ---- a/build/install-build-deps.py -+++ b/build/install-build-deps.py -@@ -388,8 +388,6 @@ - "libxtst6", - "x11-utils", - "x11-xserver-utils", -- "xserver-xorg-core", -- "xserver-xorg-video-dummy", - "xvfb", - "zlib1g", - ] diff --git a/tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch b/tur-chromium/chromium-stable/7005-polyfill-atomic_ref.patch similarity index 86% rename from tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch rename to tur-chromium/chromium-stable/7005-polyfill-atomic_ref.patch index fadfcc2..fb33bce 100644 --- a/tur-chromium/chromium-stable/7005-polyfill-atomic_ref-base-atomicops.patch +++ b/tur-chromium/chromium-stable/7005-polyfill-atomic_ref.patch @@ -1,7 +1,11 @@ -`atomic_ref` is not landed in NDK r27c +`atomic_ref` is not landed in NDK r27c, and it is used in: ---- a/base/__termux_header_only_atomic_ref_polyfill.h -+++ b/base/__termux_header_only_atomic_ref_polyfill.h +- //base/atomicops.cc +- //third_party/simdutf/simdutf.cpp +- //v8/src/objects/simd.cc + +--- a/third_party/termux-polyfill/__termux_header_only_atomic_ref_polyfill.h ++++ b/third_party/termux-polyfill/__termux_header_only_atomic_ref_polyfill.h @@ -0,0 +1,607 @@ +// Origin: https://github.com/ORNL/cpp-proposals-pub +// Origin Description: Collaborating on papers for the ISO C++ committee - public repo @@ -617,7 +621,7 @@ #include "base/memory/aligned_memory.h" +#ifdef __TERMUX__ -+#include "base/__termux_header_only_atomic_ref_polyfill.h" ++#include "third_party/termux-polyfill/__termux_header_only_atomic_ref_polyfill.h" +template +using __my_atomic_ref = Foo::atomic_ref; +#else @@ -666,3 +670,98 @@ .store(*src_byte_ptr, std::memory_order_relaxed); // SAFETY: We check above that `dst_byte_ptr` and `src_byte_ptr` point // to spans of sufficient size. + +--- a/third_party/simdutf/simdutf.h ++++ b/third_party/simdutf/simdutf.h +@@ -82,7 +82,7 @@ + !defined(SIMDUTF_SPAN_DISABLED) + #define SIMDUTF_SPAN 1 + #endif // __cpp_concepts >= 201907L && __cpp_lib_span >= 202002L +- #if __cpp_lib_atomic_ref >= 201806L ++ #if __cpp_lib_atomic_ref >= 201806L || defined(__TERMUX__) + #define SIMDUTF_ATOMIC_REF 1 + #endif // __cpp_lib_atomic_ref + #endif +--- a/third_party/simdutf/simdutf.cpp ++++ b/third_party/simdutf/simdutf.cpp +@@ -2,6 +2,17 @@ + /* begin file src/simdutf.cpp */ + #include "simdutf.h" + ++#ifdef SIMDUTF_ATOMIC_REF ++#ifdef __TERMUX__ ++#include "third_party/termux-polyfill/__termux_header_only_atomic_ref_polyfill.h" ++template ++using __my_atomic_ref = Foo::atomic_ref; ++#else ++template ++using __my_atomic_ref = std::atomic_ref; ++#endif ++#endif ++ + #if SIMDUTF_FEATURE_BASE64 + // We include base64_tables once. + /* begin file src/tables/base64_tables.h */ +@@ -18410,7 +18421,7 @@ + #if SIMDUTF_ATOMIC_REF + size_t atomic_binary_to_base64(const char *input, size_t length, char *output, + base64_options options) noexcept { +- static_assert(std::atomic_ref::required_alignment == 1); ++ static_assert(__my_atomic_ref::required_alignment == 1); + size_t retval = 0; + // Arbitrary block sizes: 3KB for input, 4KB for output. Total is 7KB. + constexpr size_t input_block_size = 1024 * 3; +@@ -18430,7 +18441,7 @@ + // Under x64, we could use 16-byte aligned loads. + // Note that we warn users that the performance might be poor. + for (size_t j = 0; j < current_block_size; ++j) { +- inbuf[j] = std::atomic_ref(mutable_input[i + j]) ++ inbuf[j] = __my_atomic_ref(mutable_input[i + j]) + .load(std::memory_order_relaxed); + } + const size_t written = binary_to_base64(inbuf.data(), current_block_size, +@@ -18438,7 +18449,7 @@ + // This copy is inefficient. + // Under x64, we could use 16-byte aligned stores. + for (size_t j = 0; j < written; ++j) { +- std::atomic_ref(output[retval + j]) ++ __my_atomic_ref(output[retval + j]) + .store(outbuf[j], std::memory_order_relaxed); + } + retval += written; +--- a/v8/src/objects/simd.cc ++++ b/v8/src/objects/simd.cc +@@ -32,6 +32,15 @@ + #include + #endif + ++#ifdef __TERMUX__ ++#include "third_party/termux-polyfill/__termux_header_only_atomic_ref_polyfill.h" ++template ++using __my_atomic_ref = Foo::atomic_ref; ++#else ++template ++using __my_atomic_ref = std::atomic_ref; ++#endif ++ + namespace v8 { + namespace internal { + +@@ -487,7 +496,7 @@ + char* mutable_bytes = const_cast(bytes); + for (size_t i = 0; i < length; i++) { + uint8_t byte = +- std::atomic_ref(mutable_bytes[i]).load(std::memory_order_relaxed); ++ __my_atomic_ref(mutable_bytes[i]).load(std::memory_order_relaxed); + PerformNibbleToHexAndWriteIntoStringOutPut(byte, index, string_output); + index += 2; + } +@@ -1082,7 +1091,7 @@ + result = HandleRemainingHexValues(input_vector, i); + if (result.has_value()) { + if (is_shared) { +- std::atomic_ref(buffer[index++]) ++ __my_atomic_ref(buffer[index++]) + .store(result.value(), std::memory_order_relaxed); + } else { + buffer[index++] = result.value(); diff --git a/tur-chromium/chromium-stable/7008-use-SFINAE-in-base-containers.patch b/tur-chromium/chromium-stable/7008-use-SFINAE-in-base-containers.patch new file mode 100644 index 0000000..fc366be --- /dev/null +++ b/tur-chromium/chromium-stable/7008-use-SFINAE-in-base-containers.patch @@ -0,0 +1,154 @@ +This reverts commit https://github.com/chromium/chromium/commit/4f6cc657b0953fb353111d581c130858e90aec08 + +diff --git a/base/containers/buffer_iterator.h b/base/containers/buffer_iterator.h +index 61abd79721..e2d9528a24 100644 +--- a/base/containers/buffer_iterator.h ++++ b/base/containers/buffer_iterator.h +@@ -80,8 +80,8 @@ class BufferIterator { + + // Copies out an object. As compared to using `Object`, this avoids potential + // unaligned access which may be undefined behavior. +- template +- requires(std::is_trivially_copyable_v) ++ template >> + std::optional CopyObject() { + std::optional t; + if (remaining_.size() >= sizeof(T)) { +@@ -101,8 +101,8 @@ class BufferIterator { + // `CopyObject` as it avoids this problem entirely. + // TODO(danakj): We should probably CHECK this instead of allowing UB into + // production. +- template +- requires(std::is_trivially_copyable_v) ++ template >> + const T* Object() { + return MutableObject(); + } +@@ -117,8 +117,8 @@ class BufferIterator { + // `CopyObject` as it avoids this problem entirely. + // TODO(danakj): We should probably CHECK this instead of allowing UB into + // production. +- template +- requires(std::is_trivially_copyable_v) ++ template >> + T* MutableObject() { + T* t = nullptr; + if (remaining_.size() >= sizeof(T)) { +@@ -142,8 +142,8 @@ class BufferIterator { + // using the span will cause Undefined Behaviour. + // TODO(danakj): We should probably CHECK this instead of allowing UB into + // production. +- template +- requires(std::is_trivially_copyable_v) ++ template >> + span MutableSpan(size_t count) { + size_t byte_size; + if (!CheckMul(sizeof(T), count).AssignIfValid(&byte_size)) { +@@ -165,9 +165,10 @@ class BufferIterator { + + // An overload for when the size is known at compile time. The result will be + // a fixed-size span. +- template +- requires(N <= std::numeric_limits::max() / sizeof(T) && +- std::is_trivially_copyable_v) ++ template >> ++ requires(N <= std::numeric_limits::max() / sizeof(T)) + std::optional> MutableSpan() { + constexpr size_t byte_size = + N * sizeof(T); // Overflow is checked by `requires`. +@@ -193,17 +194,18 @@ class BufferIterator { + // using the span will cause Undefined Behaviour. + // TODO(danakj): We should probably CHECK this instead of allowing UB into + // production. +- template +- requires(std::is_trivially_copyable_v) ++ template >> + span Span(size_t count) { + return MutableSpan(count); + } + + // An overload for when the size is known at compile time. The result will be + // a fixed-size span. +- template +- requires(N <= std::numeric_limits::max() / sizeof(T) && +- std::is_trivially_copyable_v) ++ template >> ++ requires(N <= std::numeric_limits::max() / sizeof(T)) + std::optional> Span() { + return MutableSpan(); + } +diff --git a/base/containers/flat_map.h b/base/containers/flat_map.h +index 612e15f7ff..25158d4eb9 100644 +--- a/base/containers/flat_map.h ++++ b/base/containers/flat_map.h +@@ -234,12 +234,13 @@ class flat_map : public ::base::internal:: + iterator insert_or_assign(const_iterator hint, K&& key, M&& obj); + + template +- requires(std::is_constructible_v) +- std::pair try_emplace(K&& key, Args&&... args); ++ std::enable_if_t, ++ std::pair> ++ try_emplace(K&& key, Args&&... args); + + template +- requires(std::is_constructible_v) +- iterator try_emplace(const_iterator hint, K&& key, Args&&... args); ++ std::enable_if_t, iterator> ++ try_emplace(const_iterator hint, K&& key, Args&&... args); + + // -------------------------------------------------------------------------- + // General operations. +@@ -324,12 +325,10 @@ auto flat_map::insert_or_assign( + + template + template +- requires(std::is_constructible_v< +- typename flat_map::key_type, +- K &&>) + auto flat_map::try_emplace(K&& key, + Args&&... args) +- -> std::pair { ++ -> std::enable_if_t, ++ std::pair> { + return tree::emplace_key_args( + key, std::piecewise_construct, + std::forward_as_tuple(std::forward(key)), +@@ -338,13 +337,10 @@ auto flat_map::try_emplace(K&& key, + + template + template +- requires(std::is_constructible_v< +- typename flat_map::key_type, +- K &&>) + auto flat_map::try_emplace(const_iterator hint, + K&& key, + Args&&... args) +- -> iterator { ++ -> std::enable_if_t, iterator> { + return tree::emplace_hint_key_args( + hint, key, std::piecewise_construct, + std::forward_as_tuple(std::forward(key)), +diff --git a/base/containers/intrusive_heap.h b/base/containers/intrusive_heap.h +index d0a60ed748..70ecf19d91 100644 +--- a/base/containers/intrusive_heap.h ++++ b/base/containers/intrusive_heap.h +@@ -572,8 +572,7 @@ class IntrusiveHeap { + private: + // Templated version of ToIndex that lets insert/erase/Replace work with all + // integral types. +- template +- requires(std::is_integral_v) ++ template >> + size_type ToIndex(I pos) { + return static_cast(pos); + } diff --git a/tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch b/tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch deleted file mode 100644 index dde3901..0000000 --- a/tur-chromium/chromium-stable/7008-xnnpack-clang-18.patch +++ /dev/null @@ -1,27 +0,0 @@ -https://github.com/llvm/llvm-project/issues/132013 -https://github.com/google/XNNPACK/commit/8a2f5f441833b80806b58b5d704ec8335634182c - ---- a/third_party/xnnpack/src/src/xnnpack/simd/f16-avx512fp16.h -+++ b/third_party/xnnpack/src/src/xnnpack/simd/f16-avx512fp16.h -@@ -27,8 +27,21 @@ typedef __m512h xnn_simd_f16_t; - const xnn_simd_f16_t var = _mm512_castsi512_ph(_mm512_set1_epi16(val)); - - #if XNN_HAVE_FLOAT16 -+ -+#if defined(__clang__) && (__clang_major__ < 19) -+static XNN_INLINE __m512d xnn_broadcast_16_512_workaround(uint16_t x) { -+ uint32_t bits = (uint32_t)x | ((uint32_t)x) << 16; -+ __asm__ volatile("" : "=m"(bits) : "m"(bits)); -+ return _mm512_castsi512_pd(_mm512_set1_epi32(bits)); -+} -+#define XNN_SIMD_CONST_F16_FROM_FLOAT(var, val) \ -+ const xnn_simd_f16_t var = xnn_broadcast_16_512_workaround( \ -+ xnn_float16_to_bits(xnn_float16_from_float(val))) -+#else - #define XNN_SIMD_CONST_F16_FROM_FLOAT(var, val) \ - const xnn_simd_f16_t var = _mm512_set1_ph(xnn_float16_from_float(val)) -+#endif // Old Clang workaround -+ - #else - #define XNN_SIMD_CONST_F16_FROM_FLOAT(var, val) \ - XNN_SIMD_CONST_F16_FROM_INT16( \ diff --git a/tur-chromium/chromium-stable/build.sh b/tur-chromium/chromium-stable/build.sh index 0a1173c..8cae5b4 100644 --- a/tur-chromium/chromium-stable/build.sh +++ b/tur-chromium/chromium-stable/build.sh @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://www.chromium.org/Home TERMUX_PKG_DESCRIPTION="Chromium web browser" TERMUX_PKG_LICENSE="BSD 3-Clause" TERMUX_PKG_MAINTAINER="Chongyun Lee " -TERMUX_PKG_VERSION=136.0.7103.113 +TERMUX_PKG_VERSION=137.0.7151.55 TERMUX_PKG_SRCURL=https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$TERMUX_PKG_VERSION.tar.xz -TERMUX_PKG_SHA256=7c765bd13df842a28bb52279b8d711411ac6082151473e07bd70b9a482c0a0ac +TERMUX_PKG_SHA256=b11e76fd82745db5602ce151ae931cc5e56c3ee2b6e08c2fbf788bf4b3ea84cb TERMUX_PKG_DEPENDS="atk, cups, dbus, fontconfig, gtk3, krb5, libc++, libdrm, libevdev, libxkbcommon, libminizip, libnss, libwayland, libx11, mesa, openssl, pango, pulseaudio, zlib" TERMUX_PKG_BUILD_DEPENDS="libffi-static" # Chromium doesn't support i686 on Linux. @@ -158,7 +158,7 @@ treat_warnings_as_errors = false # Use system libraries as little as possible use_system_freetype = false # use_system_libdrm = true -use_system_libffi = false +# use_system_libffi = false use_custom_libcxx = false use_custom_libcxx_for_host = true use_allocator_shim = false @@ -197,6 +197,9 @@ enable_nacl = false is_cfi = false use_cfi_icall = false use_thin_lto = false +# OpenCL doesn't work out of box in Termux, use NNAPI instead +build_tflite_with_opencl = false +build_tflite_with_nnapi = true # Enable rust custom_target_rust_abi_target = \"$CARGO_TARGET_NAME\" llvm_android_mainline = true From 3b4e7fac490c131e17c9fe8b748f0c015c0a2d90 Mon Sep 17 00:00:00 2001 From: Chongyun Lee <45286352+licy183@users.noreply.github.com> Date: Fri, 6 Jun 2025 21:07:27 +0800 Subject: [PATCH 2/3] Create 0006-iwyu-opener_heuristic_utils.patch --- .../0006-iwyu-opener_heuristic_utils.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tur-chromium/chromium-stable/0006-iwyu-opener_heuristic_utils.patch diff --git a/tur-chromium/chromium-stable/0006-iwyu-opener_heuristic_utils.patch b/tur-chromium/chromium-stable/0006-iwyu-opener_heuristic_utils.patch new file mode 100644 index 0000000..5b2f262 --- /dev/null +++ b/tur-chromium/chromium-stable/0006-iwyu-opener_heuristic_utils.patch @@ -0,0 +1,14 @@ +https://github.com/chromium/chromium/commit/4c736420952f355f18bdc4f4ea2d16e4514fa034 + +--- a/content/browser/tpcd_heuristics/opener_heuristic_utils.h ++++ b/content/browser/tpcd_heuristics/opener_heuristic_utils.h +@@ -6,6 +6,9 @@ + #define CONTENT_BROWSER_TPCD_HEURISTICS_OPENER_HEURISTIC_UTILS_H_ + + #include ++#include ++#include ++#include + + #include "base/types/optional_ref.h" + #include "content/common/content_export.h" From 7dac684d4eb0765377146021097d740794044ad7 Mon Sep 17 00:00:00 2001 From: Chongyun Lee <45286352+licy183@users.noreply.github.com> Date: Mon, 9 Jun 2025 13:13:01 +0800 Subject: [PATCH 3/3] Create 0007-iwyu-disruptive_notification_permissions_manager.patch --- ...disruptive_notification_permissions_manager.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tur-chromium/chromium-stable/0007-iwyu-disruptive_notification_permissions_manager.patch diff --git a/tur-chromium/chromium-stable/0007-iwyu-disruptive_notification_permissions_manager.patch b/tur-chromium/chromium-stable/0007-iwyu-disruptive_notification_permissions_manager.patch new file mode 100644 index 0000000..6375d32 --- /dev/null +++ b/tur-chromium/chromium-stable/0007-iwyu-disruptive_notification_permissions_manager.patch @@ -0,0 +1,12 @@ +https://github.com/chromium/chromium/commit/48b64da89b3ecb7ccb576a334b19b3066dd2b793 + +--- a/chrome/browser/ui/safety_hub/disruptive_notification_permissions_manager.h ++++ b/chrome/browser/ui/safety_hub/disruptive_notification_permissions_manager.h +@@ -6,6 +6,7 @@ + #define CHROME_BROWSER_UI_SAFETY_HUB_DISRUPTIVE_NOTIFICATION_PERMISSIONS_MANAGER_H_ + + #include ++#include + + #include "base/scoped_observation.h" + #include "base/time/clock.h"