Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinh Tran committed Nov 9, 2023
1 parent 960c70a commit b15175b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
4 changes: 1 addition & 3 deletions examples/toolchain-to-rebuild-std/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ build --@rules_rust//rust/settings:experimental_toolchain_generated_sysroot=True
# enable toolchain debugging by default
build --toolchain_resolution_debug='@rules_rust//rust:toolchain_type'

# for toolchain debugging purposes
build:beta --@rules_rust//rust/toolchain/channel:channel=beta
build:stable --@rules_rust//rust/toolchain/channel:channel=stable
build:nightly --@rules_rust//rust/toolchain/channel:channel=nightly

build:apple --platforms=//:aarch64-apple-darwin
build:wasi --platforms=//:wasm32-wasi
32 changes: 30 additions & 2 deletions examples/toolchain-to-rebuild-std/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@

This directory demonstrates an example of how to rebuild the standard library
for an arbitrary platform and custom configurations.

TODO: Write up on how the toolchain bootrapping process works.

To build an end-user rust_library target for specific target, run

```
bazel build //hello_lib --platforms=//:aarch64-apple-darwin
```

for `aarch64-apple-darwin` or

```
bazel build //hello_lib --platforms=//:wasm32-wasi
```

for `wasm32-wasi`.

The toolchains orderly registered in WORKSPACE and _beta_channel_transition ensure
that the standard library is rebuilt for the given platform.

To only rebuild std, run

```
bazel build @stdlbs//:std --platforms=//:aarch64-apple-darwin
```

or

```
bazel build //hello_lib --config=apple
bazel build //hello_lib --config=wasi
bazel build @stdlbs//:std --platforms=//:wasm32-wasi
```

0 comments on commit b15175b

Please sign in to comment.