File: install-emscripten.sh

package info (click to toggle)
libheif 1.15.1-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,080 kB
  • sloc: cpp: 37,383; sh: 5,186; python: 3,032; ansic: 454; makefile: 406; javascript: 249
file content (45 lines) | stat: -rwxr-xr-x 1,477 bytes parent folder | download
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