Skip to content

Commit 3fdf307

Browse files
committed
Merge branch 'upstream-pr-923'
OSSystems#923 OSSystems#920
2 parents 6954886 + 9937b22 commit 3fdf307

27 files changed

+363
-4806
lines changed

meta-chromium/conf/layer.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ BBFILE_PATTERN_chromium-browser-layer := "^${LAYERDIR}/"
99
BBFILE_PRIORITY_chromium-browser-layer = "7"
1010

1111
LAYERVERSION_chromium-browser-layer = "1"
12-
LAYERSERIES_COMPAT_chromium-browser-layer = "scarthgap styhead walnascar"
12+
LAYERSERIES_COMPAT_chromium-browser-layer = "whinlatter"
1313

14-
LAYERDEPENDS_chromium-browser-layer = "clang-layer core openembedded-layer"
14+
LAYERDEPENDS_chromium-browser-layer = "core openembedded-layer"

meta-chromium/recipes-browser/chromium/chromium-gn.inc

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,12 @@ SRC_URI += "\
2222
file://0005-avoid-link-latomic-failure-on-CentOS-8-host.patch \
2323
file://0006-Don-t-pass-unknown-LLVM-options.patch \
2424
file://0007-Fix-constexpr-variable-must-be-initialized-by-a-cons.patch \
25-
file://0008-Use-the-correct-path-to-libclang_rt.builtins.a.patch \
2625
file://0009-Adjust-the-Rust-build-to-our-needs.patch \
2726
file://0010-Don-t-require-profiler_builtins.rlib.patch \
28-
file://0011-Revert-Allow-and-use-std-hardware_destructive_interf.patch \
29-
file://0012-Revert-Set-Rust-symbol-visibility-to-hidden-when-C-s.patch \
30-
file://0013-pdfium-Fix-missing-PDFiumAPIStringBufferAdapter-temp.patch \
31-
file://0014-Revert-Remove-libavif-based-AVIF-decoder.patch \
32-
file://0015-Revert-Remove-third_party-libavif.patch \
33-
file://0016-Disable-crabbyavif-to-fix-build-errors.patch \
34-
file://0017-rust-Use-adler-instead-of-adler2.patch \
35-
file://0018-third_party-node-update_node_binaries-Update-nodejs-.patch \
36-
file://0019-Reduce-minimum-browser-window-width-to-480px.patch \
37-
file://0020-rust-filter-out-arm-specific-flags-from-rust-compile.patch \
38-
file://0021-chromium-fix-v4l2-compiler-error-on-arm.patch \
27+
file://0011-fix-check_version-Only-compare-node.js-major-version.patch \
28+
file://0012-chromium-fix-v4l2-compiler-error-on-arm.patch \
3929
"
4030

41-
# Missing third_party sources.
42-
SRC_URI += "\
43-
git://chromium.googlesource.com/external/github.com/AOMediaCodec/libavif;protocol=https;branch=main;name=libavif;destsuffix=third_party/libavif/src \
44-
"
45-
46-
SRCREV_FORMAT .= "_libavif"
47-
SRCREV_libavif = "e7b34a1f5e9f7024d08311c7bae156061b889882"
48-
4931
# ARM/AArch64-specific patches.
5032
SRC_URI:append:aarch64 = "${@bb.utils.contains('TUNE_FEATURES', 'crypto', '', ' file://arm/0001-Fix-AES-crypto-SIGILL-on-rpi4-64.patch', d)}"
5133

@@ -92,6 +74,7 @@ DEPENDS += " \
9274
libwebp \
9375
libxkbcommon \
9476
libxslt \
77+
lld-native \
9578
ninja-native \
9679
nodejs-native \
9780
nspr \
@@ -106,7 +89,7 @@ DEPENDS += " \
10689
rust-native \
10790
virtual/libgl \
10891
"
109-
DEPENDS:append:runtime-llvm = " compiler-rt compiler-rt-native libcxx-native"
92+
DEPENDS:append = " compiler-rt compiler-rt-native libcxx-native"
11093
DEPENDS:append:libc-musl = " libexecinfo"
11194

11295
LDFLAGS:append:libc-musl = " -lexecinfo"
@@ -139,10 +122,10 @@ PACKAGECONFIG[use-egl] = ",,virtual/egl virtual/libgles2"
139122
# be necessary but are OK to add).
140123
PACKAGECONFIG[component-build] = ""
141124

142-
# Starting with M61, Chromium defaults to building with its own copy of libc++
143-
# instead of the system's libstdc++. Add a knob to control this behavior
144-
# https://groups.google.com/a/chromium.org/d/msg/chromium-packagers/8aYO3me2SCE/SZ8pJXhZAwAJ
145-
PACKAGECONFIG[custom-libcxx] = "use_custom_libcxx=true,use_custom_libcxx=false,,"
125+
# As of Chromium 138, libc++ is required unconditionally.
126+
# https://docs.google.com/document/d/193ig0qeM23rK1yH6bW14O3zIgVztyKaY4R1XRwgmUFk/edit?usp=sharing
127+
# Force use_custom_libcxx=true as Chromium 138+ requires libc++
128+
GN_ARGS += "use_custom_libcxx=true"
146129

147130
PACKAGECONFIG[cups] = "use_cups=true,use_cups=false,cups"
148131
PACKAGECONFIG[gtk4] = ""
@@ -281,6 +264,10 @@ GN_ARGS += "disable_fieldtrial_testing_config=true"
281264
# See https://crrev.com/c/2424669
282265
GN_ARGS += "chrome_pgo_phase=0"
283266

267+
# Disable passing --warning-suppression-mappings= flag to clang.
268+
# This feature is available on Clang21+
269+
GN_ARGS += "clang_warning_suppression_file="""
270+
284271
# API keys for accessing Google services. By default, we use an invalid key
285272
# only to prevent the "you are missing an API key" infobar from being shown on
286273
# startup.
@@ -297,9 +284,12 @@ GN_ARGS += ' \
297284
'
298285

299286
# Use libcxx headers for native parts
300-
BUILD_CPPFLAGS:append:runtime-llvm = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
287+
BUILD_CPPFLAGS:append = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
301288
# Use libgcc for native parts
302-
BUILD_LDFLAGS:append:runtime-llvm = " -rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
289+
BUILD_LDFLAGS:append = " -rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
290+
LDFLAGS:append = " --target=${TARGET_SYS}"
291+
CXXFLAGS:append = " --target=${TARGET_SYS} -nostdlib++"
292+
CFLAGS:append = " --target=${TARGET_SYS}"
303293

304294
# Toolchains we will use for the build. We need to point to the toolchain file
305295
# we've created, set the right target architecture and make sure we are not
@@ -367,15 +357,16 @@ ARM_VERSION:armv6 = "6"
367357
# overriding what GN wants
368358
TUNE_CCARGS:remove = "-mthumb"
369359

360+
# Linking rust with partitionalloc is problematic in arm32
370361
GN_ARGS:append:arm = ' \
371362
arm_float_abi="${ARM_FLOAT_ABI}" \
372363
arm_fpu="${ARM_FPU}" \
373364
arm_tune="${ARM_TUNE}" \
374365
arm_version=${ARM_VERSION} \
366+
use_partition_alloc_as_malloc=false \
367+
enable_backup_ref_ptr_support=false \
375368
'
376-
# tcmalloc's atomicops-internals-arm-v6plus.h uses the "dmb" instruction that
377-
# is not available on (some?) ARMv6 models, which causes the build to fail.
378-
GN_ARGS:append:armv6 = ' use_partition_alloc_as_malloc=false enable_backup_ref_ptr_support=false'
369+
379370
# The WebRTC code fails to build on ARMv6 when NEON is enabled.
380371
# https://bugs.chromium.org/p/webrtc/issues/detail?id=6574
381372
GN_ARGS:append:armv6 = ' arm_use_neon=false'
@@ -447,6 +438,7 @@ python do_write_toolchain_file () {
447438
toolchain_file = os.path.join(toolchain_dir, "BUILD.gn")
448439
write_toolchain_file(d, toolchain_file)
449440
}
441+
450442
addtask write_toolchain_file after do_patch before do_configure
451443

452444
do_add_nodejs_symlink () {
@@ -468,29 +460,39 @@ do_add_clang_latest () {
468460
# directory that is a copy of /usr/lib/clang/$CLANG_VERSION. Chromium
469461
# manually links against libclang_rt.builtins.a and uses the `clang_version`
470462
# GN variable to find it. This allows us to set it to the same value for all
471-
# Yocto releases.
463+
# Yocto releases. Also copy headers so bindgen can find system headers.
472464
cd "${STAGING_LIBDIR_NATIVE}/clang"
473465
rm -rf latest
474-
# find the directory containing the library
466+
467+
# Find a directory with runtime libraries and copy it as base
475468
for dir in *; do
476-
if [ -n "$(find $dir -name 'libclang_rt.builtins*')" ] ; then
469+
if [ -d "$dir" ] && [ -n "$(find $dir -name 'libclang_rt.builtins*' 2>/dev/null)" ]; then
470+
echo "Copying clang directory $dir to latest (runtime libraries)"
477471
cp -r "$dir" latest
478472
break
479473
fi
480474
done
475+
476+
# Find and copy headers from any versioned directory to ensure bindgen can find them
477+
headers_copied=false
478+
for dir in *; do
479+
if [ -d "$dir/include" ]; then
480+
echo "Found headers in $dir/include, copying to latest/include"
481+
mkdir -p latest/include
482+
cp -r "$dir/include/"* latest/include/
483+
headers_copied=true
484+
break
485+
fi
486+
done
487+
488+
if [ "$headers_copied" = false ]; then
489+
echo "Warning: No Clang headers found in any versioned directories"
490+
fi
481491
}
482492
addtask add_clang_latest after do_configure before do_compile
483493

484494
do_copy_clang_library () {
485-
# Chromium needs to link against libclang_rt.builtins.a for both host and
486-
# target code, and expects to find both libraries in the same directory
487-
# (thanks to 0008-Use-the-correct-path-to-libclang_rt.builtins.a.patch).
488-
cd "${STAGING_DIR_HOST}${nonarch_libdir}/clang"
489-
# lib_file = "./$CLANG_VERSION/lib/linux/libclang_rt.builtins-$ARCH.a"
490-
lib_file="$(find . -name 'libclang_rt.builtins*')"
491-
# stripped_lib_file = "lib/linux/libclang_rt.builtins-$ARCH.a"
492-
stripped_lib_file="${lib_file#*/*/}"
493-
cp "$lib_file" "${STAGING_LIBDIR_NATIVE}/clang/latest/${stripped_lib_file}"
495+
cp -r ${STAGING_LIBDIR_NATIVE}/clang/latest ${STAGING_DIR_HOST}${nonarch_libdir}/clang/
494496
}
495497
addtask copy_clang_library after do_add_clang_latest before do_compile
496498

@@ -502,15 +504,15 @@ do_copy_target_rustlibs () {
502504
}
503505
addtask copy_target_rustlibs after do_configure before do_compile
504506

505-
do_copy_missing_third_party_sources () {
506-
rm -rf ${S}/third_party/libavif/src
507-
cp -r ${UNPACKDIR}/third_party/libavif/src/ ${S}/third_party/libavif/
508-
}
509-
addtask copy_missing_third_party_sources after do_patch before do_configure
510-
511507
do_configure() {
512508
cd ${S}
513509
python3 ./build/linux/unbundle/replace_gn_files.py --system-libraries ${GN_UNBUNDLE_LIBS}
510+
511+
# Add Rust-style target triples (converted by Yocto's rust-common.bbclass)
512+
grep -qxF "${RUST_TARGET_SYS}" ${S}/build/rust/known-target-triples.txt || echo "${RUST_TARGET_SYS}" >> ${S}/build/rust/known-target-triples.txt
513+
grep -qxF "${RUST_HOST_SYS}" ${S}/build/rust/known-target-triples.txt || echo "${RUST_HOST_SYS}" >> ${S}/build/rust/known-target-triples.txt
514+
grep -qxF "${RUST_BUILD_SYS}" ${S}/build/rust/known-target-triples.txt || echo "${RUST_BUILD_SYS}" >> ${S}/build/rust/known-target-triples.txt
515+
514516
gn gen --args='${GN_ARGS}' "${OUTPUT_DIR}"
515517
}
516518

@@ -627,4 +629,4 @@ ALLOW_EMPTY:${PN}-dev = "0"
627629

628630
# ERROR: QA Issue: lib32-chromium-ozone-wayland: ELF binary /usr/bin/chromium has relocations in .text [textrel]
629631
INSANE_SKIP:${PN}:append:x86 = "textrel"
630-
632+
INSANE_SKIP:${PN}-dbg:append = "buildpaths"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)