Skip to content

Commit 507decd

Browse files
committed
fix: sign .framework bundles as bundles for notarization
macOS frameworks must be codesigned as bundle directories, not by signing individual files inside them. Split signing into three phases: 1. Mach-O files outside .framework bundles 2. .framework bundles (with --deep) 3. Main executable last Fixes "The signature of the binary is invalid" for Python.framework.
1 parent ef84eab commit 507decd

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

src-tauri/before_build.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,35 @@ cp -R dist/syft-space-backend/* "$BACKEND_DIST/"
4343
# 4. Ensure the main executable is executable
4444
chmod +x "$BACKEND_DIST/syft-space-backend${EXE_EXT}"
4545

46-
# 5. On macOS, codesign all Mach-O binaries and the main executable.
47-
# PyInstaller bundles dylibs, shared objects, framework binaries, and
48-
# standalone executables (e.g. Python) — all must be signed for notarization.
49-
# Sign inner-to-outer: deepest files first, then the main executable last.
46+
# 5. On macOS, codesign all binaries for notarization.
47+
# Signing order matters — inner-to-outer:
48+
# a) Mach-O files NOT inside .framework bundles
49+
# b) .framework bundles (signed as bundles, not individual files)
50+
# c) The main executable last
5051
if [[ "$TARGET_TRIPLE" == *"apple"* ]]; then
5152
ENTITLEMENTS="$PROJECT_ROOT/src-tauri/entitlements.plist"
5253
SIGN_IDENTITY="${APPLE_SIGNING_IDENTITY:--}"
5354
echo "Codesigning PyInstaller onedir output (identity: $SIGN_IDENTITY)..."
5455

55-
# Sign all Mach-O binaries (dylibs, .so, framework binaries, executables)
56-
# excluding the main executable which we sign last.
56+
# a) Sign all Mach-O files that are NOT inside a .framework bundle
5757
find "$BACKEND_DIST" -type f ! -name "syft-space-backend" | while read -r f; do
58-
# Check if file is a Mach-O binary
58+
# Skip files inside .framework bundles (those are signed as bundles below)
59+
if [[ "$f" == *".framework/"* ]]; then
60+
continue
61+
fi
5962
if file "$f" | grep -q "Mach-O"; then
6063
codesign --force --options runtime --entitlements "$ENTITLEMENTS" \
6164
--sign "$SIGN_IDENTITY" "$f"
6265
fi
6366
done
6467

65-
# Sign the main executable last
68+
# b) Sign .framework bundles (must be signed as bundles, not individual files)
69+
find "$BACKEND_DIST" -type d -name "*.framework" | while read -r fw; do
70+
codesign --force --deep --options runtime --entitlements "$ENTITLEMENTS" \
71+
--sign "$SIGN_IDENTITY" "$fw"
72+
done
73+
74+
# c) Sign the main executable last
6675
codesign --force --options runtime --entitlements "$ENTITLEMENTS" \
6776
--sign "$SIGN_IDENTITY" "$BACKEND_DIST/syft-space-backend${EXE_EXT}"
6877
echo "Codesigning complete."

0 commit comments

Comments
 (0)