From 831b2012957b771f52895ce12e52f6dbc9806535 Mon Sep 17 00:00:00 2001 From: Jonathan Cardoso Machado Date: Sun, 12 Apr 2026 11:23:08 -0300 Subject: [PATCH 1/2] fix: macOS x64 prebuilt binary contains arm64 architecture The universal build lipo extraction wrote both architectures to the same output file before packaging, so the arm64 slice overwrote the x86_64 one. Both tarballs ended up containing the arm64 binary. Fix by interleaving: extract each architecture and package it immediately before extracting the next. Fixes #445 --- scripts/ci/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 6a85e5a60..0f6dde6ab 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -494,10 +494,10 @@ if [[ "$MACOS_UNIVERSAL_BUILD" == "true" ]]; then # play well with electron-builder which will try to lipo native add-ons # for different architectures. # -- - lipo build/Release/node_libcurl.node -thin x86_64 -output lib/binding/node_libcurl.node lipo build/Release/node_libcurl.node -thin arm64 -output lib/binding/node_libcurl.node - npm_config_target_arch=arm64 pnpm pregyp package testpackage --verbose + + lipo build/Release/node_libcurl.node -thin x86_64 -output lib/binding/node_libcurl.node npm_config_target_arch=x64 pnpm pregyp package testpackage --verbose else pnpm pregyp package testpackage --verbose From 96399a3b3d93da924671226e922920eaad38642a Mon Sep 17 00:00:00 2001 From: Jonathan Cardoso Machado Date: Sun, 12 Apr 2026 11:49:08 -0300 Subject: [PATCH 2/2] fix: restore native arch binary after packaging and skip testpackage for cross arch The previous fix left the x86_64 binary in lib/binding/ after packaging, causing tests to fail on arm64 CI runners. Now we package the cross arch first (without testpackage since it can't be loaded), then the native arch last (with testpackage) so the correct binary remains for tests. --- scripts/ci/build.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 0f6dde6ab..62e9fafe0 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -494,11 +494,24 @@ if [[ "$MACOS_UNIVERSAL_BUILD" == "true" ]]; then # play well with electron-builder which will try to lipo native add-ons # for different architectures. # -- - lipo build/Release/node_libcurl.node -thin arm64 -output lib/binding/node_libcurl.node - npm_config_target_arch=arm64 pnpm pregyp package testpackage --verbose + native_arch=$(uname -m) + if [ "$native_arch" == "x86_64" ]; then + cross_arch="arm64" + native_npm_arch="x64" + cross_npm_arch="arm64" + else + cross_arch="x86_64" + native_npm_arch="arm64" + cross_npm_arch="x64" + fi + + # Package the cross-compiled architecture first (no testpackage - can't load it) + lipo build/Release/node_libcurl.node -thin $cross_arch -output lib/binding/node_libcurl.node + npm_config_target_arch=$cross_npm_arch pnpm pregyp package --verbose - lipo build/Release/node_libcurl.node -thin x86_64 -output lib/binding/node_libcurl.node - npm_config_target_arch=x64 pnpm pregyp package testpackage --verbose + # Package the native architecture (with testpackage to verify it loads) + lipo build/Release/node_libcurl.node -thin $native_arch -output lib/binding/node_libcurl.node + npm_config_target_arch=$native_npm_arch pnpm pregyp package testpackage --verbose else pnpm pregyp package testpackage --verbose fi