Skip to content

Commit 4fce0ad

Browse files
committed
Fix build_mac_arm64.sh (#10)
1 parent 7acb608 commit 4fce0ad

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ clean:
2222

2323
mac-arm64:
2424
@echo "Make macOS arm64 whl"
25-
bash packages/build_mac_arm64.sh
25+
packages/build_mac_arm64.sh
2626
@echo "Done."
2727

2828
build: clean buildlib wheel

packages/build_mac_arm64.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
set -e
44

5+
# check current arch
6+
if [ "$(uname -m)" != "arm64" ]; then
7+
echo "OS not supported, run with arch -arm64 /bin/bash"
8+
exit 1
9+
fi
10+
511
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
612
PROJ_DIR=$(dirname ${DIR})
713

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

33+
# Download MacOSX11.0.sdk.tar.xz
34+
if [ ! -f ${PROJ_DIR}/python_pkg/MacOSX11.0.sdk.tar.xz ]; then
35+
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
36+
fi
37+
38+
# Extract MacOSX11.0.sdk.tar.xz
39+
if [ ! -f ${PROJ_DIR}/cmake/toolchain/darwin-x86_64/Entitlements.plist ]; then
40+
tar xJf ${PROJ_DIR}/python_pkg/MacOSX11.0.sdk.tar.xz -C cmake/toolchain/darwin-x86_64 --strip-components=1
41+
fi
42+
43+
# Fix soft link if darwin-aarch64 not linked to darwin-x86_64
44+
if [ -L ${PROJ_DIR}/cmake/toolchain/darwin-aarch64 ]; then
45+
dest=$(readlink ${PROJ_DIR}/cmake/toolchain/darwin-aarch64)
46+
fi
47+
48+
if [ "${dest}" != "darwin-x86_64" ]; then
49+
rm -f ${PROJ_DIR}/cmake/toolchain/darwin-aarch64
50+
ln -sf darwin-x86_64 ${PROJ_DIR}/cmake/toolchain/darwin-aarch64
51+
fi
52+
53+
2754
for PY_VER in 3.9.13 3.10.11 3.11.3; do
2855
if [ ! -f ${PROJ_DIR}/python_pkg/python-${PY_VER}-macos11.pkg ]; then
2956
wget https://www.python.org/ftp/python/${PY_VER}/python-${PY_VER}-macos11.pkg -O ${PROJ_DIR}/python_pkg/python-${PY_VER}-macos11.pkg

0 commit comments

Comments
 (0)