1#!/usr/bin/env bash 2 3set -ex 4 5# FIXME: 3.1.21 removed a lot of header files (https://github.com/emscripten-core/emscripten/pull/17704). 6# We have to tweak libc-test (and deprecate unsupported items, maybe) when updating emsdk. 7EMSDK_VERSION=3.1.20 8 9git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable 10cd /emsdk-portable 11./emsdk install "${EMSDK_VERSION}" 12./emsdk activate "${EMSDK_VERSION}" 13 14# Compile and cache libc 15# shellcheck disable=SC1091 16source ./emsdk_env.sh 17echo "int main() {return 0;}" > a.c 18HOME=/emsdk-portable/ emcc a.c 19rm -f a.* 20 21# Make emsdk usable by any user 22chmod a+rxw -R /emsdk-portable 23