#!/bin/sh
set -eu

export CARGO_ZIGBUILD_ZIG_VERSION=0.16.0
if [ -n "${SDKROOT:-}" ]; then
  echo "refusing to cross-build with an Apple SDK on a Linux host" >&2
  exit 2
fi

# An explicit OS version keeps the Mach-O deployment target aligned with the
# macosx_11_0 wheel tag. Zig otherwise defaults the binary to a newer macOS.
exec maturin zig cc -- \
  -g -fno-sanitize=all -target aarch64-macos.11.0-none "$@"
