Use patched version of zlib-ng to fix install name.

This commit is contained in:
Russell Keith-Magee 2025-02-10 10:08:56 +08:00
parent 3c2310e090
commit 1a0adc7f3f
No known key found for this signature in database
GPG Key ID: 3D2DAB6A37BB5BC3
4 changed files with 86 additions and 4 deletions

View File

@ -26,6 +26,7 @@ else
MB_ML_VER=${AUDITWHEEL_POLICY:9}
fi
PLAT=$CIBW_ARCHS
PATCH_DIR=$(pwd)/patches
# Define custom utilities
source wheels/multibuild/common_utils.sh
@ -36,7 +37,9 @@ fi
ARCHIVE_SDIR=pillow-depends-main
# Package versions for fresh source builds
# Package versions for fresh source builds. Version numbers with "Patched"
# annotations have a source code patch that is required for some platforms. If
# you change those versions, ensure the patch is also updated.
FREETYPE_VERSION=2.13.3
HARFBUZZ_VERSION=10.2.0
LIBPNG_VERSION=1.6.46
@ -45,7 +48,7 @@ OPENJPEG_VERSION=2.5.3
XZ_VERSION=5.6.4
TIFF_VERSION=4.6.0
LCMS2_VERSION=2.16
ZLIB_NG_VERSION=2.2.3
ZLIB_NG_VERSION=2.2.3 # patched
LIBWEBP_VERSION=1.5.0
BZIP2_VERSION=1.0.8
LIBXCB_VERSION=1.17.0
@ -69,7 +72,7 @@ function build_zlib_ng {
if [ -e zlib-stamp ]; then return; fi
fetch_unpack https://github.com/zlib-ng/zlib-ng/archive/$ZLIB_NG_VERSION.tar.gz zlib-ng-$ZLIB_NG_VERSION.tar.gz
(cd zlib-ng-$ZLIB_NG_VERSION \
&& ./configure --prefix=$BUILD_PREFIX --zlib-compat \
&& ./configure --prefix=$BUILD_PREFIX --installnamedir=$BUILD_PREFIX/lib --zlib-compat \
&& make -j4 \
&& make install)
touch zlib-stamp

View File

@ -47,7 +47,7 @@ repos:
- id: end-of-file-fixer
exclude: ^Tests/images/
- id: trailing-whitespace
exclude: ^.github/.*TEMPLATE|^Tests/(fonts|images)/
exclude: ^.github/.*TEMPLATE|^Tests/(fonts|images)/|^patches/*.patch
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.31.1

14
patches/README.md Normal file
View File

@ -0,0 +1,14 @@
Although we try to use official sources for dependencies, sometimes the official
sources don't support a platform (especially mobile platforms), or there's a bug
fix/feature that is required to support Pillow's usage.
This folder contains patches that must be applied to official sources, organized
by the platforms that need those patches.
Each patch is against the root of the unpacked official tarball, and is named by
appending `.patch` to the end of the tarball that is to be patched. This
includes the full version number; so if the version is bumped, the patch will
at a minimum require a filename change.
Wherever possible, these patches should be contributed upstream, in the hope that
future Pillow versions won't need to maintain these patches.

View File

@ -0,0 +1,65 @@
# zlib-ng doesn't allow for manual specification of `--installnamedir`.
#
# Submitted upstream as https://github.com/zlib-ng/zlib-ng/pull/1867
diff --git a/configure b/configure
index 3487d092..91037f77 100755
--- a/configure
+++ b/configure
@@ -83,6 +83,7 @@ bindir=${bindir-'${exec_prefix}/bin'}
libdir=${libdir-'${exec_prefix}/lib'}
sharedlibdir=${sharedlibdir-'${libdir}'}
includedir=${includedir-'${prefix}/include'}
+installnamedir=${installnamedir-'@rpath'}
mandir=${mandir-'${prefix}/share/man'}
shared_ext='.so'
shared=1
@@ -158,7 +159,7 @@ case "$1" in
echo 'usage:' | tee -a configure.log
echo ' configure [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
echo ' [--static] [--32] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
- echo ' [--includedir=INCLUDEDIR] [--mandir=MANDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
+ echo ' [--includedir=INCLUDEDIR] [--installnamedir="@rpath"] [--mandir=MANDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
echo ' [--sprefix=SYMBOL_PREFIX] Adds a prefix to all exported symbols' | tee -a configure.log
echo ' [--warn] Enables extra compiler warnings' | tee -a configure.log
echo ' [--debug] Enables extra debug prints during operation' | tee -a configure.log
@@ -183,6 +184,7 @@ case "$1" in
-l*=* | --libdir=*) libdir=$(echo $1 | sed 's/.*=//'); shift ;;
--sharedlibdir=*) sharedlibdir=$(echo $1 | sed 's/.*=//'); shift ;;
-i*=* | --includedir=*) includedir=$(echo $1 | sed 's/.*=//');shift ;;
+ --installnamedir=*) installnamedir=$(echo $1 | sed 's/.*=//'); shift ;;
--mandir=*) mandir=$(echo $1 | sed 's/.*=//');shift ;;
-u*=* | --uname=*) uname=$(echo $1 | sed 's/.*=//');shift ;;
-p* | --prefix) prefix="$2"; shift; shift ;;
@@ -470,7 +472,7 @@ if test "$gcc" -eq 1 && ($cc $CFLAGS -c $test.c) >> configure.log 2>&1; then
SHAREDLIBM=${LIBNAME}.$VER1$shared_ext
SHAREDTARGET=$SHAREDLIBV
LDSHARED=${LDSHARED-"$cc"}
- LDSHAREDFLAGS="-dynamiclib -install_name @rpath/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}"
+ LDSHAREDFLAGS="-dynamiclib -install_name ${installnamedir}/${SHAREDLIBM} -compatibility_version ${VER1} -current_version ${VER3}"
if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then
AR="${CROSS_PREFIX}libtool"
elif libtool -V 2>&1 | grep Apple > /dev/null; then
@@ -1936,6 +1938,7 @@ echo TEST = $TEST >> configure.log
echo VER = $VER >> configure.log
echo exec_prefix = $exec_prefix >> configure.log
echo includedir = $includedir >> configure.log
+echo installnamedir = $installnamedir >> configure.log
echo bindir = $bindir >> configure.log
echo libdir = $libdir >> configure.log
echo mandir = $mandir >> configure.log
@@ -2007,6 +2010,7 @@ sed < $SRCDIR/Makefile.in "
/^libdir *=/s#=.*#= $libdir#
/^sharedlibdir *=/s#=.*#= $sharedlibdir#
/^includedir *=/s#=.*#= $includedir#
+/^installnamedir *=/s#=.*#= $installnamedir#
/^mandir *=/s#=.*#= $mandir#
/^SRCDIR *=/s#=.*#=$SRCDIR#
/^INCLUDES *=/s#=.*#=$INCLUDES#
@@ -2206,6 +2210,7 @@ sed < $SRCDIR/zlib.pc.in "
/^libdir *=/s#=.*#=$libdir#
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
/^includedir *=/s#=.*#=$includedir#
+/^installnamedir *=/s#=.*#=$installnamedir#
/^mandir *=/s#=.*#=$mandir#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
" | sed -e "