Skip to content

Commit 68dbf52

Browse files
committed
fix: archive only the objects a configuration actually produced [skip ci]
Not every target exists in every configuration -- catalyst omits some of the arm64 zlib SIMD variants -- and a glob matching nothing was handed to ar verbatim, failing the build after an otherwise complete compile. archive_lib now filters the glob list to what exists, which also subsumes the header-only case. The original script papered over both with a blanket '|| echo Failed to archive', which is how the shipped libv8_heap_base_headers.a came to be a stale 8-byte file.
1 parent a357531 commit 68dbf52

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

scripts/matrix/build-ios.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,15 @@ DIST="$ROOT_DIR/dist/ios-$VARIANT"
111111
cd "$V8_DIR"
112112

113113
archive_lib() {
114-
local name="$1" objects="$2" first
115-
# shellcheck disable=SC2086 -- $objects is a deliberate glob list
116-
first=$(ls $objects 2>/dev/null | head -1 || true)
117-
if [ -z "$first" ]; then
114+
local name="$1" objects="$2" o
115+
local existing=()
116+
# Filter to what actually exists. Not every target is produced by every
117+
# configuration -- catalyst omits some of the arm64 zlib SIMD variants, for
118+
# instance -- and a glob that matches nothing would otherwise be handed to
119+
# ar verbatim.
120+
# shellcheck disable=SC2086 -- deliberate glob expansion
121+
for o in $objects; do [ -e "$o" ] && existing+=("$o"); done
122+
if [ ${#existing[@]} -eq 0 ]; then
118123
# v8_heap_base_headers is header-only and compiles to nothing. The
119124
# runtime still links the archive by name, so write an empty one --
120125
# what ships today is an 8-byte archive for exactly this reason.
@@ -124,8 +129,7 @@ archive_lib() {
124129
printf '!<arch>\n' > "$DIST/lib/$name.a"
125130
return
126131
fi
127-
# shellcheck disable=SC2086
128-
ar r "$DIST/lib/$name.a" $objects
132+
ar r "$DIST/lib/$name.a" "${existing[@]}"
129133
strip -S -x "$DIST/lib/$name.a" 2>/dev/null || true
130134
}
131135

0 commit comments

Comments
 (0)