Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use patched version of zlib-ng to fix install name #8743

Closed
wants to merge 4 commits into from
Closed
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
9 changes: 6 additions & 3 deletions .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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.4
ZLIB_NG_VERSION=2.2.4 # patched
LIBWEBP_VERSION=1.5.0
BZIP2_VERSION=1.0.8
LIBXCB_VERSION=1.17.0
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ include tox.ini
graft Tests
graft src
graft depends
graft patches
graft winbuild
graft docs
graft _custom_build
Expand Down
14 changes: 14 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
@@ -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.
65 changes: 65 additions & 0 deletions patches/zlib-ng-2.2.4.tar.gz.patch
Original file line number Diff line number Diff line change
@@ -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 "
Loading