diff --git a/meta-chromium/conf/layer.conf b/meta-chromium/conf/layer.conf index d2de2af72..51facae73 100644 --- a/meta-chromium/conf/layer.conf +++ b/meta-chromium/conf/layer.conf @@ -9,6 +9,17 @@ 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" +CHROMIUM_LEGACY_COMPAT = "scarthgap styhead walnascar" +CHROMIUM_COMPAT = "whinlatter" +LAYERSERIES_COMPAT_chromium-browser-layer = "${CHROMIUM_LEGACY_COMPAT} ${CHROMIUM_COMPAT}" +WHINLATTER_OR_NEWER = "${@bb.utils.contains_any('LAYERSERIES_CORENAMES', d.getVar('CHROMIUM_COMPAT'), '1', '0', d)}" +LAYERDEPENDS_chromium-browser-layer = "${@ '' if d.getVar('WHINLATTER_OR_NEWER') == '1' else 'clang-layer'} core openembedded-layer" -LAYERDEPENDS_chromium-browser-layer = "clang-layer core openembedded-layer" +# In whinlatter the UNPACKDIR location has changed, and paths created using +# the ${WORKDIR} variable are not valid anymore. However older versions still +# require these. + +WHINLATTER_S_PARENT = "${UNPACKDIR}" +NON_WHINLATTER_S_PARENT = "${WORKDIR}" + +CORRECT_S_PARENT = "${@d.getVar('WHINLATTER_S_PARENT') if d.getVar('WHINLATTER_OR_NEWER') == '1' else d.getVar('NON_WHINLATTER_S_PARENT')}" diff --git a/meta-chromium/recipes-browser/chromium/chromium-gn.inc b/meta-chromium/recipes-browser/chromium/chromium-gn.inc index 640ede0a8..4d4b0eea0 100644 --- a/meta-chromium/recipes-browser/chromium/chromium-gn.inc +++ b/meta-chromium/recipes-browser/chromium/chromium-gn.inc @@ -22,8 +22,8 @@ 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 \ + ${@'' if d.getVar('WHINLATTER_OR_NEWER') == '1' else 'file://0008-Use-the-correct-path-to-libclang_rt.builtins.a.patch'} \ + ${@'' if d.getVar('WHINLATTER_OR_NEWER') == '1' else '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 \ @@ -31,9 +31,10 @@ SRC_URI += "\ 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 \ + ${@'' if d.getVar('WHINLATTER_OR_NEWER') == '1' else '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-Do-not-use-fuse-ld-option.patch' if d.getVar('WHINLATTER_OR_NEWER') == '1' else ''} \ " # Missing third_party sources. @@ -104,7 +105,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" @@ -198,7 +199,7 @@ GN_ARGS += 'host_pkg_config="pkg-config-native"' GN_ARGS += "is_debug=false is_official_build=true" # Use lld linker its quicker see https://lld.llvm.org/#performance -GN_ARGS += "use_lld=true use_gold=false" +GN_ARGS += "${@'' if d.getVar('WHINLATTER_OR_NEWER') == '1' else 'use_lld=true use_gold=false'}" # By default, passing is_official_build=true to GN causes its symbol_level # variable to be set to "2". This means the compiler will be passed "-g2" and @@ -288,9 +289,9 @@ 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}" # 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 @@ -473,15 +474,19 @@ do_add_clang_latest () { 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}" + if [ "${@d.getVar('WHINLATTER_OR_NEWER')}" = "1" ]; then + cp -r ${STAGING_LIBDIR_NATIVE}/clang/latest ${STAGING_DIR_HOST}${nonarch_libdir}/clang/ + else + # 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}" + fi } addtask copy_clang_library after do_add_clang_latest before do_compile diff --git a/meta-chromium/recipes-browser/chromium/chromium.inc b/meta-chromium/recipes-browser/chromium/chromium.inc index e2a4f585f..8ded77a0c 100644 --- a/meta-chromium/recipes-browser/chromium/chromium.inc +++ b/meta-chromium/recipes-browser/chromium/chromium.inc @@ -6,7 +6,7 @@ CVE_PRODUCT = "chromium:chromium google:chrome" SRC_URI = "https://commondatastorage.googleapis.com/chromium-browser-official/chromium-${PV}.tar.xz" SRC_URI[sha256sum] = "7c765bd13df842a28bb52279b8d711411ac6082151473e07bd70b9a482c0a0ac" -S = "${WORKDIR}/chromium-${PV}" +S = "${CORRECT_S_PARENT}/chromium-${PV}" # GCC is not tested or officially supported upstream, and supporting it here # requires an ever-growing amount of backports and custom patches, without any @@ -16,6 +16,8 @@ TOOLCHAIN = "clang" # By default, clang.bbclass sets TOOLCHAIN:class-native to "gcc", but we want # to build the native recipes (e.g. GN) with clang too. TOOLCHAIN:class-native = "clang" +# TOOLCHAIN_NATIVE is needed by whinlatter +TOOLCHAIN_NATIVE = "clang" # This makes the target build use libc++ and compiler_rt instead of the GNU # runtime, just like upstream does. The native binaries compiled and run as diff --git a/meta-chromium/recipes-browser/chromium/files/0020-Do-not-use-fuse-ld-option.patch b/meta-chromium/recipes-browser/chromium/files/0020-Do-not-use-fuse-ld-option.patch new file mode 100644 index 000000000..97ef329a1 --- /dev/null +++ b/meta-chromium/recipes-browser/chromium/files/0020-Do-not-use-fuse-ld-option.patch @@ -0,0 +1,70 @@ +Signed-off-by: Zoltán Böszörményi +Upstream-Status: Inappropriate [CLANG 20 specific] + +--- chromium-136.0.7103.113/third_party/rust-src/src/llvm-project/llvm/utils/gn/build/BUILD.gn.old 2025-09-09 12:40:27.842667547 +0200 ++++ chromium-136.0.7103.113/third_party/rust-src/src/llvm-project/llvm/utils/gn/build/BUILD.gn 2025-09-09 12:41:30.112009903 +0200 +@@ -271,11 +271,6 @@ + } + } + +- # On Windows, the linker is not invoked through the compiler driver. +- if (use_lld && current_os != "win") { +- ldflags += [ "-fuse-ld=lld" ] +- } +- + if (llvm_build_instrumented_coverage) { + cflags += [ + "-fcoverage-mapping", +--- chromium-136.0.7103.113/third_party/perfetto/gn/standalone/toolchain/BUILD.gn.old 2025-09-09 12:40:23.179245164 +0200 ++++ chromium-136.0.7103.113/third_party/perfetto/gn/standalone/toolchain/BUILD.gn 2025-09-09 12:42:05.799617038 +0200 +@@ -236,10 +236,6 @@ + external_cxxflags = "" + external_ldflags = "" + strip = "" +- if (defined(invoker.linker) && invoker.linker != "") { +- _invoker_linker = invoker.linker +- ld_arg = "-fuse-ld=$_invoker_linker" +- } + if (defined(invoker.sysroot) && invoker.sysroot != "") { + _invoker_sysroot = invoker.sysroot + cc = "$cc --sysroot=$_invoker_sysroot" +--- chromium-136.0.7103.113/third_party/llvm/llvm/utils/gn/build/BUILD.gn.old 2025-09-09 12:40:17.058515953 +0200 ++++ chromium-136.0.7103.113/third_party/llvm/llvm/utils/gn/build/BUILD.gn 2025-09-09 12:42:11.424555115 +0200 +@@ -271,11 +271,6 @@ + } + } + +- # On Windows, the linker is not invoked through the compiler driver. +- if (use_lld && current_os != "win") { +- ldflags += [ "-fuse-ld=lld" ] +- } +- + if (llvm_build_instrumented_coverage) { + cflags += [ + "-fcoverage-mapping", +--- chromium-136.0.7103.113/third_party/instrumented_libs/noble/BUILD.gn.old 2025-09-09 12:40:12.186545761 +0200 ++++ chromium-136.0.7103.113/third_party/instrumented_libs/noble/BUILD.gn 2025-09-09 12:42:18.327479124 +0200 +@@ -121,7 +121,6 @@ + ] + package_ldflags = [ + "-fsanitize=memory", +- "-fuse-ld=lld", + "-Wl,--wrap=stat", + "-Wl,--wrap=fstat", + "-Wl,--wrap=lstat", +--- chromium-136.0.7103.113/build/config/compiler/BUILD.gn.old 2025-09-09 12:40:05.242765741 +0200 ++++ chromium-136.0.7103.113/build/config/compiler/BUILD.gn 2025-09-09 12:42:37.847264237 +0200 +@@ -387,13 +387,6 @@ + } + } + +- if (use_lld) { +- ldflags += [ "-fuse-ld=lld" ] +- if (lld_path != "") { +- ldflags += [ "-B$lld_path" ] +- } +- } +- + # Linker warnings. + if (fatal_linker_warnings && !is_apple && current_os != "aix" && + current_os != "zos") { diff --git a/meta-chromium/recipes-browser/chromium/gn-native_136.0.7103.113.bb b/meta-chromium/recipes-browser/chromium/gn-native_136.0.7103.113.bb index 5a3225be9..6e4d98304 100644 --- a/meta-chromium/recipes-browser/chromium/gn-native_136.0.7103.113.bb +++ b/meta-chromium/recipes-browser/chromium/gn-native_136.0.7103.113.bb @@ -6,7 +6,7 @@ require chromium.inc inherit native -S = "${WORKDIR}/chromium-${PV}" +S = "${CORRECT_S_PARENT}/chromium-${PV}" # bootstrap.py --no_clean hardcodes the build location to out_bootstrap. # Omitting --no_clean causes the script to create a temporary directory with a @@ -28,11 +28,11 @@ BUILD_LD = "${CXX}" BUILD_AR = "llvm-ar" DEPENDS = "clang-native ninja-native" -DEPENDS:append:runtime-llvm = " compiler-rt-native libcxx-native" +DEPENDS:append = " compiler-rt-native libcxx-native" # Use libcxx headers for native parts -CXXFLAGS:append:runtime-llvm = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++" +CXXFLAGS:append = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++" # Use libgcc for native parts -LDFLAGS:append:runtime-llvm = " -rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}" +LDFLAGS:append = " -rtlib=libgcc -unwindlib=libgcc -stdlib=libc++ -lc++abi -rpath ${STAGING_LIBDIR_NATIVE}" do_configure[noexec] = "1"