Compile wasi-common to Emscripten (#688)
* Compile wasi-common to Emscripten This commit enables cross-compiling of `wasi-common` to Emscripten. To achieve this, this commit does quite a bit reshuffling in the existing codebase. Namely, * rename `linux` modules in `wasi-common` and `yanix` to `linux_like` -- this is needed so that we can separate out logic specific to Linux and Emscripten out * tweak `dir` module in `yanix` to support Emscripten -- in particular, the main change involves `SeekLoc::from_raw` which has to be now host-specific, and is now fallible * tweak `filetime` so that in Emscripten we never check for existence of `utimensat` at runtime since we are guaranteed for it to exist by design * since `utimes` and `futimes` are not present in Emscripten, move them into a separate module, `utimesat`, and tag it cfg-non-emscripten only * finally, `to_timespec` is now fallible since on Emscripten we have to cast number of seconds, `FileTime::seconds` from `i64` to `libc::c_long` which resolves to `i32` unlike on other nixes * Fix macos build * Verify wasi-common compiles to Emscripten This commit adds `emscripten` job to Github Actions which installs `wasm32-unknown-emscripten` target, and builds `wasi-common` crate. * Use #[path] to cherry-pick mods for Emscripten This commit effectively reverses the reorg introduced in 145f4a5 in that it ditches `linux_like` mod for separate mods `linux` and `emscripten` which are now on the same crate level, and instead, pulls in common bits from `linux` using the `#[path = ..]` proc macro.
This commit is contained in:
committed by
Alex Crichton
parent
ddd2300010
commit
95c2addf15
13
.github/workflows/main.yml
vendored
13
.github/workflows/main.yml
vendored
@@ -87,6 +87,19 @@ jobs:
|
||||
- run: cargo fuzz run instantiate_translated --release --debug-assertions -- -runs=0
|
||||
- run: cargo fuzz run api_calls --release --debug-assertions -- -runs=0
|
||||
|
||||
# Install wasm32-unknown-emscripten target, and ensure `crates/wasi-common`
|
||||
# compiles to Emscripten.
|
||||
emscripten:
|
||||
name: Emscripten
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- uses: ./.github/actions/install-rust
|
||||
- run: rustup target add wasm32-unknown-emscripten
|
||||
- run: cargo build --target wasm32-unknown-emscripten -p wasi-common
|
||||
|
||||
# Perform all tests (debug mode) for `wasmtime`. This runs stable/beta/nightly
|
||||
# channels of Rust as well as macOS/Linux/Windows.
|
||||
test:
|
||||
|
||||
Reference in New Issue
Block a user