Skip to content

Commit 5b3e8f4

Browse files
committed
fix: force architecture-specific macOS wheels (not universal2)
- Set _PYTHON_HOST_PLATFORM and ARCHFLAGS for macOS builds - Prevents setuptools from creating universal2 wheels - Ensures separate wheels for x86_64 and arm64 with correct JRE binaries - Fixes: macosx_10_9_x86_64 and macosx_11_0_arm64 instead of universal2
1 parent 698e499 commit 5b3e8f4

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

bindings/python/build-native.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,13 @@ case "$PLATFORM" in
157157
;;
158158
darwin/amd64)
159159
PLAT_NAME="macosx_10_9_x86_64"
160+
MACOSX_VERSION="10.9"
161+
ARCH_TAG="x86_64"
160162
;;
161163
darwin/arm64)
162164
PLAT_NAME="macosx_11_0_arm64"
165+
MACOSX_VERSION="11.0"
166+
ARCH_TAG="arm64"
163167
;;
164168
windows/amd64)
165169
PLAT_NAME="win_amd64"
@@ -175,6 +179,14 @@ esac
175179

176180
echo -e "${CYAN}🏷️ Platform tag: ${YELLOW}${PLAT_NAME}${NC}"
177181

182+
# Set environment variables to force correct platform tag for macOS
183+
if [[ "$PLATFORM" == darwin/* ]]; then
184+
export _PYTHON_HOST_PLATFORM="macosx-${MACOSX_VERSION}-${ARCH_TAG}"
185+
export ARCHFLAGS="-arch ${ARCH_TAG}"
186+
echo -e "${CYAN}🏷️ macOS platform override: ${YELLOW}${_PYTHON_HOST_PLATFORM}${NC}"
187+
echo -e "${CYAN}🏷️ ARCHFLAGS: ${YELLOW}${ARCHFLAGS}${NC}"
188+
fi
189+
178190
# Build wheel
179191
python3 -m build --wheel --outdir "$SCRIPT_DIR/dist"
180192

0 commit comments

Comments
 (0)