| @@ -30,8 +30,25 @@ swift build -c release $arch_flags --product OrgstarSpotlight |
| 30 | binary="$(swift build -c release $arch_flags --show-bin-path)/Orgstar" |
30 | binary="$(swift build -c release $arch_flags --show-bin-path)/Orgstar" |
| 31 | |
31 | |
| 32 | rm -rf "$app" |
32 | rm -rf "$app" |
| 33 | mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" |
33 | mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$app/Contents/Frameworks" |
| 34 | cp "$binary" "$app/Contents/MacOS/Orgstar" |
34 | cp "$binary" "$app/Contents/MacOS/Orgstar" |
| |
35 | |
| |
36 | # Sparkle, from its SwiftPM artifact: the framework beside the binary, found through an rpath. |
| |
37 | sparkle="$(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; } |
| |
39 | ditto "$sparkle" "$app/Contents/Frameworks/Sparkle.framework" |
| |
40 | otool -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. |
| |
44 | if [ "$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>" |
| |
49 | else |
| |
50 | feed_keys="" |
| |
51 | fi |
| 35 | iconset="$(mktemp -d)/AppIcon.iconset" |
52 | iconset="$(mktemp -d)/AppIcon.iconset" |
| 36 | swift scripts/make-icon.swift "$iconset" |
53 | swift scripts/make-icon.swift "$iconset" |
| 37 | iconutil -c icns "$iconset" -o "$app/Contents/Resources/AppIcon.icns" |
54 | iconutil -c icns "$iconset" -o "$app/Contents/Resources/AppIcon.icns" |
| @@ -108,6 +125,7 @@ cat > "$app/Contents/Info.plist" <<EOF |
| 108 | <string>${build}</string> |
125 | <string>${build}</string> |
| 109 | <key>LSMinimumSystemVersion</key> |
126 | <key>LSMinimumSystemVersion</key> |
| 110 | <string>26.0</string> |
127 | <string>26.0</string> |
| |
128 | ${feed_keys} |
| 111 | <key>LSApplicationCategoryType</key> |
129 | <key>LSApplicationCategoryType</key> |
| 112 | <string>public.app-category.productivity</string> |
130 | <string>public.app-category.productivity</string> |
| 113 | <key>NSCalendarsFullAccessUsageDescription</key> |
131 | <key>NSCalendarsFullAccessUsageDescription</key> |
| @@ -188,6 +206,13 @@ appex OrgstarQuickLook com.apple.quicklook.preview PreviewProvider \ |
| 188 | appex OrgstarSpotlight com.apple.spotlight.import ImportExtension \ |
206 | appex OrgstarSpotlight com.apple.spotlight.import ImportExtension \ |
| 189 | "<key>CSSupportedContentTypes</key><array><string>org.orgmode.org</string></array>" |
207 | "<key>CSSupportedContentTypes</key><array><string>org.orgmode.org</string></array>" |
| 190 | |
208 | |
| |
209 | # Sparkle's inner pieces are signed first, as its documentation has it, then the framework. |
| |
210 | fw="$app/Contents/Frameworks/Sparkle.framework/Versions/B" |
| |
211 | for 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" |
| |
214 | done |
| |
215 | |
| 191 | # The hardened runtime needs Calendar access declared for the agenda's events. |
216 | # The hardened runtime needs Calendar access declared for the agenda's events. |
| 192 | cat > "$work/app.entitlements" <<PLIST |
217 | cat > "$work/app.entitlements" <<PLIST |
| 193 | <?xml version="1.0" encoding="UTF-8"?> |
218 | <?xml version="1.0" encoding="UTF-8"?> |