Files
voice-cat/clients/apple/build-ios-device.sh
T

52 lines
2.2 KiB
Bash
Raw Normal View History

2026-09-19 19:33:10 +02:00
#!/bin/sh
set -eu
root="$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)"
2026-09-19 19:33:10 +02:00
configuration="${CONFIGURATION:-Debug}"
output="$root/dist/ios-managed-device"
dotnet_host="${VOICECAT_DOTNET:-/usr/local/share/dotnet/dotnet}"
while [ "$#" -gt 0 ]; do
case "$1" in
--configuration) configuration="$2"; shift 2 ;;
--output) output="$2"; shift 2 ;;
-h|--help)
echo "usage: $0 [--configuration Debug|Release] [--output DIR]"
echo "optional env: VOICECAT_DOTNET, VOICECAT_CODESIGN_KEY, VOICECAT_CODESIGN_PROVISION"
exit 0 ;;
*) echo "unknown argument: $1" >&2; exit 2 ;;
esac
done
project="$root/clients/apple/VoiceCat.iOS/VoiceCat.iOS.csproj"
"$root/scripts/build-native-ios.sh"
2026-09-19 19:33:10 +02:00
"$dotnet_host" restore "$project" --locked-mode -p:VoiceCatIosStatic=true
2026-09-21 03:10:25 +02:00
device_lock="obj/packages.device.lock.json"
"$dotnet_host" restore "$project" -r ios-arm64 --no-dependencies \
-p:RestorePackagesWithLockFile=true -p:RestoreLockedMode=false -p:NuGetLockFilePath="$device_lock"
2026-09-19 19:33:10 +02:00
2026-09-21 03:10:25 +02:00
set -- build "$project" -c "$configuration" -r ios-arm64 --no-restore -m:1 \
-p:NuGetLockFilePath="$device_lock"
2026-09-19 19:33:10 +02:00
if [ -n "${VOICECAT_CODESIGN_KEY:-}" ]; then set -- "$@" -p:CodesignKey="$VOICECAT_CODESIGN_KEY"; fi
if [ -n "${VOICECAT_CODESIGN_PROVISION:-}" ]; then set -- "$@" -p:CodesignProvision="$VOICECAT_CODESIGN_PROVISION"; fi
"$dotnet_host" "$@"
app="$root/clients/apple/VoiceCat.iOS/bin/$configuration/net10.0-ios27.0/ios-arm64/VoiceCat.iOS.app"
2026-09-19 19:33:10 +02:00
[ -d "$app" ] || { echo "device app was not produced at $app" >&2; exit 1; }
2026-09-20 03:03:07 +02:00
/usr/bin/strings "$app/VoiceCat.Codec.dll" | /usr/bin/grep -q GetMainProgramHandle || {
echo "device codec does not contain the iOS static-library resolver" >&2
exit 1
}
/usr/bin/nm -gU "$app/VoiceCat.iOS" | /usr/bin/grep -q _vcm_decoder_create || {
echo "device executable does not export the statically linked media codec" >&2
exit 1
}
/usr/bin/nm -gU "$app/VoiceCat.iOS" | /usr/bin/grep -q _vcm_rnnoise_create || {
echo "device executable does not export the statically linked RNNoise processor" >&2
exit 1
}
2026-09-19 19:33:10 +02:00
mkdir -p "$output"
/usr/bin/ditto "$app" "$output/VoiceCat.iOS.app"
/usr/bin/codesign --verify --deep --strict "$output/VoiceCat.iOS.app"
echo "$output/VoiceCat.iOS.app"