SPB Git

Repository Public

sign.sh 2.4 KB 34 lines shellscript

1#!/usr/bin/env bash2# ORIX DJ3# File: Scripts/sign.sh4# Description: Builds the Release configuration (arm64, Hardened Runtime) signed with the Developer ID Application identity already in the keychain, and verifies the result. Produces "dist/ORIX DJ.app". Uploads nothing.5#6# Author: Simon-Pierre Boucher7# Contact: contact@spboucher.ai8set -euo pipefail9cd "$(dirname "$0")/.."10DD="build/DerivedDataRelease"11APP="dist/ORIX DJ.app"12security find-identity -v -p codesigning | grep -q "Developer ID Application" || { echo "ERROR: no Developer ID Application identity in the keychain." >&2; exit 1; }13/usr/bin/python3 Scripts/localize.py14xcodegen generate --quiet15rm -rf "$DD/Build/Products/Release/ORIX DJ.app"16xcodebuild -project ORIXDJ.xcodeproj -scheme ORIXDJ -configuration Release -derivedDataPath "$DD" -destination 'platform=macOS,arch=arm64' build 2>&1 | sed 's/\x1b\[[0-9;]*m//g' | grep -E "error:|\*\* BUILD" | sort -u17BUILT="$DD/Build/Products/Release/ORIX DJ.app"18[[ -d "$BUILT" ]] || { echo "ERROR: Release build failed." >&2; exit 1; }19rm -rf dist && mkdir -p dist20ditto "$BUILT" "$APP"21echo "== verify"22codesign --verify --deep --strict --verbose=2 "$APP"23echo "architectures: $(lipo -archs "$APP/Contents/MacOS/ORIX DJ")"24codesign -dvv "$APP" 2>&1 | grep -E "^(Identifier|Authority|TeamIdentifier|Timestamp|Runtime Version)" | sed 's/^/  /'25FLAGS="$(codesign -dv "$APP" 2>&1 | sed -n 's/.*flags=\([^ ]*\).*/\1/p')"; echo "flags: $FLAGS"26[[ "$FLAGS" == *runtime* ]] || { echo "ERROR: Hardened Runtime is not enabled." >&2; exit 1; }27if codesign -d --entitlements - --xml "$APP" 2>/dev/null | grep -q "get-task-allow"; then echo "ERROR: get-task-allow present." >&2; exit 1; fi28echo "entitlements: $(codesign -d --entitlements - --xml "$APP" 2>/dev/null | plutil -convert json -o - - 2>/dev/null || echo '{}')"29echo "nested code:"; find "$APP" \( -name "*.dylib" -o -name "*.framework" -o -name "*.bundle" \) -maxdepth 4 | sed 's/^/  /' | head -2030[[ -f "$APP/Contents/Resources/AppIcon.icns" ]] || { echo "ERROR: the app has no icon." >&2; exit 1; }31[[ -f "$APP/Contents/Resources/orix-script/manifest.json" ]] || { echo "ERROR: the offline documentation is not in the bundle." >&2; exit 1; }32echo "version: $(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$APP/Contents/Info.plist") ($(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$APP/Contents/Info.plist"))"33echo "RESULT: $APP is built and signed. It is NOT notarized yet (Scripts/notarize.sh)."34
Files main
Menu

Theme