#!/bin/sh
# MOON_CC for static musl builds: `zig cc`, plus the static OpenSSL objects when linking.
set -eu
# shellcheck disable=SC2086 # ORBIT_MUSL_* are space-separated lists

for arg in "$@"; do
  case $arg in
    -c) exec zig cc -target "$ORBIT_MUSL_TARGET" -ffunction-sections -fdata-sections ${ORBIT_MUSL_CFLAGS-} "$@" ;;
  esac
done
exec zig cc -target "$ORBIT_MUSL_TARGET" -static -s -Wl,--gc-sections "$@" ${ORBIT_MUSL_LINK-}
