commit:     8e8209db6d60ccc49174f67677861f8c05e8af6e
Author:     Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  9 23:12:29 2024 +0000
Commit:     Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Wed Oct  9 23:42:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8e8209db

www-client/chromium: make rust profiler sanity check more reliable

On ppc64le the machine hardware name printed out by 'uname -m'
is 'ppc64le' but the rust target is called 'powerpc64le'.
As a result, the build process will always die even if
we're using a rust compiler built with USE='profiler'.

Use this opportunity to tighten up some language in the ebuild
and elaborate more in comments.

Closes: https://bugs.gentoo.org/940729
Co-authored-by: zin0 <z_i_n_o <AT> bluewin.ch>
Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>

 www-client/chromium/chromium-129.0.6668.100.ebuild | 13 +++++++------
 www-client/chromium/chromium-130.0.6723.31.ebuild  | 13 +++++++------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/www-client/chromium/chromium-129.0.6668.100.ebuild 
b/www-client/chromium/chromium-129.0.6668.100.ebuild
index 8e7bb65e1f26..09204febe4d7 100644
--- a/www-client/chromium/chromium-129.0.6668.100.ebuild
+++ b/www-client/chromium/chromium-129.0.6668.100.ebuild
@@ -409,19 +409,20 @@ pkg_setup() {
 
                        local rustc_ver=$(chromium_extract_rust_version)
                        if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
-                                       eerror "Rust >=${RUST_MIN_VER} is 
required"
-                                       eerror "Please run 'eselect rust' and 
select the correct rust version"
-                                       die "Selected rust version is too old"
+                                       eerror "Rust >=${RUST_MIN_VER} is 
required to build Chromium"
+                                       eerror "The currently selected version 
is ${rustc_ver}"
+                                       eerror "Please run \`eselect rust\` and 
select an appropriate Rust."
+                                       die "Selected Rust version is too old"
                        else
-                                       einfo "Using rust ${rustc_ver} to build"
+                                       einfo "Using Rust ${rustc_ver} to build"
                        fi
 
                        # Chromium requires the Rust profiler library while 
setting up its build environment.
                        # Since a standard Rust comes with the profiler, 
instead of patching it out (build/rust/std/BUILD.gn#L103)
                        # we'll just do a sanity check on the selected slot.
+                       # The -bin always contains profiler support, so we only 
need to check for the non-bin version.
                        if [[ "$(eselect --brief rust show 2>/dev/null)" != 
*"bin"* ]]; then
-                               local arch=$(uname -m)
-                               local 
rust_lib_path="${EPREFIX}/usr/lib/rust/${rustc_ver}/lib/rustlib/${arch}-unknown-linux-gnu/lib"
+                               local rust_lib_path="${EPREFIX}$(rustc --print 
target-libdir)"
                                local profiler_lib=$(find "${rust_lib_path}" 
-name "libprofiler_builtins-*.rlib" -print -quit)
                                if [[ -z "${profiler_lib}" ]]; then
                                        eerror "Rust ${rustc_ver} is missing 
the profiler library."

diff --git a/www-client/chromium/chromium-130.0.6723.31.ebuild 
b/www-client/chromium/chromium-130.0.6723.31.ebuild
index 4247ea726933..b0a2f66dec81 100644
--- a/www-client/chromium/chromium-130.0.6723.31.ebuild
+++ b/www-client/chromium/chromium-130.0.6723.31.ebuild
@@ -409,19 +409,20 @@ pkg_setup() {
 
                        local rustc_ver=$(chromium_extract_rust_version)
                        if ver_test "${rustc_ver}" -lt "${RUST_MIN_VER}"; then
-                                       eerror "Rust >=${RUST_MIN_VER} is 
required"
-                                       eerror "Please run 'eselect rust' and 
select the correct rust version"
-                                       die "Selected rust version is too old"
+                                       eerror "Rust >=${RUST_MIN_VER} is 
required to build Chromium"
+                                       eerror "The currently selected version 
is ${rustc_ver}"
+                                       eerror "Please run \`eselect rust\` and 
select an appropriate Rust."
+                                       die "Selected Rust version is too old"
                        else
-                                       einfo "Using rust ${rustc_ver} to build"
+                                       einfo "Using Rust ${rustc_ver} to build"
                        fi
 
                        # Chromium requires the Rust profiler library while 
setting up its build environment.
                        # Since a standard Rust comes with the profiler, 
instead of patching it out (build/rust/std/BUILD.gn#L103)
                        # we'll just do a sanity check on the selected slot.
+                       # The -bin always contains profiler support, so we only 
need to check for the non-bin version.
                        if [[ "$(eselect --brief rust show 2>/dev/null)" != 
*"bin"* ]]; then
-                               local arch=$(uname -m)
-                               local 
rust_lib_path="${EPREFIX}/usr/lib/rust/${rustc_ver}/lib/rustlib/${arch}-unknown-linux-gnu/lib"
+                               local rust_lib_path="${EPREFIX}$(rustc --print 
target-libdir)"
                                local profiler_lib=$(find "${rust_lib_path}" 
-name "libprofiler_builtins-*.rlib" -print -quit)
                                if [[ -z "${profiler_lib}" ]]; then
                                        eerror "Rust ${rustc_ver} is missing 
the profiler library."

Reply via email to