@@ -19,7 +19,7 @@ FREETYPE_VERSION=2.13.2
1919HARFBUZZ_VERSION=8.3.0
2020LIBPNG_VERSION=1.6.40
2121JPEGTURBO_VERSION=3.0.1
22- OPENJPEG_VERSION=2.5.0
22+ OPENJPEG_VERSION=2.5.2
2323XZ_VERSION=5.4.5
2424TIFF_VERSION=4.6.0
2525LCMS2_VERSION=2.16
@@ -40,7 +40,7 @@ BROTLI_VERSION=1.1.0
4040
4141if [[ -n " $IS_MACOS " ]] && [[ " $CIBW_ARCHS " == " x86_64" ]]; then
4242 function build_openjpeg {
43- local out_dir=$( fetch_unpack https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION} .tar.gz openjpeg-2.5.0 .tar.gz)
43+ local out_dir=$( fetch_unpack https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION} .tar.gz openjpeg-${OPENJPEG_VERSION} .tar.gz)
4444 (cd $out_dir \
4545 && cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX /lib . \
4646 && make install)
@@ -62,7 +62,7 @@ function build_brotli {
6262
6363function 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,12 +87,10 @@ 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
91+ if [ -f /usr/local/lib64/libopenjp2.so ]; then
92+ cp /usr/local/lib64/libopenjp2.so /usr/local/lib
93+ fi
9694
9795 ORIGINAL_CFLAGS=$CFLAGS
9896 CFLAGS=" $CFLAGS -O3 -DNDEBUG"
@@ -128,14 +126,19 @@ curl -fsSL -o pillow-depends-main.zip https://github.com/python-pillow/pillow-de
128126untar pillow-depends-main.zip
129127
130128if [[ -n " $IS_MACOS " ]]; then
131- # webp, libtiff, libxcb cause a conflict with building webp, libtiff, libxcb
129+ # libtiff and libxcb cause a conflict with building libtiff and libxcb
132130 # libxau and libxdmcp cause an issue on macOS < 11
133- # if php is installed, brew tries to reinstall these after installing openblas
134131 # remove cairo to fix building harfbuzz on arm64
135132 # remove lcms2 and libpng to fix building openjpeg on arm64
136- # 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
137135 # curl from brew requires zstd, use system curl
138- 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
139142
140143 brew install pkg-config
141144fi
0 commit comments