Commit 4b7ea6ed authored by Isuru Fernando's avatar Isuru Fernando
Browse files

support native builds and disable universal2 builds on arm64

parent 66199c73
...@@ -424,8 +424,8 @@ function activate_ccache { ...@@ -424,8 +424,8 @@ function activate_ccache {
echo "Using C compiler: $(which clang)" echo "Using C compiler: $(which clang)"
} }
function macos_intel_build_setup { function macos_intel_native_build_setup {
# Setup build for single arch x86_64 wheels # Setup cross build for single arch x86_64 wheels
export PLAT="x86_64" export PLAT="x86_64"
export _PYTHON_HOST_PLATFORM="macosx-${MB_PYTHON_OSX_VER}-x86_64" export _PYTHON_HOST_PLATFORM="macosx-${MB_PYTHON_OSX_VER}-x86_64"
export CFLAGS+=" -arch x86_64" export CFLAGS+=" -arch x86_64"
...@@ -435,8 +435,13 @@ function macos_intel_build_setup { ...@@ -435,8 +435,13 @@ function macos_intel_build_setup {
export LDFLAGS+=" -arch x86_64" export LDFLAGS+=" -arch x86_64"
} }
function macos_arm64_build_setup { function macos_intel_cross_build_setup {
# Setup build for single arch arm_64 wheels echo "universal2 builds on arm64 is not supported yet."
exit 1
}
function macos_arm64_cross_build_setup {
# Setup cross build for single arch arm_64 wheels
export PLAT="arm64" export PLAT="arm64"
export BUILD_PREFIX=/opt/arm64-builds export BUILD_PREFIX=/opt/arm64-builds
sudo mkdir -p $BUILD_PREFIX sudo mkdir -p $BUILD_PREFIX
...@@ -456,6 +461,13 @@ function macos_arm64_build_setup { ...@@ -456,6 +461,13 @@ function macos_arm64_build_setup {
export host_alias="aarch64-apple-darwin20.0.0" export host_alias="aarch64-apple-darwin20.0.0"
} }
function macos_arm64_native_build_setup {
# Setup native build for single arch arm_64 wheels
export PLAT="arm64"
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
$@
}
function fuse_macos_intel_arm64 { function fuse_macos_intel_arm64 {
local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse}) local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse})
local py_osx_ver=$(echo ${MB_PYTHON_OSX_VER} | sed "s/\./_/g") local py_osx_ver=$(echo ${MB_PYTHON_OSX_VER} | sed "s/\./_/g")
...@@ -477,12 +489,23 @@ function fuse_macos_intel_arm64 { ...@@ -477,12 +489,23 @@ function fuse_macos_intel_arm64 {
function wrap_wheel_builder { function wrap_wheel_builder {
if [[ "${PLAT:-}" == "universal2" ]]; then if [[ "${PLAT:-}" == "universal2" ]]; then
(macos_intel_build_setup && $@) if [[ "$(uname -m)" == "arm64" ]]; then
rm -rf *-stamp (macos_intel_cross_build_setup && $@)
(macos_arm64_build_setup && $@) rm -rf *-stamp
fuse_macos_intel_arm64 (macos_arm64_native_build_setup && $@)
elif [[ "${PLAT:-}" == "arm64" && "(uname -m)" != "arm64" ]]; then fuse_macos_intel_arm64
(macos_arm64_build_setup && $@) else
(macos_intel_native_build_setup && $@)
rm -rf *-stamp
(macos_arm64_cross_build_setup && $@)
fuse_macos_intel_arm64
fi
elif [[ "${PLAT:-}" == "arm64" ]]; then
if [[ "$(uname -m)" == "arm64" ]]; then
(macos_arm64_native_build_setup && $@)
else
(macos_arm64_cross_build_setup && $@)
fi
else else
$@ $@
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment