diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1578a94..68d6d99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/Makefile b/Makefile index e210337..4b0ba78 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/README.md b/README.md index 61752cf..714cf02 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/web-wasi/Dockerfile.in b/web-wasi/Dockerfile.in new file mode 100644 index 0000000..3399f44 --- /dev/null +++ b/web-wasi/Dockerfile.in @@ -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" diff --git a/web-wasi/Toolchain.cmake b/web-wasi/Toolchain.cmake new file mode 100644 index 0000000..bd75c38 --- /dev/null +++ b/web-wasi/Toolchain.cmake @@ -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) diff --git a/web-wasi/clang++-wasi-sysroot.sh b/web-wasi/clang++-wasi-sysroot.sh new file mode 100755 index 0000000..e95fefc --- /dev/null +++ b/web-wasi/clang++-wasi-sysroot.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +exec ${WASI_SDK_PATH}/bin/clang++ --sysroot=${WASI_SYSROOT} "$@" diff --git a/web-wasi/clang-wasi-sysroot.sh b/web-wasi/clang-wasi-sysroot.sh new file mode 100755 index 0000000..7c3586c --- /dev/null +++ b/web-wasi/clang-wasi-sysroot.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +exec ${WASI_SDK_PATH}/bin/clang --sysroot=${WASI_SYSROOT} "$@" diff --git a/web-wasi/wasmer-pwd.sh b/web-wasi/wasmer-pwd.sh new file mode 100755 index 0000000..4677ae8 --- /dev/null +++ b/web-wasi/wasmer-pwd.sh @@ -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 "$@"