Merge pull request #614 from thewtex/add-web-wasi

web-wasi: Initial addition
This commit is contained in:
Matt McCormick 2021-10-11 08:38:56 -04:00 committed by GitHub
commit a315bdcef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 81 additions and 3 deletions

View File

@ -745,6 +745,23 @@ jobs:
cpython: "no",
cpython_arg: "",
}
- {
image: "web-wasi",
stockfish: "no",
stockfish_arg: "",
ninja: "no",
ninja_arg: "",
openssl: "no",
openssl_arg: "linux-generic64 no-asm no-threads no-engine no-hw no-weak-ssl-ciphers no-dtls no-shared no-dso",
C: "no",
C_arg: "",
C-Plus-Plus: "no",
C-Plus-Plus_arg: "",
fmt: "no",
fmt_arg: "",
cpython: "no",
cpython_arg: "",
}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2

View File

@ -19,6 +19,7 @@ STANDARD_IMAGES = android-arm android-arm64 android-x86 android-x86_64 \
linux-armv6 linux-armv6-lts linux-armv6-musl linux-arm64-lts \
linux-armv7l-musl linux-armv7 linux-armv7a linux-x86_64-full \
linux-mips linux-ppc64le linux-riscv64 linux-riscv32 linux-xtensa-uclibc \
web-wasi \
windows-static-x86 windows-static-x64 windows-static-x64-posix windows-armv7 \
windows-shared-x86 windows-shared-x64 windows-shared-x64-posix windows-arm64
@ -27,7 +28,7 @@ GEN_IMAGES = android-arm android-arm64 \
linux-x86 linux-x64 linux-x64-clang linux-arm64 linux-arm64-musl linux-arm64-full \
manylinux2014-x64 manylinux2014-x86 \
manylinux2014-aarch64 linux-arm64-lts \
web-wasm linux-mips windows-arm64 windows-armv7 \
web-wasm web-wasi linux-mips windows-arm64 windows-armv7 \
windows-static-x86 windows-static-x64 windows-static-x64-posix \
windows-shared-x86 windows-shared-x64 windows-shared-x64-posix \
linux-armv7 linux-armv7a linux-armv7l-musl linux-x86_64-full \

View File

@ -105,7 +105,8 @@ The dockcross script will execute the given command-line inside the container, a
| dockcross/linux-x86_64-full | x86_64 | GCC + libs | Linux |
| dockcross/linux-x64-clang | x86_64 | Clang | Linux |
| dockcross/linux-x64-tinycc | x86_64 | tinycc + GCC | Linux |
| dockcross/web-wasm | JS | LLVM | Web (JS) |
| dockcross/web-wasm | Wasm | LLVM | Web (JS) |
| dockcross/web-wasi | Wasm | LLVM | Web (Universal) |
| dockcross/windows-shared-x86 | x86 | GCC | Windows |
| dockcross/windows-shared-x64 | x86_64 | GCC | Windows |
| dockcross/windows-shared-x64-posix | x86_64 | GCC | Windows |
@ -315,7 +316,13 @@ Docker [manylinux2014](https://github.com/pypa/manylinux) image for building Lin
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/dockcross/web-wasm/latest) ![Docker Pulls](https://img.shields.io/docker/pulls/dockcross/web-wasm)
The Emscripten WebAssembly/asm.js/JavaScript cross compiler.
The [Emscripten](https://emscripten.org/) [WebAssembly](https://webassembly.org/)/JavaScript cross compiler.
### dockcross/web-wasi
![Docker Image Size (tag)](https://img.shields.io/docker/image-size/dockcross/web-wasi/latest) ![Docker Pulls](https://img.shields.io/docker/pulls/dockcross/web-wasi)
The [WebAssembly System Interface (WASI)](https://wasi.dev/) SDK LLVM/Clang/WASI Sysroot cross compiler.
### dockcross/windows-static-x64

32
web-wasi/Dockerfile.in Normal file
View File

@ -0,0 +1,32 @@
FROM dockcross/base:latest
LABEL maintainer="Matt McCormick matt.mccormick@kitware.com"
# The cross-compiling emulator
ENV WASMER_DIR /usr/local/wasmer
RUN curl https://get.wasmer.io -sSfL | sh
ENV PATH /usr/local/wasmer/bin:${PATH}
ENV WASI_VERSION 12
ENV WASI_VERSION_FULL ${WASI_VERSION}.0
RUN cd /usr/ && \
curl -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
tar xvzf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz && \
rm wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
ENV WASI_SDK_PATH /usr/wasi-sdk-${WASI_VERSION_FULL}
ENV WASI_SYSROOT ${WASI_SDK_PATH}/share/wasi-sysroot
COPY clang-wasi-sysroot.sh clang++-wasi-sysroot.sh wasmer-pwd.sh /usr/local/bin/
ENV CROSS_TRIPLE=wasm32-wasi
ENV CROSS_ROOT=${WASI_SDK_PATH}
ENV ANDROID_NDK=${CROSS_ROOT}
ENV AR=${CROSS_ROOT}/bin/llvm-ar \
CC=clang-wasi-sysroot.sh \
CXX=clang++-wasi-sysroot.sh \
LD=${CROSS_ROOT}/bin/wasm-ld
COPY Toolchain.cmake ${CROSS_ROOT}/
ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake
#include "common.label-and-env"

11
web-wasi/Toolchain.cmake Normal file
View File

@ -0,0 +1,11 @@
set(WASI 1)
include($ENV{WASI_SDK_PATH}/share/cmake/wasi-sdk.cmake)
set(CMAKE_FIND_ROOT_PATH $ENV{CROSS_ROOT})
set(CMAKE_SYSROOT $ENV{WASI_SYSROOT})
set(CMAKE_C_COMPILER /usr/local/bin/clang-wasi-sysroot.sh)
set(CMAKE_CXX_COMPILER /usr/local/bin/clang++-wasi-sysroot.sh)
set(CMAKE_CROSSCOMPILING_EMULATOR /usr/local/bin/wasmer-pwd.sh)

View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
exec ${WASI_SDK_PATH}/bin/clang++ --sysroot=${WASI_SYSROOT} "$@"

3
web-wasi/clang-wasi-sysroot.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
exec ${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SYSROOT} "$@"

4
web-wasi/wasmer-pwd.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# Mount the PWD to enable access in try_run commands
exec /usr/local/wasmer/bin/wasmer run --dir=. --dir=$PWD "$@"