Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions meta-chromium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ and/or Yocto.

This layer depends on:

* URI: git://git.openembedded.org/openembedded-core
* URI: git://git.yoctoproject.org/poky
- branch: master
- revision: HEAD
- revision: 243d54fd466f5f852cc0fdcce57997918ce35f32

* URI: git://git.openembedded.org/meta-openembedded
- layers: meta-oe
- branch: master
- revision: HEAD
- revision: a8dfd10600035a799abae03178fc7054582ea43d

* URI: git://github.com/kraj/meta-clang
- branch: master
- revision: HEAD
- revision: 7a2f83360920b10214e2659e17a4b9cba2d0435b

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion meta-chromium/conf/layer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ BBFILE_PATTERN_chromium-browser-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_chromium-browser-layer = "7"

LAYERVERSION_chromium-browser-layer = "1"
LAYERSERIES_COMPAT_chromium-browser-layer = "scarthgap styhead walnascar"
LAYERSERIES_COMPAT_chromium-browser-layer = "scarthgap styhead walnascar whinlatter"

LAYERDEPENDS_chromium-browser-layer = "clang-layer core openembedded-layer"
81 changes: 46 additions & 35 deletions meta-chromium/recipes-browser/chromium/chromium-gn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,11 @@ SRC_URI += "\
file://0008-Use-the-correct-path-to-libclang_rt.builtins.a.patch \
file://0009-Adjust-the-Rust-build-to-our-needs.patch \
file://0010-Don-t-require-profiler_builtins.rlib.patch \
file://0011-Revert-Allow-and-use-std-hardware_destructive_interf.patch \
file://0012-Revert-Set-Rust-symbol-visibility-to-hidden-when-C-s.patch \
file://0013-pdfium-Fix-missing-PDFiumAPIStringBufferAdapter-temp.patch \
file://0014-Revert-Remove-libavif-based-AVIF-decoder.patch \
file://0015-Revert-Remove-third_party-libavif.patch \
file://0016-Disable-crabbyavif-to-fix-build-errors.patch \
file://0017-rust-Use-adler-instead-of-adler2.patch \
file://0018-third_party-node-update_node_binaries-Update-nodejs-.patch \
file://0019-Reduce-minimum-browser-window-width-to-480px.patch \
file://0020-rust-filter-out-arm-specific-flags-from-rust-compile.patch \
file://0021-chromium-fix-v4l2-compiler-error-on-arm.patch \
file://0011-fix-check_version-Only-compare-node.js-major-version.patch \
file://0012-chromium-fix-v4l2-compiler-error-on-arm.patch \
file://0013-Reduce-minimum-browser-window-width-to-480px.patch \
"

# Missing third_party sources.
SRC_URI += "\
git://chromium.googlesource.com/external/github.com/AOMediaCodec/libavif;protocol=https;branch=main;name=libavif;destsuffix=third_party/libavif/src \
"

SRCREV_FORMAT .= "_libavif"
SRCREV_libavif = "e7b34a1f5e9f7024d08311c7bae156061b889882"

# ARM/AArch64-specific patches.
SRC_URI:append:aarch64 = "${@bb.utils.contains('TUNE_FEATURES', 'crypto', '', ' file://arm/0001-Fix-AES-crypto-SIGILL-on-rpi4-64.patch', d)}"

Expand Down Expand Up @@ -139,10 +123,10 @@ PACKAGECONFIG[use-egl] = ",,virtual/egl virtual/libgles2"
# be necessary but are OK to add).
PACKAGECONFIG[component-build] = ""

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

PACKAGECONFIG[cups] = "use_cups=true,use_cups=false,cups"
PACKAGECONFIG[gtk4] = ""
Expand Down Expand Up @@ -281,6 +265,10 @@ GN_ARGS += "disable_fieldtrial_testing_config=true"
# See https://crrev.com/c/2424669
GN_ARGS += "chrome_pgo_phase=0"

# Disable passing --warning-suppression-mappings= flag to clang.
# This feature is available on Clang21+
GN_ARGS += "clang_warning_suppression_file="""

# API keys for accessing Google services. By default, we use an invalid key
# only to prevent the "you are missing an API key" infobar from being shown on
# startup.
Expand All @@ -300,6 +288,9 @@ GN_ARGS += ' \
BUILD_CPPFLAGS:append:runtime-llvm = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
# Use libgcc for native parts
BUILD_LDFLAGS:append:runtime-llvm = " -rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
LDFLAGS:append:runtime-llvm = " --target=${TARGET_SYS}"
CXXFLAGS:append:runtime-llvm = " --target=${TARGET_SYS} -nostdlib++"
CFLAGS:append:runtime-llvm = " --target=${TARGET_SYS}"

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

# Linking rust with partitionalloc is problematic in arm32
GN_ARGS:append:arm = ' \
arm_float_abi="${ARM_FLOAT_ABI}" \
arm_fpu="${ARM_FPU}" \
arm_tune="${ARM_TUNE}" \
arm_version=${ARM_VERSION} \
use_partition_alloc_as_malloc=false \
enable_backup_ref_ptr_support=false \
'
# tcmalloc's atomicops-internals-arm-v6plus.h uses the "dmb" instruction that
# is not available on (some?) ARMv6 models, which causes the build to fail.
GN_ARGS:append:armv6 = ' use_partition_alloc_as_malloc=false enable_backup_ref_ptr_support=false'

# The WebRTC code fails to build on ARMv6 when NEON is enabled.
# https://bugs.chromium.org/p/webrtc/issues/detail?id=6574
GN_ARGS:append:armv6 = ' arm_use_neon=false'
Expand Down Expand Up @@ -447,6 +439,7 @@ python do_write_toolchain_file () {
toolchain_file = os.path.join(toolchain_dir, "BUILD.gn")
write_toolchain_file(d, toolchain_file)
}

addtask write_toolchain_file after do_patch before do_configure

do_add_nodejs_symlink () {
Expand All @@ -468,16 +461,34 @@ do_add_clang_latest () {
# directory that is a copy of /usr/lib/clang/$CLANG_VERSION. Chromium
# manually links against libclang_rt.builtins.a and uses the `clang_version`
# GN variable to find it. This allows us to set it to the same value for all
# Yocto releases.
# Yocto releases. Also copy headers so bindgen can find system headers.
cd "${STAGING_LIBDIR_NATIVE}/clang"
rm -rf latest
# find the directory containing the library

# Find a directory with runtime libraries and copy it as base
for dir in *; do
if [ -n "$(find $dir -name 'libclang_rt.builtins*')" ] ; then
if [ -d "$dir" ] && [ -n "$(find $dir -name 'libclang_rt.builtins*' 2>/dev/null)" ]; then
echo "Copying clang directory $dir to latest (runtime libraries)"
cp -r "$dir" latest
break
fi
done

# Find and copy headers from any versioned directory to ensure bindgen can find them
headers_copied=false
for dir in *; do
if [ -d "$dir/include" ]; then
echo "Found headers in $dir/include, copying to latest/include"
mkdir -p latest/include
cp -r "$dir/include/"* latest/include/
headers_copied=true
break
fi
done

if [ "$headers_copied" = false ]; then
echo "Warning: No Clang headers found in any versioned directories"
fi
}
addtask add_clang_latest after do_configure before do_compile

Expand All @@ -502,15 +513,15 @@ do_copy_target_rustlibs () {
}
addtask copy_target_rustlibs after do_configure before do_compile

do_copy_missing_third_party_sources () {
rm -rf ${S}/third_party/libavif/src
cp -r ${UNPACKDIR}/third_party/libavif/src/ ${S}/third_party/libavif/
}
addtask copy_missing_third_party_sources after do_patch before do_configure

do_configure() {
cd ${S}
python3 ./build/linux/unbundle/replace_gn_files.py --system-libraries ${GN_UNBUNDLE_LIBS}

# Add Rust-style target triples (converted by Yocto's rust-common.bbclass)
grep -qxF "${RUST_TARGET_SYS}" ${S}/build/rust/known-target-triples.txt || echo "${RUST_TARGET_SYS}" >> ${S}/build/rust/known-target-triples.txt
grep -qxF "${RUST_HOST_SYS}" ${S}/build/rust/known-target-triples.txt || echo "${RUST_HOST_SYS}" >> ${S}/build/rust/known-target-triples.txt
grep -qxF "${RUST_BUILD_SYS}" ${S}/build/rust/known-target-triples.txt || echo "${RUST_BUILD_SYS}" >> ${S}/build/rust/known-target-triples.txt

gn gen --args='${GN_ARGS}' "${OUTPUT_DIR}"
}

Expand Down
Loading