@@ -16,7 +16,9 @@ to pull down or update submodules.
16
16
17
17
### Building the JS Compute Runtime
18
18
19
- To build from source, you need to have the following tools installed to successfully build, and build from a linux based system.
19
+ To build from source, you need to have the following tools installed to successfully build, depending on your system.
20
+
21
+ #### Linux
20
22
21
23
- Rust
22
24
```
@@ -58,6 +60,65 @@ Once that is done, the runtime and the CLI tool for applying it to JS source cod
58
60
npm run build
59
61
```
60
62
63
+ #### macOS (Apple silicon)
64
+
65
+ - Build tools
66
+ ``` sh
67
+ # First, install Xcode from the Mac App Store. Then:
68
+ sudo xcode-select --switch /Applications/Xcode.app
69
+ sudo xcodebuild -license
70
+ ```
71
+ - Homebrew
72
+ ``` sh
73
+ # From homebrew.sh
74
+ /bin/bash -c " $( curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh) "
75
+ ```
76
+ - wget
77
+ ``` sh
78
+ brew install wget
79
+ ```
80
+ - binaryen
81
+ ``` sh
82
+ brew install binaryen
83
+ ```
84
+ - Python 3.11 (Spidermonkey build requires a version before 3.12)
85
+ ``` sh
86
+
87
+ ```
88
+ - Rust
89
+ ``` sh
90
+ curl -so rust.sh https://sh.rustup.rs && sh rust.sh -y
91
+ # then, restart shell or run:
92
+ source $HOME /.cargo/env
93
+ ```
94
+ - rust target wasm32-wasi
95
+ ``` sh
96
+ rustup target add wasm32-wasi
97
+ ```
98
+ - [ cbindgen] ( https://github.com/eqrion/cbindgen#quick-start )
99
+ ``` sh
100
+ cargo install cbindgen
101
+ ```
102
+ - [ wasi-sdk, version 20] ( https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-20 ) ,
103
+ with alternate [ install instructions] ( https://github.com/WebAssembly/wasi-sdk#install )
104
+ ``` sh
105
+ curl -sS -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-macos.tar.gz
106
+ tar xf wasi-sdk-20.0-macos.tar.gz
107
+ sudo mkdir -p /opt/wasi-sdk
108
+ sudo mv wasi-sdk-20.0/* /opt/wasi-sdk/
109
+ ```
110
+
111
+ Once you have those installed, you will need to compile SpiderMonkey:
112
+ ``` sh
113
+ export PATH=
" /opt/homebrew/opt/[email protected] /libexec/bin:$PATH "
114
+ (cd runtime/spidermonkey && bash build-engine.sh)
115
+ ```
116
+
117
+ Once that is done, the runtime and the CLI tool for applying it to JS source code can be built using npm:
118
+ ``` sh
119
+ npm run build
120
+ ```
121
+
61
122
## Testing
62
123
63
124
The JS Compute Runtime has automated tests which run on all pull-requests. The test applications are located within <./integration-tests/js-compute>.
0 commit comments