Skip to content

Commit 499473f

Browse files
committed
web: Use RUSTC_BOOTSTRAP for MVP vanilla WASM module instead of nightly
1 parent e7671d0 commit 499473f

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

web/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ to update to the latest stable version of rust. You may run `rustup update` to d
4545
rust using the above instructions).
4646

4747
For the compiler to be able to output WebAssembly, an additional target has to be added to it: `rustup target add wasm32-unknown-unknown`
48+
Because we use `RUSTC_BOOTSTRAP` in order to use certain Nightly flags with stable Rust you will also need to run `rustup component add rust-src`.
4849

4950
#### Java
5051

@@ -106,7 +107,6 @@ In this project, you may run the following commands to build all packages:
106107
- There is `npm run build:dual-wasm` as well, to build a second WebAssembly module that makes use of some WebAssembly extensions,
107108
potentially resulting in better performance in browsers that support them, at the expense of longer build time.
108109
- `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.
109-
- 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.
110110

111111
From here, you may follow the instructions to [use Ruffle on your website](packages/selfhosted/README.md),
112112
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).

web/packages/core/tools/build_wasm.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,12 @@ function cargoBuild({
4949
rustFlags?: string[];
5050
extensions?: boolean;
5151
}) {
52-
let args =
53-
!extensions && process.env["BUILD_WASM_MVP"]
54-
? [
55-
process.env["NIGHTLY_VERSION"]
56-
? `+nightly-${process.env["NIGHTLY_VERSION"]}`
57-
: "+nightly",
58-
"build",
59-
"--locked",
60-
"-Z",
61-
"build-std=std,panic_abort",
62-
"--target",
63-
"wasm32-unknown-unknown",
64-
]
65-
: ["build", "--locked", "--target", "wasm32-unknown-unknown"];
52+
let args = ["build", "--locked", "--target", "wasm32-unknown-unknown"];
53+
if (!extensions) {
54+
args.push("-Z");
55+
args.push("build-std=std,panic_abort");
56+
}
57+
6658
if (profile) {
6759
args.push("--profile", profile);
6860
}
@@ -88,6 +80,7 @@ function cargoBuild({
8880
execFileSync("cargo", args, {
8981
env: Object.assign(Object.assign({}, process.env), {
9082
RUSTFLAGS: totalRustFlags,
83+
RUSTC_BOOTSTRAP: extensions ? '0' : '1',
9184
}),
9285
stdio: "inherit",
9386
});
@@ -110,13 +103,12 @@ function buildWasm(
110103
);
111104
wasmBindgenFlags.push("--reference-types");
112105
wasmOptFlags.push("--enable-reference-types");
106+
} else {
107+
rustFlags.push("-C", "target-cpu=mvp");
113108
}
114109
let originalWasmPath;
115110
if (wasmSource === "cargo" || wasmSource === "cargo_and_store") {
116111
console.log(`Building ${flavor} with cargo...`);
117-
if (process.env["BUILD_WASM_MVP"]) {
118-
rustFlags.push("-C", "target-cpu=mvp");
119-
}
120112
cargoBuild({
121113
profile,
122114
rustFlags,

0 commit comments

Comments
 (0)