Commit a42c4421 authored by Isuru Fernando's avatar Isuru Fernando
Browse files

support arm64 and universal2 wheels

parent 94f249a0
......@@ -270,22 +270,49 @@ function bdist_wheel_cmd {
cp dist/*.whl $abs_wheelhouse
}
function run_command_universal2 {
if [[ "${PLAT:-}" == "arm64" ]]; then
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
fi
if [[ "${PLAT:-}" == "universal2" ]]; then
export _PYTHON_HOST_PLATFORM="macosx-10.9-x86_64"
export CFLAGS+=" -arch x86_64"
export CXXFLAGS+=" -arch x86_64"
export ARCHFLAGS+=" -arch x86_64"
$@
export _PYTHON_HOST_PLATFORM="macosx-11.0-arm64"
export BUILD_PREFIX=/usr/local-arm64
mkdir -p /usr/local-arm64
export CFLAGS+=" -arch arm64"
export CXXFLAGS+=" -arch arm64"
export ARCHFLAGS+=" -arch arm64"
export LDFLAGS+=" -arch arm64 -L$BUILD_PREFIX/lib -Wl,-rpath,$BUILD_PREFIX/lib ${FC_ARM64_LDFLAGS:-}"
export FCFLAGS+=" -arch arm64"
export FC=$FC_ARM64
export host_alias="aarch64-apple-darwin20.0.0"
$@
else
$@
fi
}
function build_pip_wheel {
# Standard wheel building command with pip wheel
build_wheel_cmd "pip_wheel_cmd" $@
run_command_universal2 build_wheel_cmd "pip_wheel_cmd" $@
}
function build_bdist_wheel {
# Wheel building with bdist_wheel. See bdist_wheel_cmd
build_wheel_cmd "bdist_wheel_cmd" $@
run_command_universal2 build_wheel_cmd "bdist_wheel_cmd" $@
}
function build_wheel {
# Set default building method to pip
build_pip_wheel $@
run_command_universal2 build_pip_wheel $@
}
function build_index_wheel {
function build_index_wheel_cmd {
# Builds wheel from some index, usually pypi
#
# Parameters:
......@@ -316,6 +343,10 @@ function build_index_wheel {
repair_wheelhouse $wheelhouse
}
function build_index_wheel {
run_command_universal2 build_index_wheel_cmd $@
}
function pip_opts {
[ -n "$MANYLINUX_URL" ] && echo "--find-links $MANYLINUX_URL"
}
......
......@@ -103,7 +103,9 @@ function macpython_sdk_list_for_version {
local _major=${_ver%%.*}
local _return
if [ "$_major" -eq "2" ]; then
if [ "${PLAT:-}" == "arm64" ] || [ "${PLAT:-}" == "universal2" ]; then
_return="11.0"
elif [ "$_major" -eq "2" ]; then
[ $(lex_ver $_ver) -lt $(lex_ver 2.7.18) ] && _return="10.6"
[ $(lex_ver $_ver) -ge $(lex_ver 2.7.15) ] && _return="$_return 10.9"
elif [ "$_major" -eq "3" ]; then
......@@ -155,7 +157,11 @@ function pyinst_fname_for_version {
local py_version=$1
local py_osx_ver=${2:-$(macpython_sdk_for_version $py_version)}
local inst_ext=$(pyinst_ext_for_version $py_version)
echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}"
if [ "${PLAT:-}" == "arm64" ] || [ "${PLAT:-}" == "universal2" ]; then
echo "python-${py_version}-macos${py_osx_ver}.${inst_ext}"
else
echo "python-${py_version}-macosx${py_osx_ver}.${inst_ext}"
fi
}
function get_macpython_arch {
......
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