@@ -338,3 +338,81 @@ Feature detection flags:
338338*``__wasm_bulk_memory__``
339339*``__wasm_atomics__``
340340*``__wasm_mutable_globals__``
341+342+## Install SDKs and dependencies manually
343+344+In some cases (e.g. build bots) you may prefer to install build dependencies
345+directly on the system instead of using the container image. Total disk size
346+of SDKs and cached libraries is about 1.6 GB.
347+348+### Install OS dependencies
349+350+```shell
351+# Debian/Ubuntu
352+apt update
353+apt install -y git make xz-utils bzip2 curl python3-minimal ccache
354+```
355+356+```shell
357+# Fedora
358+dnf install -y git make xz bzip2 which ccache
359+```
360+361+### Install [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html)
362+363+**NOTE**: Follow the on-screen instructions how to add the SDK to ``PATH``.
364+365+```shell
366+git clone https://github.com/emscripten-core/emsdk.git /opt/emsdk
367+/opt/emsdk/emsdk install latest
368+/opt/emsdk/emsdk activate latest
369+```
370+371+### Optionally: pre-build and cache static libraries
372+373+Emscripten SDK provides static builds of core libraries without PIC
374+(position-independent code). Python builds with ``dlopen`` support require
375+PIC. To populate the build cache, run:
376+377+```shell
378+. /opt/emsdk/emsdk_env.sh
379+embuilder build --force zlib bzip2
380+embuilder build --force --pic \
381+ zlib bzip2 libc-mt libdlmalloc-mt libsockets-mt \
382+ libstubs libcompiler_rt libcompiler_rt-mt crtbegin libhtml5 \
383+ libc++-mt-noexcept libc++abi-mt-noexcept \
384+ libal libGL-mt libstubs-debug libc-mt-debug
385+```
386+387+### Install [WASI-SDK](https://github.com/WebAssembly/wasi-sdk)
388+389+**NOTE**: WASI-SDK's clang may show a warning on Fedora:
390+``/lib64/libtinfo.so.6: no version information available``,
391+[RHBZ#1875587](https://bugzilla.redhat.com/show_bug.cgi?id=1875587).
392+393+```shell
394+export WASI_VERSION=16
395+export WASI_VERSION_FULL=${WASI_VERSION}.0
396+curl -sSf -L -O https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
397+mkdir -p /opt/wasi-sdk
398+tar --strip-components=1 -C /opt/wasi-sdk -xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
399+rm -f wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
400+```
401+402+### Install [wasmtime](https://github.com/bytecodealliance/wasmtime) WASI runtime
403+404+**NOTE**: wasmtime 0.37 has a bug. Newer versions should be fine again.
405+406+```shell
407+curl -sSf -L -o ~/install-wasmtime.sh https://wasmtime.dev/install.sh
408+chmod +x ~/install-wasmtime.sh
409+~/install-wasmtime.sh --version v0.36.0
410+ln -srf -t /usr/local/bin/ ~/.wasmtime/bin/wasmtime
411+```
412+413+### Install [WASIX](https://github.com/singlestore-labs/wasix)
414+415+```shell
416+git clone https://github.com/singlestore-labs/wasix.git ~/wasix
417+make install -C ~/wasix
418+```