Skip to content

Commit ef84eab

Browse files
committed
fix: codesign all Mach-O binaries for notarization, not just .dylib/.so
Use `file` to detect Mach-O binaries instead of matching extensions. Fixes notarization failure for Python framework builds in CI where Python, Python.framework/Python etc. are unsigned executables.
1 parent ab97285 commit ef84eab

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src-tauri/before_build.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,23 @@ 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 shared libraries and the main executable.
47-
# PyInstaller dylibs have different Team IDs, so we need entitlements
48-
# to disable library validation. Sign inner-to-outer (libs first, then exe).
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.
4950
if [[ "$TARGET_TRIPLE" == *"apple"* ]]; then
5051
ENTITLEMENTS="$PROJECT_ROOT/src-tauri/entitlements.plist"
5152
SIGN_IDENTITY="${APPLE_SIGNING_IDENTITY:--}"
5253
echo "Codesigning PyInstaller onedir output (identity: $SIGN_IDENTITY)..."
5354

54-
# Sign all shared libraries first (.dylib, .so)
55-
find "$BACKEND_DIST" -type f \( -name "*.dylib" -o -name "*.so" \) | while read -r lib; do
56-
codesign --force --options runtime --entitlements "$ENTITLEMENTS" \
57-
--sign "$SIGN_IDENTITY" "$lib"
55+
# Sign all Mach-O binaries (dylibs, .so, framework binaries, executables)
56+
# excluding the main executable which we sign last.
57+
find "$BACKEND_DIST" -type f ! -name "syft-space-backend" | while read -r f; do
58+
# Check if file is a Mach-O binary
59+
if file "$f" | grep -q "Mach-O"; then
60+
codesign --force --options runtime --entitlements "$ENTITLEMENTS" \
61+
--sign "$SIGN_IDENTITY" "$f"
62+
fi
5863
done
5964

6065
# Sign the main executable last

0 commit comments

Comments
 (0)