diff --git a/examples/toolchain-to-rebuild-std/.bazelrc b/examples/toolchain-to-rebuild-std/.bazelrc index f5de358a8b..f8fc03a8f5 100644 --- a/examples/toolchain-to-rebuild-std/.bazelrc +++ b/examples/toolchain-to-rebuild-std/.bazelrc @@ -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 diff --git a/examples/toolchain-to-rebuild-std/README b/examples/toolchain-to-rebuild-std/README index 3083e25cfc..bd843eb953 100644 --- a/examples/toolchain-to-rebuild-std/README +++ b/examples/toolchain-to-rebuild-std/README @@ -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 ``` \ No newline at end of file