Vendor/download.sh

Shell source for Making faces, 31 lines. Raw file

#!/usr/bin/env bash
#
# Fetches ONNX Runtime, the library FaceMaker runs its models with, into
# Vendor/onnxruntime: Microsoft's official build for Apple silicon.
#
# Usage:  ./Vendor/download.sh
#
set -euo pipefail

VERSION="1.30.0"
NAME="onnxruntime-osx-arm64-$VERSION"
URL="https://github.com/microsoft/onnxruntime/releases/download/v$VERSION/$NAME.tgz"
HERE="$(cd "$(dirname "$0")" && pwd)"
TARGET="$HERE/onnxruntime"

if [ -f "$TARGET/lib/libonnxruntime.$VERSION.dylib" ]; then
	echo "✓ ONNX Runtime $VERSION is already in $TARGET"
	exit 0
fi

TEMP="$(mktemp -d)"
trap 'rm -rf "$TEMP"' EXIT

echo "→ downloading $URL"
curl -fL --progress-bar -o "$TEMP/$NAME.tgz" "$URL"
tar -xzf "$TEMP/$NAME.tgz" -C "$TEMP"

rm -rf "$TARGET"
mkdir -p "$TARGET"
cp -R "$TEMP/$NAME/include" "$TEMP/$NAME/lib" "$TEMP/$NAME/LICENSE" "$TEMP/$NAME/VERSION_NUMBER" "$TARGET/"
echo "✓ ONNX Runtime $VERSION in $TARGET"