#!/bin/sh set -eu sdk="$1" arch="$2" output="$3" root="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" mkdir -p "$output" sdk_path="$(xcrun --sdk "$sdk" --show-sdk-path)" target="arm64-apple-ios18.0" [ "$sdk" = "iphonesimulator" ] && target="arm64-apple-ios18.0-simulator" source="$root/native/ios_screen_capture.m" flags="-fobjc-arc -fmodules -fmodules-cache-path=$output/module-cache -Wno-unguarded-availability-new" if [ "$sdk" = "iphonesimulator" ]; then source="$root/native/ios_screen_capture_stub.c"; flags=""; fi # shellcheck disable=SC2086 xcrun --sdk "$sdk" clang -target "$target" -isysroot "$sdk_path" $flags -Werror -c "$source" -o "$output/ios_screen_capture.o" xcrun --sdk "$sdk" ar rcs "$output/libvoicecat_ios_capture.a" "$output/ios_screen_capture.o"