Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ clean:

mac-arm64:
@echo "Make macOS arm64 whl"
bash packages/build_mac_arm64.sh
packages/build_mac_arm64.sh
@echo "Done."

build: clean buildlib wheel
27 changes: 27 additions & 0 deletions packages/build_mac_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

set -e

# check current arch
if [ "$(uname -m)" != "arm64" ]; then
echo "OS not supported, run with arch -arm64 /bin/bash"
exit 1
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROJ_DIR=$(dirname ${DIR})

Expand All @@ -24,6 +30,27 @@ elif [ -f /usr/local/opt/llvm/bin/clang ]; then
export CC=/usr/local/opt/llvm/bin/clang
fi

# Download MacOSX11.0.sdk.tar.xz
if [ ! -f ${PROJ_DIR}/python_pkg/MacOSX11.0.sdk.tar.xz ]; then
wget "https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.0.sdk.tar.xz" -O ${PROJ_DIR}/python_pkg/MacOSX11.0.sdk.tar.xz
fi

# Extract MacOSX11.0.sdk.tar.xz
if [ ! -f ${PROJ_DIR}/cmake/toolchain/darwin-x86_64/Entitlements.plist ]; then
tar xJf ${PROJ_DIR}/python_pkg/MacOSX11.0.sdk.tar.xz -C cmake/toolchain/darwin-x86_64 --strip-components=1
fi

# Fix soft link if darwin-aarch64 not linked to darwin-x86_64
if [ -L ${PROJ_DIR}/cmake/toolchain/darwin-aarch64 ]; then
dest=$(readlink ${PROJ_DIR}/cmake/toolchain/darwin-aarch64)
fi

if [ "${dest}" != "darwin-x86_64" ]; then
rm -f ${PROJ_DIR}/cmake/toolchain/darwin-aarch64
ln -sf darwin-x86_64 ${PROJ_DIR}/cmake/toolchain/darwin-aarch64
fi


for PY_VER in 3.9.13 3.10.11 3.11.3; do
if [ ! -f ${PROJ_DIR}/python_pkg/python-${PY_VER}-macos11.pkg ]; then
wget https://www.python.org/ftp/python/${PY_VER}/python-${PY_VER}-macos11.pkg -O ${PROJ_DIR}/python_pkg/python-${PY_VER}-macos11.pkg
Expand Down