Skip to content

Commit

Permalink
web: Use RUSTC_BOOTSTRAP for MVP vanilla WASM module instead of nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhjacobs committed Jan 8, 2025
1 parent e7671d0 commit b5220e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ In this project, you may run the following commands to build all packages:
- There is `npm run build:dual-wasm` as well, to build a second WebAssembly module that makes use of some WebAssembly extensions,
potentially resulting in better performance in browsers that support them, at the expense of longer build time.
- `npm run build:repro` enables reproducible builds. Note that this also requires a `version_seal.json`, which is not provided in the normal Git repository - only specially-marked reproducible source archives. Running this without a version seal will generate one based on the current state of your environment.
- With either of the prior two commands, you can set the environment variable `BUILD_WASM_MVP=1`. This will build the vanilla WASM module using nightly Rust and disable all WebAssembly features that Rust enables by default. You will first need to run the command `rustup target add wasm32-unknown-unknown --toolchain nightly` so nightly Rust can also output WebAssembly.
- With either of the prior two commands, you can set the environment variable `BUILD_WASM_MVP=1`. This will build the vanilla WASM module using RUSTC_BOOTSTRAP and disable all WebAssembly features that Rust enables by default. You will first need to run the command `rustup component add rust-src`.

From here, you may follow the instructions to [use Ruffle on your website](packages/selfhosted/README.md),
run a demo locally with `npm run demo`, or [install the extension in your browser](https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle#browser-extension).
Expand Down
21 changes: 7 additions & 14 deletions web/packages/core/tools/build_wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,12 @@ function cargoBuild({
rustFlags?: string[];
extensions?: boolean;
}) {
let args =
!extensions && process.env["BUILD_WASM_MVP"]
? [
process.env["NIGHTLY_VERSION"]
? `+nightly-${process.env["NIGHTLY_VERSION"]}`
: "+nightly",
"build",
"--locked",
"-Z",
"build-std=std,panic_abort",
"--target",
"wasm32-unknown-unknown",
]
: ["build", "--locked", "--target", "wasm32-unknown-unknown"];
let args = ["build", "--locked", "--target", "wasm32-unknown-unknown"];
if (!extensions) {
args.push("-Z");
args.push("build-std=std,panic_abort");
}

if (profile) {
args.push("--profile", profile);
}
Expand All @@ -88,6 +80,7 @@ function cargoBuild({
execFileSync("cargo", args, {
env: Object.assign(Object.assign({}, process.env), {
RUSTFLAGS: totalRustFlags,
RUSTC_BOOTSTRAP: extensions ? '0' : '1',
}),
stdio: "inherit",
});
Expand Down

0 comments on commit b5220e4

Please sign in to comment.