diff --git a/web/README.md b/web/README.md index 4ed4aaecd3e16..4a9e199cdf0e8 100644 --- a/web/README.md +++ b/web/README.md @@ -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). diff --git a/web/packages/core/tools/build_wasm.ts b/web/packages/core/tools/build_wasm.ts index 4ffcef2e7199d..1dbd8eab224c9 100644 --- a/web/packages/core/tools/build_wasm.ts +++ b/web/packages/core/tools/build_wasm.ts @@ -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); } @@ -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", });