Skip to content

Commit 174254e

Browse files
fix: sign bundled native resources
1 parent f0655e4 commit 174254e

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎macos/CursorAPI/Scripts/package-app.sh‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,33 @@ $SPARKLE_KEY_PLIST
628628
</dict>
629629
</plist>
630630
PLIST
631+
632+
codesign_one() {
633+
local path="$1"
634+
if [ "$CODE_SIGN_IDENTITY" = "-" ]; then
635+
codesign --force --sign - "$path" >/dev/null
636+
else
637+
codesign --force --options runtime --timestamp --sign "$CODE_SIGN_IDENTITY" "$path" >/dev/null
638+
fi
639+
}
640+
641+
sign_nested_native_code() {
642+
local root="$1"
643+
local signed=0
644+
645+
while IFS= read -r -d '' path; do
646+
if file -b "$path" | grep -q 'Mach-O'; then
647+
codesign_one "$path"
648+
signed=$((signed + 1))
649+
fi
650+
done < <(find "$root" -type f -print0)
651+
652+
if [ "$signed" -gt 0 ]; then
653+
echo "Signed $signed nested native resource file(s)"
654+
fi
655+
}
656+
657+
sign_nested_native_code "$RESOURCES_DIR"
631658
if [ "$CODE_SIGN_IDENTITY" = "-" ]; then
632659
codesign --force --deep --sign - "$FRAMEWORKS_DIR/Sparkle.framework" >/dev/null
633660
codesign --force --deep --sign - "$APP_DIR" >/dev/null

0 commit comments

Comments
 (0)