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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 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 = "whinlatter"

LAYERDEPENDS_chromium-browser-layer = "clang-layer core openembedded-layer"
LAYERDEPENDS_chromium-browser-layer = "core openembedded-layer"
101 changes: 52 additions & 49 deletions meta-chromium/recipes-browser/chromium/chromium-gn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,13 @@ SRC_URI += "\
file://0005-avoid-link-latomic-failure-on-CentOS-8-host.patch \
file://0006-Don-t-pass-unknown-LLVM-options.patch \
file://0007-Fix-constexpr-variable-must-be-initialized-by-a-cons.patch \
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://23d818d3c7fba4658248f17fd7b8993199242aa9.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 @@ -92,6 +75,7 @@ DEPENDS += " \
libwebp \
libxkbcommon \
libxslt \
lld-native \
ninja-native \
nodejs-native \
nspr \
Expand All @@ -106,7 +90,7 @@ DEPENDS += " \
rust-native \
virtual/libgl \
"
DEPENDS:append:runtime-llvm = " compiler-rt compiler-rt-native libcxx-native"
DEPENDS:append = " compiler-rt compiler-rt-native libcxx-native"
DEPENDS:append:libc-musl = " libexecinfo"

LDFLAGS:append:libc-musl = " -lexecinfo"
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 @@ -297,9 +285,12 @@ GN_ARGS += ' \
'

# Use libcxx headers for native parts
BUILD_CPPFLAGS:append:runtime-llvm = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
BUILD_CPPFLAGS:append = " -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}"
BUILD_LDFLAGS:append = " -rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}"
LDFLAGS:append = " --target=${TARGET_SYS}"
CXXFLAGS:append = " --target=${TARGET_SYS} -nostdlib++"
CFLAGS:append = " --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,29 +461,39 @@ 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

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

Expand All @@ -502,15 +505,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 Expand Up @@ -627,4 +630,4 @@ ALLOW_EMPTY:${PN}-dev = "0"

# ERROR: QA Issue: lib32-chromium-ozone-wayland: ELF binary /usr/bin/chromium has relocations in .text [textrel]
INSANE_SKIP:${PN}:append:x86 = "textrel"

INSANE_SKIP:${PN}-dbg:append = "buildpaths"
Loading