scripts/build-app.sh
49 lines · 1446 bytes · executable
1#!/bin/sh
2# Builds Orgstar.app in .build/app from the release binary, signed ad hoc for local use.
3# Usage: scripts/build-app.sh [version]
4set -eu
5
6cd "$(dirname "$0")/.."
7version="${1:-0.1.0}"
8app=".build/app/Orgstar.app"
9
10swift build -c release --product Orgstar
11binary="$(swift build -c release --show-bin-path)/Orgstar"
12
13rm -rf "$app"
14mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
15cp "$binary" "$app/Contents/MacOS/Orgstar"
16
17cat > "$app/Contents/Info.plist" <<EOF
18<?xml version="1.0" encoding="UTF-8"?>
19<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
20<plist version="1.0">
21<dict>
22 <key>CFBundleIdentifier</key>
23 <string>sh.krz.orgstar</string>
24 <key>CFBundleName</key>
25 <string>Orgstar</string>
26 <key>CFBundleDisplayName</key>
27 <string>Orgstar</string>
28 <key>CFBundleExecutable</key>
29 <string>Orgstar</string>
30 <key>CFBundlePackageType</key>
31 <string>APPL</string>
32 <key>CFBundleShortVersionString</key>
33 <string>${version}</string>
34 <key>CFBundleVersion</key>
35 <string>${version}</string>
36 <key>LSMinimumSystemVersion</key>
37 <string>26.0</string>
38 <key>LSApplicationCategoryType</key>
39 <string>public.app-category.productivity</string>
40 <key>NSHighResolutionCapable</key>
41 <true/>
42 <key>NSPrincipalClass</key>
43 <string>NSApplication</string>
44</dict>
45</plist>
46EOF
47
48codesign --force --sign - "$app"
49echo "$app"