Commit fe31f1cd94

fe31f1cd94ce7c191b990d0c23710eee989b423b

parent: 73230beed3

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-11 05:06 UTC

Link Sparkle and bundle its framework

Layout: unified · split

Package.resolved +10 −1
@@ -1,5 +1,5 @@
11{
2 "originHash" : "99f611db4aa216eecc3254d58a7ad6ee060533c7f899b1a0d0f72c21a75f90a9",
2 "originHash" : "13a9fcac60cd27fea1022731e52b785749d4a9dfb56c2e629b61c25a99e5464d",
33 "pins" : [
44 {
55 "identity" : "grdb.swift",
@@ -10,6 +10,15 @@
1010 "version" : "7.11.1"
1111 }
1212 },
13 {
14 "identity" : "sparkle",
15 "kind" : "remoteSourceControl",
16 "location" : "https://github.com/sparkle-project/Sparkle",
17 "state" : {
18 "revision" : "eef1a539a373c1f1a320624b1130fc5de7b2e100",
19 "version" : "2.10.0"
20 }
21 },
1322 {
1423 "identity" : "swift-tree-sitter",
1524 "kind" : "remoteSourceControl",
Package.swift +2 −1
@@ -25,6 +25,7 @@ let package = Package(
2525 ],
2626 dependencies: [
2727 .package(url: "https://github.com/groue/GRDB.swift", from: "7.11.1"),
28 .package(url: "https://github.com/sparkle-project/Sparkle", from: "2.7.0"),
2829 .package(url: "https://github.com/tree-sitter/swift-tree-sitter", from: "0.25.0"),
2930 .package(url: "https://github.com/tree-sitter/tree-sitter-bash", exact: "0.25.1"),
3031 .package(url: "https://github.com/tree-sitter/tree-sitter-c", exact: "0.24.2"),
@@ -82,7 +83,7 @@ let package = Package(
8283 ),
8384 .executableTarget(name: "OrgstarSpike", dependencies: ["OrgEditorAppKit"]),
8485 .target(name: "OrgApp", dependencies: ["OrgWorkspace", "OrgDocument", "OrgPresentation"]),
85 .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight"]),
86 .executableTarget(name: "Orgstar", dependencies: ["OrgApp", "OrgEditorAppKit", "OrgHighlight", .product(name: "Sparkle", package: "Sparkle")]),
8687 // The iOS app, bundled by scripts/build-ios-app.sh.
8788 .executableTarget(name: "OrgstarMobile", dependencies: ["OrgApp", "OrgHighlight"]),
8889 // App extensions, bundled into orgstar.app by scripts/build-app.sh.
scripts/build-app.sh +26 −1
@@ -30,8 +30,25 @@ swift build -c release $arch_flags --product OrgstarSpotlight
3030binary="$(swift build -c release $arch_flags --show-bin-path)/Orgstar"
3131
3232rm -rf "$app"
33mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
33mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$app/Contents/Frameworks"
3434cp "$binary" "$app/Contents/MacOS/Orgstar"
35
36# Sparkle, from its SwiftPM artifact: the framework beside the binary, found through an rpath.
37sparkle="$(find .build/artifacts -path '*Sparkle.xcframework/macos-*/Sparkle.framework' -maxdepth 7 | head -1)"
38[ -n "$sparkle" ] || { echo "Sparkle.framework not in .build/artifacts; swift build fetches it." >&2; exit 1; }
39ditto "$sparkle" "$app/Contents/Frameworks/Sparkle.framework"
40otool -l "$app/Contents/MacOS/Orgstar" | grep -q '@executable_path/../Frameworks' \
41 || install_name_tool -add_rpath @executable_path/../Frameworks "$app/Contents/MacOS/Orgstar"
42
43# Updates: the appcast and its signing key, for signed builds only; a dev build never checks.
44if [ "$sign" != "-" ]; then
45 feed_keys=" <key>SUFeedURL</key>
46 <string>https://krz.gitbay.site/orgstar/appcast.xml</string>
47 <key>SUPublicEDKey</key>
48 <string>${ORGSTAR_ED_PUBLIC_KEY:?set ORGSTAR_ED_PUBLIC_KEY to the key generate_keys printed}</string>"
49else
50 feed_keys=""
51fi
3552iconset="$(mktemp -d)/AppIcon.iconset"
3653swift scripts/make-icon.swift "$iconset"
3754iconutil -c icns "$iconset" -o "$app/Contents/Resources/AppIcon.icns"
@@ -108,6 +125,7 @@ cat > "$app/Contents/Info.plist" <<EOF
108125 <string>${build}</string>
109126 <key>LSMinimumSystemVersion</key>
110127 <string>26.0</string>
128${feed_keys}
111129 <key>LSApplicationCategoryType</key>
112130 <string>public.app-category.productivity</string>
113131 <key>NSCalendarsFullAccessUsageDescription</key>
@@ -188,6 +206,13 @@ appex OrgstarQuickLook com.apple.quicklook.preview PreviewProvider \
188206appex OrgstarSpotlight com.apple.spotlight.import ImportExtension \
189207 "<key>CSSupportedContentTypes</key><array><string>org.orgmode.org</string></array>"
190208
209# Sparkle's inner pieces are signed first, as its documentation has it, then the framework.
210fw="$app/Contents/Frameworks/Sparkle.framework/Versions/B"
211for item in "$fw/XPCServices/Installer.xpc" "$fw/XPCServices/Downloader.xpc" "$fw/Autoupdate" "$fw/Updater.app" "$app/Contents/Frameworks/Sparkle.framework"; do
212 # shellcheck disable=SC2086
213 codesign --force --sign "$sign" $sign_flags "$item"
214done
215
191216# The hardened runtime needs Calendar access declared for the agenda's events.
192217cat > "$work/app.entitlements" <<PLIST
193218<?xml version="1.0" encoding="UTF-8"?>