instagrab 0.1.0

Scrapes Instagram profile metadata by attaching to a real Chrome over CDP
#!/usr/bin/env bash
set -euo pipefail

cd "$(dirname "$0")/.."

# Cross-compile a stripped, static release binary for deployment (see
# deploy/README.md). We use cargo-zigbuild, which uses zig as the C/linker
# toolchain: it produces a fully static musl binary with no Docker and no host
# libc dependency. The default target is Linux x86-64; override with the TARGET
# env var or a single positional target triple:
#
#   ./scripts/release                               # x86_64-unknown-linux-musl (default)
#   ./scripts/release aarch64-unknown-linux-musl    # linux arm64
#   TARGET=aarch64-apple-darwin ./scripts/release   # env-var form, equivalent

TARGET="${1:-${TARGET:-x86_64-unknown-linux-musl}}"

if ! command -v cargo-zigbuild >/dev/null 2>&1; then
  echo "Error: cargo-zigbuild not found. Install it with:" >&2
  echo "  cargo install cargo-zigbuild   # plus zig itself, e.g. 'brew install zig'" >&2
  exit 1
fi

# zigbuild still needs the target's std library; adding it is idempotent.
rustup target add "${TARGET}" >/dev/null 2>&1 || true

mkdir -p dist
OUT="dist/instagrab-${TARGET}"

echo "Building ${OUT}..."
cargo zigbuild --release --target "${TARGET}"
cp "target/${TARGET}/release/instagrab" "${OUT}"

echo "Built ${OUT}"