Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions packages/komodo_defi_framework/macos/komodo_defi_framework.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ A new Flutter FFI plugin project.
echo "Warning: libkdflib.dylib not found in lib/libkdflib.dylib"
fi

# Helper to codesign with hardened runtime + timestamp (best-effort)
kdf_codesign() {
# args: path-to-binary
local bin_path="$1"
[ -n "$EXPANDED_CODE_SIGN_IDENTITY" ] || return 0
[ -f "$bin_path" ] || return 0
codesign --force --options runtime --timestamp=auto --sign "$EXPANDED_CODE_SIGN_IDENTITY" "$bin_path" 2>/dev/null || true
}

# Prune binary slices to match $ARCHS (preserve universals) in Release builds only
if [ "$CONFIGURATION" = "Release" ]; then
TARGET_ARCHS="${ARCHS:-$(arch)}"
Expand Down Expand Up @@ -102,16 +111,21 @@ A new Flutter FFI plugin project.
thin_binary_to_archs "$FRAMEWORKS_DIR/libkdflib.dylib" "$TARGET_ARCHS"
if [ -f "$FRAMEWORKS_DIR/libkdflib.dylib" ]; then install_name_tool -id "@rpath/libkdflib.dylib" "$FRAMEWORKS_DIR/libkdflib.dylib"; fi

# Re-sign after modifications (best-effort)
if [ -n "$EXPANDED_CODE_SIGN_IDENTITY" ]; then
codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" "$APP_SUPPORT_DIR/kdf" 2>/dev/null || true
codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" "$FRAMEWORKS_DIR/libkdflib.dylib" 2>/dev/null || true
fi
# Re-sign after modifications (best-effort) with hardened runtime and timestamp
kdf_codesign "$APP_SUPPORT_DIR/kdf"
kdf_codesign "$FRAMEWORKS_DIR/libkdflib.dylib"
fi

# Sign kdf and dylib in non-Release configurations only to avoid double-signing
if [ "$CONFIGURATION" != "Release" ]; then
kdf_codesign "$APP_SUPPORT_DIR/kdf"
kdf_codesign "$FRAMEWORKS_DIR/libkdflib.dylib"
fi

# Fail if neither file was found
if [ $FOUND_REQUIRED_FILE -eq 0 ]; then
echo "Error: Neither kdf executable nor libkdflib.dylib was found. At least one is required."
printf "\n\nError: Neither kdf executable nor libkdflib.dylib was found. At least one is required.\n"
printf "Please try run flutter clean && flutter build bundle and try again.\n\n"
exit 1
fi
SCRIPT
Expand Down