1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/bin/sh
set -e
VERSION=$1
TARGET=$2
if [ -z "$VERSION" ] || [ -z "$TARGET" ]; then
echo "USAGE: $0 <sdk-version> <target-folder>"
exit 1
fi
LIBSTDC_BASE=http://de.archive.ubuntu.com/ubuntu/pool/main/g/gcc-5
EMSDK_DOWNLOAD=https://github.com/emscripten-core/emsdk.git
EMSDK_VERSION=3.1.29
CODENAME=$(/usr/bin/lsb_release --codename --short)
if [ "$CODENAME" = "trusty" ] && [ ! -e "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21" ]; then
CONTENTS=$(curl --location $LIBSTDC_BASE)
LIBSTDC_VERSION=$(echo $CONTENTS | sed 's|.*libstdc++6_\([^_]*\)_amd64\.deb.*|\1|g')
TMPDIR=$(mktemp --directory)
echo "Installing libstdc++6 $LIBSTDC_VERSION to fix Emscripten ..."
echo "Extracting in $TMPDIR ..."
curl "${LIBSTDC_BASE}/libstdc++6_${LIBSTDC_VERSION}_amd64.deb" > "$TMPDIR/libstdc++6_${LIBSTDC_VERSION}_amd64.deb"
dpkg -x "$TMPDIR/libstdc++6_${LIBSTDC_VERSION}_amd64.deb" "$TMPDIR"
sudo mv "$TMPDIR/usr/lib/x86_64-linux-gnu/"libstdc++* /usr/lib/x86_64-linux-gnu
rm -rf "$TMPDIR"
fi
cd "$TARGET"
if [ ! -d emsdk ]; then
echo "Cloning SDK base system ..."
git clone --verbose --recursive "$EMSDK_DOWNLOAD" emsdk
fi
cd emsdk
echo "Updating SDK base to ${EMSDK_VERSION} ..."
git checkout main
git pull --verbose
git checkout ${EMSDK_VERSION}
echo "Installing SDK version ${VERSION} ..."
./emsdk install sdk-fastcomp-${VERSION}-64bit
echo "Activating SDK version ${VERSION} ..."
./emsdk activate sdk-fastcomp-${VERSION}-64bit
|