Files
ICCery-CPU/Scripts/build_macos.sh
T
Local Admin 43bff18101
Build macOS Packages / Build macOS (Intel) (push) Failing after 10s
Build macOS Packages / Build macOS (Apple Silicon) (push) Failing after 10s
Build macOS Packages / Build macOS (Universal) (push) Skipped
removed cruft and restructured.
2026-09-07 05:21:44 -07:00

56 lines
1.4 KiB
Bash

#!/bin/bash
# Build TargetPrint.app for one architecture: x86_64 | arm64
# Usage: build_macos.sh <arch> [Release|Debug]
set -euo pipefail
ARCH="${1:?arch required: x86_64 | arm64}"
CONFIGURATION="${2:-Release}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PROJECT="$ROOT/TargetPrint.xcodeproj"
SCHEME="TargetPrint"
OUT_DIR="$ROOT/build/apps/$ARCH"
DD_DIR="$ROOT/build/derived-$ARCH"
case "$ARCH" in
x86_64|arm64) ;;
*) echo "arch must be x86_64 or arm64 (got $ARCH)" >&2; exit 2 ;;
esac
echo "==> Building TargetPrint ($CONFIGURATION, $ARCH)"
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR" "$DD_DIR"
xcodebuild \
-project "$PROJECT" \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-arch "$ARCH" \
-derivedDataPath "$DD_DIR" \
CONFIGURATION_BUILD_DIR="$OUT_DIR" \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGN_IDENTITY="${MACOS_CODESIGN_IDENTITY:--}" \
CODE_SIGNING_ALLOWED=YES \
ENABLE_HARDENED_RUNTIME=YES \
build
APP="$OUT_DIR/TargetPrint.app"
test -d "$APP"
BIN="$APP/Contents/MacOS/TargetPrint"
test -x "$BIN"
echo "==> Signing $APP"
# shellcheck source=lib.sh
source "$(dirname "$0")/lib.sh"
sign_app "$APP" "$ROOT/TargetPrint.entitlements"
echo "==> lipo -info"
lipo -info "$BIN"
ACTUAL="$(lipo -archs "$BIN" | tr -d '[:space:]')"
if [[ "$ACTUAL" != "$ARCH" ]]; then
echo "error: expected a single-arch $ARCH binary, got '$ACTUAL'" >&2
exit 1
fi
echo "==> $APP"