Smaller bundles: stripped Mac binaries, one math font, smaller iOS asset catalog !458

merged merged by cmc on 2026-11-22 17:57 UTC · krz/orgstar:issue-207-bundle-size into main

4 files changed, +114 −3

Layout: unified · split

CONTRIBUTING.org +4
@@ -161,6 +161,10 @@ There is no CI; run these before committing.
161161keychain's Developer ID, notarizes a DMG, tags =v<version>=, uploads the DMG to the
162162gitbay release and updates the cask in krz/homebrew-tap.
163163
164=scripts/build-app.sh= strips the executables and copies their dSYMs to =.build/app/dSYMs=;
165the release zips them to =.build/release/orgstar-<version>-dSYMs.zip= and doesn't upload
166them. Keep the zip to symbolicate that release's crash reports.
167
164168Set =ORGSTAR_NOTES= to an HTML file of release notes for the appcast, which Sparkle's
165169update window shows, and =ORGSTAR_RELEASE_NOTES= to a Markdown file for the gitbay
166170release. Without them both get the one-line platform note.
ios/Orgstar.xcodeproj/project.pbxproj +98
@@ -409,6 +409,7 @@
409409 FD11E99E3EE9450636C880B9 /* Sources */,
410410 843FAAECD041CD2466904790 /* Frameworks */,
411411 287027B677CE75B2D4715EE6 /* Resources */,
412 3B3A530168A4B0C6DC41A289 /* Remove unused math fonts */,
412413 269605D45C104F12CBCDC8FB /* Embed Foundation Extensions */,
413414 2EBC267BEE9E23673AE8DADC /* Embed Watch Content */,
414415 );
@@ -441,6 +442,7 @@
441442 E5AC38BB173B87555EBEC0AC /* Sources */,
442443 1439C48F60EF427CC7ADB87B /* Frameworks */,
443444 1A9DC7DD7E76A6C5A1DC674C /* Resources */,
445 C6B3DD5221D3870C9175CC69 /* Remove unused math fonts */,
444446 );
445447 buildRules = (
446448 );
@@ -538,6 +540,7 @@
538540 0EFD7F2537761E968D3FE030 /* Sources */,
539541 39CC8FCF3B50EC810191AF52 /* Frameworks */,
540542 EDF6CA650FB1A0A57A682074 /* Resources */,
543 C7926A563D8955E2098E6D1E /* Remove unused math fonts */,
541544 50EAF92A2ABF4715F69C1B26 /* Embed Foundation Extensions */,
542545 );
543546 buildRules = (
@@ -592,6 +595,7 @@
592595 296E85448BDDDD3245D3D432 /* Sources */,
593596 AE22603FB5DE3C5FFFBBC68E /* Frameworks */,
594597 EA6C64E8D42ADCFBC3B131FF /* Resources */,
598 52900680D96A1A4CD35C68D4 /* Remove unused math fonts */,
595599 );
596600 buildRules = (
597601 );
@@ -720,6 +724,27 @@
720724/* End PBXResourcesBuildPhase section */
721725
722726/* Begin PBXShellScriptBuildPhase section */
727 3B3A530168A4B0C6DC41A289 /* Remove unused math fonts */ = {
728 isa = PBXShellScriptBuildPhase;
729 buildActionMask = 2147483647;
730 files = (
731 );
732 inputFileListPaths = (
733 );
734 inputPaths = (
735 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
736 );
737 name = "Remove unused math fonts";
738 outputFileListPaths = (
739 );
740 outputPaths = (
741 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
742 "$(DERIVED_FILE_DIR)/math-fonts-removed",
743 );
744 runOnlyForDeploymentPostprocessing = 0;
745 shellPath = /bin/sh;
746 shellScript = "# LatexPreview uses only SwiftMath's default font, Latin Modern. A signed copy is signed again.\nfind \"$SCRIPT_OUTPUT_FILE_0\" -path '*/mathFonts.bundle/*' \\( -name '*.otf' -o -name '*.plist' \\) ! -name 'latinmodern-math.*' -delete\nif codesign -d \"$SCRIPT_OUTPUT_FILE_0\" 2> /dev/null; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY:--}\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\ntouch \"$SCRIPT_OUTPUT_FILE_1\"\n";
747 };
723748 4316AE7E93B32A6A11452968 /* Compile string catalog */ = {
724749 isa = PBXShellScriptBuildPhase;
725750 buildActionMask = 2147483647;
@@ -751,6 +776,27 @@
751776 shellPath = /bin/sh;
752777 shellScript = "# The catalog is compiled here rather than as a resource, so that Xcode doesn't sync it\n# from this target's sources; scripts/sync-strings.sh keeps it.\nxcrun xcstringstool compile \"$SCRIPT_INPUT_FILE_0\" --output-directory \"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\"\n";
753778 };
779 52900680D96A1A4CD35C68D4 /* Remove unused math fonts */ = {
780 isa = PBXShellScriptBuildPhase;
781 buildActionMask = 2147483647;
782 files = (
783 );
784 inputFileListPaths = (
785 );
786 inputPaths = (
787 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
788 );
789 name = "Remove unused math fonts";
790 outputFileListPaths = (
791 );
792 outputPaths = (
793 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
794 "$(DERIVED_FILE_DIR)/math-fonts-removed",
795 );
796 runOnlyForDeploymentPostprocessing = 0;
797 shellPath = /bin/sh;
798 shellScript = "# LatexPreview uses only SwiftMath's default font, Latin Modern. A signed copy is signed again.\nfind \"$SCRIPT_OUTPUT_FILE_0\" -path '*/mathFonts.bundle/*' \\( -name '*.otf' -o -name '*.plist' \\) ! -name 'latinmodern-math.*' -delete\nif codesign -d \"$SCRIPT_OUTPUT_FILE_0\" 2> /dev/null; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY:--}\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\ntouch \"$SCRIPT_OUTPUT_FILE_1\"\n";
799 };
754800 641BAD6CBA4413E3690E3513 /* Compile string catalog */ = {
755801 isa = PBXShellScriptBuildPhase;
756802 buildActionMask = 2147483647;
@@ -875,6 +921,48 @@
875921 shellPath = /bin/sh;
876922 shellScript = "# The catalog is compiled here rather than as a resource, so that Xcode doesn't sync it\n# from this target's sources; scripts/sync-strings.sh keeps it.\nxcrun xcstringstool compile \"$SCRIPT_INPUT_FILE_0\" --output-directory \"$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\"\n";
877923 };
924 C6B3DD5221D3870C9175CC69 /* Remove unused math fonts */ = {
925 isa = PBXShellScriptBuildPhase;
926 buildActionMask = 2147483647;
927 files = (
928 );
929 inputFileListPaths = (
930 );
931 inputPaths = (
932 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
933 );
934 name = "Remove unused math fonts";
935 outputFileListPaths = (
936 );
937 outputPaths = (
938 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
939 "$(DERIVED_FILE_DIR)/math-fonts-removed",
940 );
941 runOnlyForDeploymentPostprocessing = 0;
942 shellPath = /bin/sh;
943 shellScript = "# LatexPreview uses only SwiftMath's default font, Latin Modern. A signed copy is signed again.\nfind \"$SCRIPT_OUTPUT_FILE_0\" -path '*/mathFonts.bundle/*' \\( -name '*.otf' -o -name '*.plist' \\) ! -name 'latinmodern-math.*' -delete\nif codesign -d \"$SCRIPT_OUTPUT_FILE_0\" 2> /dev/null; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY:--}\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\ntouch \"$SCRIPT_OUTPUT_FILE_1\"\n";
944 };
945 C7926A563D8955E2098E6D1E /* Remove unused math fonts */ = {
946 isa = PBXShellScriptBuildPhase;
947 buildActionMask = 2147483647;
948 files = (
949 );
950 inputFileListPaths = (
951 );
952 inputPaths = (
953 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
954 );
955 name = "Remove unused math fonts";
956 outputFileListPaths = (
957 );
958 outputPaths = (
959 "$(TARGET_BUILD_DIR)/$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/SwiftMath_SwiftMath.bundle",
960 "$(DERIVED_FILE_DIR)/math-fonts-removed",
961 );
962 runOnlyForDeploymentPostprocessing = 0;
963 shellPath = /bin/sh;
964 shellScript = "# LatexPreview uses only SwiftMath's default font, Latin Modern. A signed copy is signed again.\nfind \"$SCRIPT_OUTPUT_FILE_0\" -path '*/mathFonts.bundle/*' \\( -name '*.otf' -o -name '*.plist' \\) ! -name 'latinmodern-math.*' -delete\nif codesign -d \"$SCRIPT_OUTPUT_FILE_0\" 2> /dev/null; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY:--}\" \"$SCRIPT_OUTPUT_FILE_0\"\nfi\ntouch \"$SCRIPT_OUTPUT_FILE_1\"\n";
965 };
878966 C9A138A7D511613ADA30B0C1 /* Compile string catalog */ = {
879967 isa = PBXShellScriptBuildPhase;
880968 buildActionMask = 2147483647;
@@ -1020,6 +1108,7 @@
10201108 COMBINE_HIDPI_IMAGES = YES;
10211109 CURRENT_PROJECT_VERSION = 17;
10221110 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1111 ENABLE_USER_SCRIPT_SANDBOXING = NO;
10231112 GENERATE_INFOPLIST_FILE = NO;
10241113 INFOPLIST_FILE = OrgstarMac/Info.plist;
10251114 LD_RUNPATH_SEARCH_PATHS = (
@@ -1076,6 +1165,7 @@
10761165 CODE_SIGN_STYLE = Automatic;
10771166 CURRENT_PROJECT_VERSION = 17;
10781167 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1168 ENABLE_USER_SCRIPT_SANDBOXING = NO;
10791169 GENERATE_INFOPLIST_FILE = NO;
10801170 INFOPLIST_FILE = OrgstarShare/Info.plist;
10811171 LD_RUNPATH_SEARCH_PATHS = (
@@ -1098,6 +1188,7 @@
10981188 CODE_SIGN_STYLE = Automatic;
10991189 CURRENT_PROJECT_VERSION = 17;
11001190 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1191 ENABLE_USER_SCRIPT_SANDBOXING = NO;
11011192 GENERATE_INFOPLIST_FILE = NO;
11021193 INFOPLIST_FILE = OrgstarShare/Info.plist;
11031194 LD_RUNPATH_SEARCH_PATHS = (
@@ -1143,10 +1234,12 @@
11431234 buildSettings = {
11441235 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
11451236 ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
1237 ASSETCATALOG_COMPILER_OPTIMIZATION = space;
11461238 CODE_SIGN_ENTITLEMENTS = Orgstar/Orgstar.entitlements;
11471239 CODE_SIGN_STYLE = Automatic;
11481240 CURRENT_PROJECT_VERSION = 17;
11491241 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1242 ENABLE_USER_SCRIPT_SANDBOXING = NO;
11501243 GENERATE_INFOPLIST_FILE = NO;
11511244 INFOPLIST_FILE = Orgstar/Info.plist;
11521245 INFOPLIST_KEY_CFBundleDisplayName = orgstar;
@@ -1246,6 +1339,7 @@
12461339 CODE_SIGN_STYLE = Automatic;
12471340 CURRENT_PROJECT_VERSION = 17;
12481341 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1342 ENABLE_USER_SCRIPT_SANDBOXING = NO;
12491343 GENERATE_INFOPLIST_FILE = NO;
12501344 INFOPLIST_FILE = OrgstarWidgets/Info.plist;
12511345 IPHONEOS_DEPLOYMENT_TARGET = 26.0;
@@ -1351,10 +1445,12 @@
13511445 buildSettings = {
13521446 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
13531447 ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
1448 ASSETCATALOG_COMPILER_OPTIMIZATION = space;
13541449 CODE_SIGN_ENTITLEMENTS = Orgstar/Orgstar.entitlements;
13551450 CODE_SIGN_STYLE = Automatic;
13561451 CURRENT_PROJECT_VERSION = 17;
13571452 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1453 ENABLE_USER_SCRIPT_SANDBOXING = NO;
13581454 GENERATE_INFOPLIST_FILE = NO;
13591455 INFOPLIST_FILE = Orgstar/Info.plist;
13601456 INFOPLIST_KEY_CFBundleDisplayName = orgstar;
@@ -1379,6 +1475,7 @@
13791475 CODE_SIGN_STYLE = Automatic;
13801476 CURRENT_PROJECT_VERSION = 17;
13811477 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1478 ENABLE_USER_SCRIPT_SANDBOXING = NO;
13821479 GENERATE_INFOPLIST_FILE = NO;
13831480 INFOPLIST_FILE = OrgstarWidgets/Info.plist;
13841481 IPHONEOS_DEPLOYMENT_TARGET = 26.0;
@@ -1459,6 +1556,7 @@
14591556 COMBINE_HIDPI_IMAGES = YES;
14601557 CURRENT_PROJECT_VERSION = 17;
14611558 DEVELOPMENT_TEAM = ZCNAX3VL9D;
1559 ENABLE_USER_SCRIPT_SANDBOXING = NO;
14621560 GENERATE_INFOPLIST_FILE = NO;
14631561 INFOPLIST_FILE = OrgstarMac/Info.plist;
14641562 LD_RUNPATH_SEARCH_PATHS = (
scripts/build-app.sh +10 −3
@@ -31,9 +31,11 @@ swift build -c release $arch_flags --product OrgstarWidgets
3131# shellcheck disable=SC2086
3232binary="$(swift build -c release $arch_flags --show-bin-path)/Orgstar"
3333
34rm -rf "$app"
35mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$app/Contents/Frameworks"
34rm -rf "$app" .build/app/dSYMs
35mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources" "$app/Contents/Frameworks" .build/app/dSYMs
3636cp "$binary" "$app/Contents/MacOS/Orgstar"
37# The build's debug symbols, for symbolicating crash reports; the executables ship stripped.
38for dsym in "$(dirname "$binary")"/*.dSYM; do ditto "$dsym" ".build/app/dSYMs/$(basename "$dsym")"; done
3739
3840# Sparkle, from its SwiftPM artifact: the framework beside the binary, found through an rpath.
3941sparkle="$(find .build/artifacts -path '*Sparkle.xcframework/macos-*/Sparkle.framework' -maxdepth 7 | head -1)"
@@ -41,9 +43,13 @@ sparkle="$(find .build/artifacts -path '*Sparkle.xcframework/macos-*/Sparkle.fra
4143ditto "$sparkle" "$app/Contents/Frameworks/Sparkle.framework"
4244otool -l "$app/Contents/MacOS/Orgstar" | grep -q '@executable_path/../Frameworks' \
4345 || install_name_tool -add_rpath @executable_path/../Frameworks "$app/Contents/MacOS/Orgstar"
46strip -x "$app/Contents/MacOS/Orgstar"
4447
45# SwiftMath's math fonts, which it finds in the app's resources.
48# SwiftMath's math fonts, which it finds in the app's resources. LatexPreview uses only the
49# default, Latin Modern.
4650cp -R "$(dirname "$binary")/SwiftMath_SwiftMath.bundle" "$app/Contents/Resources/"
51find "$app/Contents/Resources/SwiftMath_SwiftMath.bundle" -path '*/mathFonts.bundle/*' \
52 \( -name '*.otf' -o -name '*.plist' \) ! -name 'latinmodern-math.*' -delete
4753# MathJax, for PDF export.
4854cp -R "$(dirname "$binary")/Orgstar_OrgMathJax.bundle" "$app/Contents/Resources/"
4955
@@ -176,6 +182,7 @@ appex() { # name, extension point, principal class (or ""), attributes, extra en
176182 dir="$app/Contents/PlugIns/$1.appex/Contents"
177183 mkdir -p "$dir/MacOS" "$dir/Resources"
178184 cp "$(dirname "$binary")/$1" "$dir/MacOS/$1"
185 strip -x "$dir/MacOS/$1"
179186 scripts/localize.sh "$dir/Resources"
180187 cat > "$dir/Info.plist" <<PLIST
181188<?xml version="1.0" encoding="UTF-8"?>
scripts/release-mac.sh +2
@@ -52,6 +52,8 @@ out=".build/release"
5252dmg="$out/orgstar-$version.dmg"
5353rm -rf "${out:?}"
5454mkdir -p "$out/dmg"
55# The debug symbols of the stripped executables, for symbolicating crash reports; not uploaded.
56ditto -c -k --keepParent .build/app/dSYMs "$out/orgstar-$version-dSYMs.zip"
5557ditto "$app" "$out/dmg/orgstar.app"
5658ln -s /Applications "$out/dmg/Applications"
5759hdiutil create -quiet -volname "orgstar $version" -srcfolder "$out/dmg" -format UDZO -fs HFS+ "$dmg"