#!/bin/bash if [ -e toolchain-emscripten ] ; then echo "ERROR: A toolchain-emscripten directory already exists, aborting install" echo "NOTE: To upgrade the installation, use ./update-toolchain-emscripten.sh" exit 1 fi parentdir=$(pwd) mkdir -p toolchain-emscripten cd toolchain-emscripten git clone https://github.com/emscripten-core/emsdk.git cat > env.sh <<'EOF' #!/bin/bash echo "Reminder: this script has to be used with source (.) instead of exec" EOF echo "export PATH=$parentdir/toolchain-emscripten/emsdk:$parentdir/toolchain-emscripten/emsdk/upstream/emscripten:\$PATH" >> env.sh echo "export EMSDK=$parentdir/toolchain-emscripten/emsdk" >> env.sh chmod 755 env.sh cd .. ./update-toolchain-emscripten.sh echo "" echo "Installation complete." echo "To use the emscripten toolchain, first include env.sh with \". toolchain-emscripten/env.sh\""