40 lines
984 B
Bash
40 lines
984 B
Bash
#!/bin/bash
|
|
# Shared helpers for TargetPrint release scripts.
|
|
|
|
macos_root() {
|
|
# Works when this tree is the Gitea repo root *or* lives under macos/.
|
|
local here
|
|
here="$(cd "$(dirname "${BASH_SOURCE[1]}")/.." && pwd)"
|
|
if [[ -d "$here/TargetPrint.xcodeproj" ]]; then
|
|
echo "$here"
|
|
return
|
|
fi
|
|
if [[ -d "$here/macos/TargetPrint.xcodeproj" ]]; then
|
|
echo "$here/macos"
|
|
return
|
|
fi
|
|
echo "$here"
|
|
}
|
|
|
|
sign_app() {
|
|
local app="$1"
|
|
local entitlements="$2"
|
|
local identity="${MACOS_CODESIGN_IDENTITY:--}"
|
|
if ! command -v codesign >/dev/null 2>&1; then
|
|
echo "codesign not available; skipping"
|
|
return 0
|
|
fi
|
|
codesign --force --deep --options runtime \
|
|
--sign "$identity" \
|
|
--entitlements "$entitlements" \
|
|
"$app"
|
|
codesign --verify --verbose=2 "$app" || true
|
|
}
|
|
|
|
zip_app() {
|
|
local app="$1"
|
|
local dest="$2"
|
|
rm -f "$dest"
|
|
ditto -c -k --keepParent "$app" "$dest"
|
|
}
|