Files
ICCery-CPU/Scripts/build_macos.sh
gronod e319e5b106
Build macOS Packages / Build macOS (Intel) (pull_request) Successful in 39s
Build macOS Packages / Build macOS (Apple Silicon) (pull_request) Successful in 40s
Build macOS Packages / Build macOS (Universal) (pull_request) Failing after 10s
fix: resolve PPD media type and tray option discovery and selection
- Parse PPD translation strings and decode hex escapes (e.g. CD<2F>DVD -> CD/DVD)
- Populate InspectorView media type and tray dropdowns with human-readable titles while preserving computer-readable choice codes
- Fix empty-array nil coalescing bug in InspectorView preventing empty tray and media type popups
- Support OEM vendor PPD keywords (Canon CNIJMediaType/CNIJMediaSupply, Epson EPIJ_FdSo)
- Add dual-identity lookup in PrintEngine and InspectorView for robust choice code vs title resolution
- Add comprehensive PPDOptionsTests and CLI test runner

Closes #1, Closes #2
2026-09-07 22:45:02 +01:00

74 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Build TargetPrint.app for one architecture: x86_64 | arm64
# Prefers xcodebuild; falls back to CLT swiftc when Xcode.app is absent.
# 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)"
SCRIPTS="$(dirname "$0")"
case "$ARCH" in
x86_64|arm64) ;;
*) echo "arch must be x86_64 or arm64 (got $ARCH)" >&2; exit 2 ;;
esac
xcodebuild_works() {
local xb="${XCODEBUILD:-}"
if [ -n "$xb" ] && [ -x "$xb" ] && "$xb" -version >/dev/null 2>&1; then
return 0
fi
if command -v xcodebuild >/dev/null 2>&1 && xcodebuild -version >/dev/null 2>&1; then
XCODEBUILD="$(command -v xcodebuild)"
return 0
fi
return 1
}
if xcodebuild_works; then
PROJECT="$ROOT/TargetPrint.xcodeproj"
SCHEME="TargetPrint"
OUT_DIR="$ROOT/build/apps/$ARCH"
DD_DIR="$ROOT/build/derived-$ARCH"
# shellcheck source=lib.sh
source "$SCRIPTS/lib.sh"
JOBS="$(cpu_jobs)"
MIN_OS="$(min_os_for_arch "$ARCH")"
echo "==> Building TargetPrint ($CONFIGURATION, $ARCH, min $MIN_OS) with $XCODEBUILD (-jobs $JOBS)"
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR" "$DD_DIR"
"$XCODEBUILD" \
-project "$PROJECT" \
-scheme "$SCHEME" \
-configuration "$CONFIGURATION" \
-arch "$ARCH" \
-jobs "$JOBS" \
-parallelizeTargets \
-derivedDataPath "$DD_DIR" \
CONFIGURATION_BUILD_DIR="$OUT_DIR" \
ONLY_ACTIVE_ARCH=NO \
MACOSX_DEPLOYMENT_TARGET="$MIN_OS" \
CODE_SIGN_IDENTITY="${MACOS_CODESIGN_IDENTITY:--}" \
CODE_SIGNING_ALLOWED=YES \
ENABLE_HARDENED_RUNTIME=YES \
SWIFT_USE_PARALLEL_WHOLE_MODULE_OPTIMIZATION=YES \
build
APP="$OUT_DIR/TargetPrint.app"
test -d "$APP"
BIN="$APP/Contents/MacOS/TargetPrint"
test -x "$BIN"
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"
else
echo "==> xcodebuild unavailable; using Command Line Tools swiftc"
exec "$SCRIPTS/swiftc_build.sh" "$ARCH" "$CONFIGURATION"
fi