Skip to content

Commit 7dcc0a9

Browse files
committed
docs: update extending-runtime documentation
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent bb1d0dd commit 7dcc0a9

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

docs/extending-runtime.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,20 @@ libc stubs) — no copying files or build scripts needed.
7474

7575
### 3. Build and embed in hyperlight-js
7676

77-
Build your custom runtime for the Hyperlight target and embed it:
77+
Set `HYPERLIGHT_CFLAGS` before building. The hyperlight target has no libc —
78+
QuickJS needs the stub headers from `hyperlight-js-runtime/include/` and
79+
`-D__wasi__=1` to disable pthreads.
7880

7981
```bash
80-
# Build for the hyperlight target
81-
cargo hyperlight build --manifest-path my-custom-runtime/Cargo.toml
82+
export HYPERLIGHT_CFLAGS=$(node -e "
83+
var m=JSON.parse(require('child_process').execSync(
84+
'cargo metadata --format-version 1 --manifest-path my-custom-runtime/Cargo.toml',
85+
{encoding:'utf8',stdio:['pipe','pipe','pipe']}));
86+
var p=m.packages.find(function(p){return p.name==='hyperlight-js-runtime'});
87+
console.log('-I'+require('path').join(require('path').dirname(p.manifest_path),'include')+' -D__wasi__=1');
88+
")
8289

83-
# Build hyperlight-js with your custom runtime embedded
84-
HYPERLIGHT_JS_RUNTIME_PATH=/path/to/my-custom-runtime \
85-
cargo build -p hyperlight-js
90+
cargo hyperlight build --manifest-path my-custom-runtime/Cargo.toml
8691
```
8792

8893
### 4. Use from the host

0 commit comments

Comments
 (0)