#!/usr/bin/env bash # Build the C sensor provider and write provider/build/provider.json (schema v2) # with the host target triple and the real artifact SHA-256. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" out="$here/build" mkdir -p "$out" host="$("$here/../scripts/host-target.sh")" case "$host" in *windows*) echo "unsupported: Windows C ABI provider is not implemented in this fixture" >&2; exit 3 ;; *apple-darwin*) ext="dylib"; flags=(-dynamiclib -fPIC) ;; *) ext="so"; flags=(-shared -fPIC) ;; esac artifact="libsensor.$ext" cc -std=c11 -O2 "${flags[@]}" -o "$out/$artifact" "$here/src/sensor.c" if command -v sha256sum >/dev/null 2>&1; then hash="$(sha256sum "$out/$artifact" | cut -d' ' -f1)" else hash="$(shasum -a 256 "$out/$artifact" | cut -d' ' -f1)" fi cat > "$out/provider.json" <