Files
desi_explorer/scripts/install_odin.sh
T
2026-08-30 20:45:54 -06:00

40 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Installs the pinned Odin release matching the runner's native architecture.
# The Odin release tarballs are named odin-linux-{amd64,arm64}-<version>.tar.gz;
# on an arm64 runner the amd64 Odin binary only runs under emulation and emits
# amd64 objects, which a natively-installed clang/ld cannot link ("Relocations
# in generic ELF (EM: 62)").
set -euo pipefail
VERSION="${ODIN_VERSION:-dev-2026-07}"
ARCH="$(uname -m)"
case "$ARCH" in
x86_64 | amd64) OBJ_ARCH="amd64" ;;
aarch64 | arm64) OBJ_ARCH="arm64" ;;
*)
echo "Unsupported runner architecture: $ARCH" >&2
exit 1
;;
esac
curl -fL -o /tmp/odin.tar.gz \
"https://github.com/odin-lang/Odin/releases/download/${VERSION}/odin-linux-${OBJ_ARCH}-${VERSION}.tar.gz"
mkdir -p /tmp/odin
tar -xzf /tmp/odin.tar.gz -C /tmp/odin --strip-components=1
# Work around an Odin binding bug: for ODIN_ARCH == .arm64 the vendored
# raylib references `vendor/raylib/linux-arm/libraylib.a`, but the release
# tarball ships it under `linux-arm64/` (see vendor/raylib/raylib.odin).
if [ "${OBJ_ARCH}" = "arm64" ] \
&& [ -d /tmp/odin/vendor/raylib/linux-arm64 ] \
&& [ ! -e /tmp/odin/vendor/raylib/linux-arm ]; then
ln -s linux-arm64 /tmp/odin/vendor/raylib/linux-arm
fi
if [ -n "${GITHUB_PATH:-}" ]; then
echo "/tmp/odin" >> "$GITHUB_PATH"
fi
echo "Installed Odin ${VERSION} (host arch: ${ARCH}, release arch: ${OBJ_ARCH})"