- Enable system libcxx

- Fix link error when building with system libcxx
- Apply memory-allocator-dcheck-assert-fix for aarch64
This commit is contained in:
Than Ngo 2025-11-24 09:28:20 +01:00 committed by Asahi Lina
commit 2a9bd95cc9
2 changed files with 50 additions and 9 deletions

View file

@ -19,6 +19,13 @@
# official builds have less debugging and go faster... but we have to shut some things off.
%global official_build 1
# enable|disble use_custom_libcxx
%global use_custom_libcxx 0
%if 0%{?rhel}
# no libcxx in el
%global use_custom_libcxx 1
%endif
# enable|disble bootstrap
%global bootstrap 0
# workaround for old gn on el9, it causes build error: unknown function filter_labels_include()
@ -141,9 +148,6 @@
# enable|disable control flow integrity support
%global cfi 0
%ifarch x86_64
%global cfi 0
%endif
## CEF: QT builds are not relevant
%global use_qt6 0
@ -256,6 +260,9 @@ Patch20: chromium-disable-font-tests.patch
# don't download binary blob
Patch21: chromium-123-screen-ai-service.patch
# Fix link error when building with system libcxx
Patch22: chromium-131-fix-qt-ui.pach
# Disable tests on remoting build
Patch82: chromium-98.0.4758.102-remoting-no-tests.patch
@ -349,6 +356,8 @@ Patch316: chromium-122-clang-build-flags.patch
# unknown warning option -Wno-nontrivial-memcall
Patch317: chromium-142-clang++-unknown-argument.patch
Patch318: memory-allocator-dcheck-assert-fix.patch
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2239523
# https://bugs.chromium.org/p/chromium/issues/detail?id=1145581#c60
# Disable BTI until this is fixed upstream.
@ -416,7 +425,6 @@ Patch402: fix-rust-linking.patch
Patch403: fix-breakpad-compile.patch
Patch404: fix-partition-alloc-compile.patch
Patch405: fix-study-crash.patch
Patch406: memory-allocator-dcheck-assert-fix.patch
Patch407: fix-different-data-layouts.patch
Patch408: 0002-Add-ppc64-trap-instructions.patch
@ -496,6 +504,10 @@ BuildRequires: clang-tools-extra
BuildRequires: llvm
BuildRequires: lld
%if ! %{use_custom_libcxx}
BuildRequires: libcxx-devel
%endif
%if 0%{?rhel} && 0%{?rhel} <= 9
BuildRequires: gcc-toolset-14-libatomic-devel
%endif
@ -939,6 +951,9 @@ mv %{_builddir}/cef-%{cef_commit} ./cef
%patch -P20 -p1 -b .disable-font-test
%patch -P21 -p1 -b .screen-ai-service
%if ! %{use_custom_libcxx}
%patch -P22 -p1 -b .fix-qt-ui
%endif
%patch -P82 -p1 -b .remoting-no-tests
@ -1017,6 +1032,8 @@ mv %{_builddir}/cef-%{cef_commit} ./cef
%patch -P317 -p1 -b .clang++-unsupported-argument
%endif
%patch -P318 -p1 -b .memory-allocator-dcheck-assert-fix
%if %{disable_bti}
%patch -P352 -p1 -b .workaround_for_crash_on_BTI_capable_system
%endif
@ -1063,7 +1080,6 @@ mv %{_builddir}/cef-%{cef_commit} ./cef
%patch -P403 -p1 -b .fix-breakpad-compile
%patch -P404 -p1 -b .fix-partition-alloc-compile
%patch -P405 -p1 -b .fix-study-crash
%patch -P406 -p1 -b .memory-allocator-dcheck-assert-fix
%patch -P407 -p1 -b .fix-different-data-layouts
%patch -P408 -p1 -b .0002-Add-ppc64-trap-instructions
%patch -P409 -p1 -b .fix-page-allocator-overflow
@ -1229,6 +1245,11 @@ CXXFLAGS="$FLAGS"
CXXFLAGS+=' -faltivec-src-compat=mixed -Wno-deprecated-altivec-src-compat'
%endif
%if ! %{use_custom_libcxx}
LDFLAGS="${LDFLAGS} -stdlib=libc++"
CXXFLAGS="${CXXFLAGS} -stdlib=libc++"
%endif
export CC=clang
export CXX=clang++
export AR=llvm-ar
@ -1236,6 +1257,7 @@ export NM=llvm-nm
export READELF=llvm-readelf
export CFLAGS
export CXXFLAGS
export LDFLAGS
# need for error: the option `Z` is only accepted on the nightly compiler
export RUSTC_BOOTSTRAP=1
@ -1259,6 +1281,9 @@ CHROMIUM_CORE_GN_DEFINES=""
# using system toolchain
CHROMIUM_CORE_GN_DEFINES+=' custom_toolchain="//build/toolchain/linux/unbundle:default"'
CHROMIUM_CORE_GN_DEFINES+=' host_toolchain="//build/toolchain/linux/unbundle:default"'
%if ! %{use_custom_libcxx}
CHROMIUM_BROWSER_GN_DEFINES+=' use_custom_libcxx=false'
%endif
CHROMIUM_CORE_GN_DEFINES+=' is_debug=false dcheck_always_on=false dcheck_is_configurable=false'
CHROMIUM_CORE_GN_DEFINES+=' enable_enterprise_companion=false'
CHROMIUM_CORE_GN_DEFINES+=' system_libdir="%{_lib}"'
@ -1307,10 +1332,7 @@ CHROMIUM_CORE_GN_DEFINES+=' symbol_level=%{debug_level} blink_symbol_level=%{deb
CHROMIUM_CORE_GN_DEFINES+=' angle_has_histograms=false'
# drop unrar
CHROMIUM_CORE_GN_DEFINES+=' safe_browsing_use_unrar=false'
# Disable --warning-suppression-mappings as it causes FTBFS on el/f40/f41 due to old llvm
%if 0%{?rhel} || 0%{?fedora} == 40 || 0%{?fedora} == 41
CHROMIUM_CORE_GN_DEFINES+=' clang_warning_suppression_file=""'
%endif
CHROMIUM_CORE_GN_DEFINES+=' v8_enable_backtrace=true'
export CHROMIUM_CORE_GN_DEFINES
# browser gn defines

View file

@ -0,0 +1,19 @@
From b9075d0e1f687f9a5cf80a7778bde99cece9fdf7 Mon Sep 17 00:00:00 2001
From: Than Ngo <than@redhat.com>
Date: Sat, 23 Nov 2024 12:33:22 +0100
Subject: [PATCH] Enable qt-ui
diff -up chromium-131.0.6778.85/ui/qt/qt_shim.cc.me chromium-131.0.6778.85/ui/qt/qt_shim.cc
--- chromium-131.0.6778.85/ui/qt/qt_shim.cc.me 2024-11-23 10:04:16.789121846 +0100
+++ chromium-131.0.6778.85/ui/qt/qt_shim.cc 2024-11-23 11:40:02.905064702 +0100
@@ -265,7 +265,7 @@ FontRenderParams QtShim::GetFontRenderPa
FontDescription QtShim::GetFontDescription() const {
QFont font = app_.font();
return {
- .family = String(font.family().toStdString().c_str()),
+ .family = String(font.family().toUtf8().constData()),
.size_pixels = font.pixelSize(),
.size_points = font.pointSize(),
.is_italic = IsStyleItalic(font.style()),