-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-app.sh
More file actions
executable file
·86 lines (76 loc) · 2.72 KB
/
Copy pathbuild-app.sh
File metadata and controls
executable file
·86 lines (76 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
# Build MovieStats as a proper .app bundle so macOS treats it as a regular
# windowed app. Works with just the Command Line Tools — no full Xcode needed.
# Output: ./MovieStats.app
set -euo pipefail
CONFIG="${CONFIG:-release}"
APP_NAME="MovieStats"
BUNDLE_ID="com.python21.MovieStats"
APP_DIR="${APP_NAME}.app"
cd "$(dirname "$0")"
echo "==> swift build -c ${CONFIG}"
swift build -c "${CONFIG}"
BIN_PATH="$(swift build -c "${CONFIG}" --show-bin-path)/${APP_NAME}"
if [[ ! -x "${BIN_PATH}" ]]; then
echo "Built binary not found at ${BIN_PATH}" >&2
exit 1
fi
echo "==> assembling ${APP_DIR}"
rm -rf "${APP_DIR}"
mkdir -p "${APP_DIR}/Contents/MacOS"
mkdir -p "${APP_DIR}/Contents/Resources"
cp "${BIN_PATH}" "${APP_DIR}/Contents/MacOS/${APP_NAME}"
# App icon. Generate it first with ./make-icon.sh if it's missing.
if [[ -f Resources/AppIcon.icns ]]; then
cp Resources/AppIcon.icns "${APP_DIR}/Contents/Resources/AppIcon.icns"
else
echo "WARNING: Resources/AppIcon.icns not found — run ./make-icon.sh" >&2
fi
# Bundled ffprobe — used to read codec/resolution/HDR/track info per movie.
if [[ ! -x Resources/ffprobe ]]; then
echo "==> fetching ffprobe (one-time)"
./Tools/fetch-ffprobe.sh
fi
cp Resources/ffprobe "${APP_DIR}/Contents/Resources/ffprobe"
chmod +x "${APP_DIR}/Contents/Resources/ffprobe"
cat >"${APP_DIR}/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundleDisplayName</key>
<string>Movie Stats</string>
<key>CFBundleIdentifier</key>
<string>${BUNDLE_ID}</string>
<key>CFBundleExecutable</key>
<string>${APP_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.video</string>
<key>NSHumanReadableCopyright</key>
<string>© $(date +%Y) Andrew Nowicki</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
</dict>
</plist>
PLIST
# Ad-hoc signature is enough for a personal, non-distributed app.
# Sign the nested ffprobe first so the outer bundle's signature stays valid.
echo "==> codesigning (ad-hoc)"
codesign --force --sign - "${APP_DIR}/Contents/Resources/ffprobe"
codesign --force --sign - --identifier "${BUNDLE_ID}" "${APP_DIR}"
echo "==> done: $(pwd)/${APP_DIR}"
echo " run it with: open ${APP_DIR}"