carlos / todomvc-bakeoff Public

Clone
git clone https://amadan.net/carlos/todomvc-bakeoff

Plain git — no account needed to clone.

Download

Download this file

1#!/usr/bin/env bash
2# Builds a Ruby file with Spinel into a static linux-arm64 binary, using a
3# Spinel compiler built natively inside the emulated arm64 root.
4# scripts/smoke-spinel.sh <main.rb> <output>
5set -euo pipefail
6here=$(cd "$(dirname "$0")" && pwd)
7TC=${BAKEOFF_TOOLCHAINS:-$HOME/.local/share/bakeoff-toolchains}
8sp="$TC/spinel-arm64"
9if ! [ -x "$sp/bin/spinel" ]; then
10 rm -rf "$sp" && cp -r "$TC/spinel-src/spinel" "$sp"
11 (cd "$sp" && git clean -fdxq -e vendor/ && "$here/arm64.sh" make -j8 >/dev/null)
12fi
13src=$(cd "$(dirname "$1")" && pwd)/$(basename "$1")
14out=$(cd "$(dirname "$2")" && pwd)/$(basename "$2")
15work=$(mktemp -d -p "${TMPDIR:-$HOME/.cache}")
16trap 'rm -rf "$work"' EXIT
17cp "$src" "$work/main.rb"
18(cd "$work" && "$here/arm64.sh" "$sp/bin/spinel" main.rb -o app --cc="cc -static")
19cp "$work/app" "$out"
20