forked from OSSystems/meta-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chromium: Depend on libstd-rs instead of rust
Fixes OSSystems#792. Build and patch changes: ------------------------ In OSSystems#782, we decided to depend on rust instead of libstd-rs, because the latter didn't include libprofiler_builtins and also used a naming scheme that trips up Chromium. However, in OSSystems#791 we decided to patch Chromium so that it doesn't need libprofiler_builtins any more, because the master version of the rust recipe also doesn't include it. Finally, while investigating OSSystems#792 it turned out that our approach breaks as soon as we have something that depends on libstd-rs in our dependency graph. In that scenario, both libstd-rs and rust (the latter due to our bbappend file) install Rust libraries to /usr/lib/rustlib. This first leads to Chromium build system errors (due to libstd-rs's naming scheme), and after fixing these to Rust compiler errors due to multiple versions being present. The conclusion is now that we can depend on libstd-rs we should do so. This only requires a small change to Chromium's Rust build scripts to adapt them to the slightly different naming scheme. License changes: ---------------- Added licenses: none. Removed licenses: none. Updated licenses: none. Test-built: ----------- * chromium-wayland: - nanbield, clang, MACHINE=qemuarm64 * chromium-x11: - master, clang, MACHINE=qemuarm Signed-off-by: Max Ihlenfeldt <[email protected]>
- Loading branch information
1 parent
ab76411
commit 7c95a8e
Showing
4 changed files
with
31 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,8 @@ Signed-off-by: Max Ihlenfeldt <[email protected]> | |
build/config/rust.gni | 24 +++++++++++++++++------ | ||
build/rust/rustc_wrapper.py | 1 + | ||
build/rust/std/BUILD.gn | 33 ++++++++++++++++++++++++-------- | ||
build/rust/std/find_std_rlibs.py | 13 ++++++++++--- | ||
4 files changed, 54 insertions(+), 17 deletions(-) | ||
build/rust/std/find_std_rlibs.py | 17 +++++++++++----- | ||
4 files changed, 56 insertions(+), 19 deletions(-) | ||
|
||
diff --git a/build/config/rust.gni b/build/config/rust.gni | ||
index e98d913..6213b72 100644 | ||
|
@@ -166,9 +166,18 @@ index 77f4b8c..8a25798 100644 | |
# The host builds tools toolchain supports Rust only and does not use | ||
# the allocator remapping to point it to PartitionAlloc. | ||
diff --git a/build/rust/std/find_std_rlibs.py b/build/rust/std/find_std_rlibs.py | ||
index 386258f..25fdedc 100755 | ||
index 386258f..3bb6a41 100755 | ||
--- a/build/rust/std/find_std_rlibs.py | ||
+++ b/build/rust/std/find_std_rlibs.py | ||
@@ -17,7 +17,7 @@ import re | ||
from collections import defaultdict | ||
|
||
EXPECTED_STDLIB_INPUT_REGEX = re.compile(r"([0-9a-z_]+)(?:-([0-9]+))?$") | ||
-RLIB_NAME_REGEX = re.compile(r"lib([0-9a-z_]+)-([0-9a-f]+)\.rlib$") | ||
+RLIB_NAME_REGEX = re.compile(r"lib([0-9a-z_]+)(-([0-9a-f]+))?\.rlib$") | ||
|
||
|
||
def main(): | ||
@@ -52,6 +52,8 @@ def main(): | ||
rustc_args.extend(["--target", args.target]) | ||
rustlib_dir = subprocess.check_output(rustc_args).rstrip().decode() | ||
|
@@ -187,6 +196,15 @@ index 386258f..25fdedc 100755 | |
|
||
def copy_file(infile, outfile): | ||
depfile.write(f" {infile}") | ||
@@ -99,7 +101,7 @@ def main(): | ||
# the correct file path to our linker invocations, we don't need | ||
# that, and it would prevent us having the predictable filenames | ||
# which we need for statically computable gn dependency rules. | ||
- (crate_name, metadata) = RLIB_NAME_REGEX.match(f).group(1, 2) | ||
+ (crate_name, metadata) = RLIB_NAME_REGEX.match(f).group(1, 3) | ||
|
||
# Use the number of times we've seen this name to disambiguate the output | ||
# filenames. Since we sort the input filenames including the metadata, | ||
@@ -117,14 +119,19 @@ def main(): | ||
output_filename = f"lib{concise_name}.rlib" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FILES:${PN} += "${libdir}/rustlib/*/target.json" | ||
|
||
# Without this, rustc fails with "could not find specification for target ...". | ||
do_install:append() { | ||
target_dir=`realpath "${D}${rustlibdir}"/..` | ||
target_triple=`basename "${target_dir}"` | ||
target_json="${target_dir}/target.json" | ||
RUSTC_BOOTSTRAP=1 rustc -Z unstable-options --print target-spec-json --target "${target_triple}" > "${target_json}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters