# shellcheck shell=bash # Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License. # See LICENSE.md for license information. # SPDX-License-Identifier: MIT # # Emscripten 6.0.11 through emsdk: the compiler the web port (make web) # builds JoeyLib programs to WebAssembly with. emsdk is fetched at the # release tag's commit and installs that one release of its toolchain # (clang, binaryen, node) into toolchains/opt/emsdk; nothing reaches the # user's home directory (EM_CACHE stays inside it too). compDescription="web: Emscripten 6.0.11 (emsdk)" compGroups="toolchain:web" compRequires="host" compHostDeps="git python3 xz" compUrl="https://github.com/emscripten-core/emsdk.git" compCommit="dd8e25632640cfc1fb570c7fa4cc374e8a5e5a72" emsdkVersion="6.0.11" compPin="$compCommit:$emsdkVersion" compInstall() { rm -rf "$compDir" gitFetchCommit "$compUrl" "$compCommit" "$compDir" (cd "$compDir" && ./emsdk install "$emsdkVersion" && ./emsdk activate --embedded "$emsdkVersion") } compInstalled() { [ -x "$compDir/upstream/emscripten/emcc" ] } compVerify() { local tmp local status=1 tmp="$(mktemp -d)" printf 'int answer(int x) { return x * 42; }\n' > "$tmp/t.c" if EM_CONFIG="$compDir/.emscripten" EM_CACHE="$compDir/cache" "$compDir/upstream/emscripten/emcc" -c "$tmp/t.c" -o "$tmp/t.o" && [ -s "$tmp/t.o" ]; then status=0 fi rm -rf "$tmp" return $status } compEnv() { envVar EMSDK_DIR "$compDir" envVar EMCC "$compDir/upstream/emscripten/emcc" envVar EM_CONFIG "$compDir/.emscripten" envVar EM_CACHE "$compDir/cache" }