Debian Codegraph @

bin/install_rust_binaries.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2 # Install rust binaries for fontc, diffenator3 and fontspector
3 # into an active Python virtual environment
4
5 set -e
6
7 if [ -z "$VIRTUAL_ENV" ]; then
8 echo "No Python virtual environment detected. Please activate one first."
9 exit 1
10 fi
11
12 BIN_DIR="$VIRTUAL_ENV/bin"
13
14 install_from_tarball() {
15 local url="$1"
16 echo "Installing binaries from $url to $BIN_DIR"
17 local tmpdir
18 tmpdir=$(mktemp -d)
19 curl -L "$url" | tar -xz -C "$tmpdir"
20 find "$tmpdir" -type f -exec mv {} "$BIN_DIR" \;
21 rm -rf "$tmpdir"
22 }
23
24 # Detect platform and set archive suffix
25 if [[ "$(uname)" == "Darwin" ]]; then
26 if [[ "$(uname -m)" == "arm64" ]]; then
27 SUFFIX="aarch64-apple-darwin.tar.gz"
28 else
29 SUFFIX="x86_64-apple-darwin.tar.gz"
30 fi
31 elif [[ "$(uname)" == "Linux" ]]; then
32 SUFFIX="unknown-linux-musl.tar.gz"
33 else
34 echo "Unsupported OS: $(uname)"
35 exit 1
36 fi
37
38 install_from_tarball "https://github.com/googlefonts/diffenator3/releases/download/v0.1.2/diffenator3-v0.1.2-$SUFFIX"
39 install_from_tarball "https://github.com/fonttools/fontspector/releases/download/fontspector-v1.0.2/fontspector-v1.0.2-$SUFFIX"
40 install_from_tarball "https://github.com/googlefonts/fontc/releases/download/fontc-v0.2.0/fontc-$SUFFIX"
41
42 chmod +x "$BIN_DIR/diffenator3" "$BIN_DIR/diff3proof" "$BIN_DIR/fontspector" "$BIN_DIR/fontc"
43 echo "Done."