tree-sitter/script/fetch-emscripten
Max Brunsfeld 4d64c2b939 Put emscripten-version file in cli directory
This lets the CLI crate build without relying on sibling directories.
2021-09-03 13:57:45 -07:00

34 lines
646 B
Bash
Executable file

#!/bin/bash
set -e
EMSCRIPTEN_VERSION=$(cat "$(dirname "$0")/../cli/emscripten-version")
mkdir -p target
EMSDK_DIR="./target/emsdk"
(
if [ ! -f "$EMSDK_DIR/emsdk" ]; then
echo 'Downloading emscripten SDK...'
git clone https://github.com/emscripten-core/emsdk.git $EMSDK_DIR
fi
cd $EMSDK_DIR
echo 'Updating emscripten SDK...'
git reset --hard
git pull
./emsdk list
echo 'Installing latest emscripten...'
./emsdk install $EMSCRIPTEN_VERSION
echo 'Activating latest emscripten...'
./emsdk activate $EMSCRIPTEN_VERSION
) >&2
(
source "$EMSDK_DIR/emsdk_env.sh" > /dev/null
emcc --version >&2
declare -px
)