Skip to content

Commit ea78028

Browse files
authored
Merge pull request #7852 from radarhere/arm64_wheels
Build macOS arm64 wheels natively
2 parents f738bb9 + 14f6a34 commit ea78028

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

.github/workflows/wheels-dependencies.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function build_brotli {
6262

6363
function build {
6464
if [[ -n "$IS_MACOS" ]] && [[ "$CIBW_ARCHS" == "arm64" ]]; then
65-
export BUILD_PREFIX="/usr/local"
65+
sudo chown -R runner /usr/local
6666
fi
6767
build_xz
6868
if [ -z "$IS_ALPINE" ] && [ -z "$IS_MACOS" ]; then
@@ -75,8 +75,8 @@ function build {
7575
build_simple xorgproto 2023.2 https://www.x.org/pub/individual/proto
7676
build_simple libXau 1.0.11 https://www.x.org/pub/individual/lib
7777
build_simple libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
78-
if [ -f /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc ]; then
79-
cp /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc /Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig/xcb-proto.pc
78+
if [[ "$CIBW_ARCHS" == "arm64" ]]; then
79+
cp /usr/local/share/pkgconfig/xcb-proto.pc /usr/local/lib/pkgconfig
8080
fi
8181
else
8282
sed s/\${pc_sysrootdir\}// /usr/local/share/pkgconfig/xcb-proto.pc > /usr/local/lib/pkgconfig/xcb-proto.pc
@@ -87,11 +87,6 @@ function build {
8787
build_tiff
8888
build_libpng
8989
build_lcms2
90-
if [[ -n "$IS_MACOS" ]] && [[ "$CIBW_ARCHS" == "arm64" ]]; then
91-
for dylib in libjpeg.dylib libtiff.dylib liblcms2.dylib; do
92-
cp $BUILD_PREFIX/lib/$dylib /opt/arm64-builds/lib
93-
done
94-
fi
9590
build_openjpeg
9691
if [ -f /usr/local/lib64/libopenjp2.so ]; then
9792
cp /usr/local/lib64/libopenjp2.so /usr/local/lib
@@ -131,14 +126,19 @@ curl -fsSL -o pillow-depends-main.zip https://github.com/python-pillow/pillow-de
131126
untar pillow-depends-main.zip
132127

133128
if [[ -n "$IS_MACOS" ]]; then
134-
# webp, libtiff, libxcb cause a conflict with building webp, libtiff, libxcb
129+
# libtiff and libxcb cause a conflict with building libtiff and libxcb
135130
# libxau and libxdmcp cause an issue on macOS < 11
136-
# if php is installed, brew tries to reinstall these after installing openblas
137131
# remove cairo to fix building harfbuzz on arm64
138132
# remove lcms2 and libpng to fix building openjpeg on arm64
139-
# remove zstd to avoid inclusion on x86_64
133+
# remove jpeg-turbo to avoid inclusion on arm64
134+
# remove webp and zstd to avoid inclusion on x86_64
140135
# curl from brew requires zstd, use system curl
141-
brew remove --ignore-dependencies webp libpng libtiff libxcb libxau libxdmcp curl php cairo lcms2 ghostscript zstd
136+
brew remove --ignore-dependencies libpng libtiff libxcb libxau libxdmcp curl cairo lcms2 zstd
137+
if [[ "$CIBW_ARCHS" == "arm64" ]]; then
138+
brew remove --ignore-dependencies jpeg-turbo
139+
else
140+
brew remove --ignore-dependencies webp
141+
fi
142142

143143
brew install pkg-config
144144
fi

.github/workflows/wheels-test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ set -e
44
if [[ "$OSTYPE" == "darwin"* ]]; then
55
brew install fribidi
66
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
7+
if [ -f /opt/homebrew/lib/libfribidi.dylib ]; then
8+
sudo cp /opt/homebrew/lib/libfribidi.dylib /usr/local/lib
9+
fi
710
elif [ "${AUDITWHEEL_POLICY::9}" == "musllinux" ]; then
811
apk add curl fribidi
912
else

.github/workflows/wheels.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
cibw_arch: x86_64
100100
macosx_deployment_target: "10.10"
101101
- name: "macOS arm64"
102-
os: macos-latest
102+
os: macos-14
103103
cibw_arch: arm64
104104
macosx_deployment_target: "11.0"
105105
- name: "manylinux2014 and musllinux x86_64"
@@ -132,7 +132,7 @@ jobs:
132132
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }}
133133
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
134134
CIBW_SKIP: pp38-*
135-
CIBW_TEST_SKIP: "*-macosx_arm64"
135+
CIBW_TEST_SKIP: cp38-macosx_arm64
136136
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
137137

138138
- uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)