Skip to content

Commit d38b8e3

Browse files
committed
build(portable): Prefer AXe Homebrew archive for bundling
Use AXe's Homebrew-specific unsigned archive when available and fall back\nto the legacy signed archive for older releases. This aligns the\nbundling pipeline with AXe's Homebrew packaging and reduces signature\nnoise during downstream install flows.\n\nCo-Authored-By: Claude <noreply@anthropic.com>
1 parent 489be6c commit d38b8e3

1 file changed

Lines changed: 38 additions & 23 deletions

File tree

scripts/bundle-axe.sh

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ fi
3838
mkdir -p "$BUNDLED_DIR"
3939

4040
USE_LOCAL_AXE=false
41+
AXE_ARCHIVE_FLAVOR="local-signed"
4142
if [ -z "${AXE_FORCE_REMOTE}" ] && [ "${AXE_USE_LOCAL:-0}" = "1" ]; then
4243
USE_LOCAL_AXE=true
4344
fi
@@ -92,16 +93,26 @@ else
9293

9394
echo "📥 Downloading latest AXe release from GitHub..."
9495

95-
# Construct release download URL from pinned version
96-
AXE_RELEASE_URL="https://github.com/cameroncooke/AXe/releases/download/v${PINNED_AXE_VERSION}/AXe-macOS-v${PINNED_AXE_VERSION}.tar.gz"
96+
# Prefer Homebrew-specific archive (unsigned for relocation compatibility),
97+
# and fall back to legacy signed archive for older AXe releases.
98+
AXE_RELEASE_BASE_URL="https://github.com/cameroncooke/AXe/releases/download/v${PINNED_AXE_VERSION}"
99+
AXE_HOMEBREW_URL="${AXE_RELEASE_BASE_URL}/AXe-macOS-homebrew-v${PINNED_AXE_VERSION}.tar.gz"
100+
AXE_LEGACY_URL="${AXE_RELEASE_BASE_URL}/AXe-macOS-v${PINNED_AXE_VERSION}.tar.gz"
97101

98102
# Create temp directory
99103
mkdir -p "$AXE_TEMP_DIR"
100104
cd "$AXE_TEMP_DIR"
101105

102106
# Download and extract the release
103-
echo "📥 Downloading AXe release archive ($AXE_RELEASE_URL)..."
104-
curl -L -o "axe-release.tar.gz" "$AXE_RELEASE_URL"
107+
echo "📥 Downloading AXe Homebrew archive ($AXE_HOMEBREW_URL)..."
108+
if curl -fL -o "axe-release.tar.gz" "$AXE_HOMEBREW_URL"; then
109+
AXE_ARCHIVE_FLAVOR="homebrew-unsigned"
110+
echo "✅ Downloaded AXe Homebrew archive"
111+
else
112+
echo "⚠️ AXe Homebrew archive unavailable, falling back to legacy archive"
113+
curl -fL -o "axe-release.tar.gz" "$AXE_LEGACY_URL"
114+
AXE_ARCHIVE_FLAVOR="legacy-signed"
115+
fi
105116

106117
echo "📦 Extracting AXe release archive..."
107118
tar -xzf "axe-release.tar.gz"
@@ -157,27 +168,31 @@ ls -la "$BUNDLED_DIR/Frameworks/"
157168
# Verify binary can run with bundled frameworks (macOS only)
158169
OS_NAME="$(uname -s)"
159170
if [ "$OS_NAME" = "Darwin" ]; then
160-
echo "🔏 Verifying AXe signatures..."
161-
if ! codesign --verify --deep --strict "$BUNDLED_DIR/axe"; then
162-
echo "❌ Signature verification failed for bundled AXe binary"
163-
exit 1
164-
fi
165-
166-
while IFS= read -r framework_path; do
167-
framework_name="$(basename "$framework_path" .framework)"
168-
framework_binary="$framework_path/Versions/A/$framework_name"
169-
if [ ! -f "$framework_binary" ]; then
170-
framework_binary="$framework_path/Versions/Current/$framework_name"
171-
fi
172-
if [ ! -f "$framework_binary" ]; then
173-
echo "❌ Framework binary not found: $framework_binary"
174-
exit 1
175-
fi
176-
if ! codesign --verify --deep --strict "$framework_binary"; then
177-
echo "❌ Signature verification failed for framework binary: $framework_binary"
171+
if [ "$AXE_ARCHIVE_FLAVOR" = "homebrew-unsigned" ]; then
172+
echo "ℹ️ Skipping strict codesign verification for unsigned AXe Homebrew archive"
173+
else
174+
echo "🔏 Verifying AXe signatures..."
175+
if ! codesign --verify --deep --strict "$BUNDLED_DIR/axe"; then
176+
echo "❌ Signature verification failed for bundled AXe binary"
178177
exit 1
179178
fi
180-
done < <(find "$BUNDLED_DIR/Frameworks" -name "*.framework" -type d)
179+
180+
while IFS= read -r framework_path; do
181+
framework_name="$(basename "$framework_path" .framework)"
182+
framework_binary="$framework_path/Versions/A/$framework_name"
183+
if [ ! -f "$framework_binary" ]; then
184+
framework_binary="$framework_path/Versions/Current/$framework_name"
185+
fi
186+
if [ ! -f "$framework_binary" ]; then
187+
echo "❌ Framework binary not found: $framework_binary"
188+
exit 1
189+
fi
190+
if ! codesign --verify --deep --strict "$framework_binary"; then
191+
echo "❌ Signature verification failed for framework binary: $framework_binary"
192+
exit 1
193+
fi
194+
done < <(find "$BUNDLED_DIR/Frameworks" -name "*.framework" -type d)
195+
fi
181196

182197
echo "🛡️ Assessing AXe with Gatekeeper..."
183198
SPCTL_LOG="$(mktemp)"

0 commit comments

Comments
 (0)