• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
24# node 8 is required to run wasm
25# NOTE: Do not forget to sync Node.js version with `emscripten-entry.sh`!
26cd /
27curl --retry 5 -L https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.xz | \
28    tar -xJ
29