Skip to content

Commit 0065f22

Browse files
committed
Use zlib-ng
1 parent 01446da commit 0065f22

File tree

5 files changed

+610
-3
lines changed

5 files changed

+610
-3
lines changed

recipe/build_base.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ if [[ ! -d ${SRC_DIR}/python-bin ]]; then
1111
export PATH=${SRC_DIR}/python-bin/bin:${PATH}
1212
fi
1313

14+
# tcl/tk seem to add a dependency against zlib
15+
# but they actually do not appear in the header files
16+
# so they aren't useful in the context off dynamic linking
17+
# https://github.com/conda-forge/tk-feedstock/pull/70
18+
sed -i.bak '/^Requires\.private/d' ${PREFIX}/lib/pkgconfig/tcl.pc
19+
rm -f ${PREFIX}/lib/pkgconfig/tcl.pc.bak
20+
sed -i.bak '/^Libs\.private/d' ${PREFIX}/lib/pkgconfig/tcl.pc
21+
rm -f ${PREFIX}/lib/pkgconfig/tcl.pc.bak
22+
if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]]; then
23+
sed -i.bak '/^Requires\.private/d' ${BUILD_PREFIX}/lib/pkgconfig/tcl.pc
24+
rm -f ${BUILD_PREFIX}/lib/pkgconfig/tcl.pc.bak
25+
sed -i.bak '/^Libs\.private/d' ${BUILD_PREFIX}/lib/pkgconfig/tcl.pc
26+
rm -f ${BUILD_PREFIX}/lib/pkgconfig/tcl.pc.bak
27+
fi
28+
1429
# The LTO/PGO information was sourced from @pitrou and the Debian rules file in:
1530
# http://http.debian.net/debian/pool/main/p/python3.6/python3.6_3.6.2-2.debian.tar.xz
1631
# https://packages.debian.org/source/sid/python3.6

recipe/meta.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{% set ver2 = '.'.join(version.split('.')[0:2]) %}
55
{% set ver2nd = ''.join(version.split('.')[0:2]) %}
66
{% set ver3nd = ''.join(version.split('.')[0:3]) %}
7-
{% set build_number = 2 %}
7+
{% set build_number = 3 %}
88

99
# this makes the linter happy
1010
{% set channel_targets = channel_targets or 'conda-forge main' %}
@@ -78,6 +78,11 @@ source:
7878
- patches/0024-Do-not-define-pid_t-as-it-might-conflict-with-the-ac.patch
7979
- patches/0025-Unvendor-zstd.patch
8080

81+
# zlib-ng for all platforms
82+
- patches/0026-Adjust-windows-project-for-zlib-ng.patch
83+
- patches/0027-Use-zlib-ng-on-unix-instead-of-zlib.patch
84+
- patches/0028-Update-usage-of-zlib-to-explicitely-use-zlib-ng.patch
85+
8186
build:
8287
number: {{ build_number }}
8388

@@ -163,7 +168,7 @@ outputs:
163168
- bzip2 # [build_platform != target_platform]
164169
- libsqlite # [build_platform != target_platform]
165170
- liblzma-devel # [build_platform != target_platform]
166-
- zlib # [build_platform != target_platform]
171+
- zlib-ng # [build_platform != target_platform]
167172
- zstd # [build_platform != target_platform]
168173
- openssl # [build_platform != target_platform]
169174
- readline # [not win and build_platform != target_platform]
@@ -177,7 +182,7 @@ outputs:
177182
- bzip2
178183
- libsqlite
179184
- liblzma-devel
180-
- zlib
185+
- zlib-ng
181186
- zstd
182187
- openssl
183188
- readline # [not win]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 4f2f508e468c1c6a58d3dec71f11de03ce23df8d Mon Sep 17 00:00:00 2001
2+
From: Mark Harfouche <mark.harfouche@gmail.com>
3+
Date: Sat, 1 Nov 2025 17:00:02 -0400
4+
Subject: [PATCH 26/28] Adjust windows project for zlib-ng
5+
6+
---
7+
PCbuild/pythoncore.vcxproj | 6 +++---
8+
1 file changed, 3 insertions(+), 3 deletions(-)
9+
10+
diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj
11+
index fc1a607..82909cc 100644
12+
--- a/PCbuild/pythoncore.vcxproj
13+
+++ b/PCbuild/pythoncore.vcxproj
14+
@@ -82,7 +82,7 @@
15+
<PropertyGroup>
16+
<KillPython>true</KillPython>
17+
<RequireProfileData>true</RequireProfileData>
18+
- <IncludeExternals Condition="$(IncludeExternals) == '' and Exists('$(condaDir)\include\zlib.h')">true</IncludeExternals>
19+
+ <IncludeExternals Condition="$(IncludeExternals) == '' and Exists('$(condaDir)\include\zlib-ng.h')">true</IncludeExternals>
20+
<IncludeExternals Condition="$(IncludeExternals) == ''">false</IncludeExternals>
21+
</PropertyGroup>
22+
<ImportGroup Label="PropertySheets">
23+
@@ -103,7 +103,7 @@
24+
<AdditionalIncludeDirectories>$(PySourcePath)Modules\_hacl;$(PySourcePath)Modules\_hacl\include;$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
25+
<AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(condaDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
26+
<AdditionalIncludeDirectories Condition="'$(UseJIT)' == 'true'">$(GeneratedJitStencilsDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
27+
- <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";ZLIB_COMPAT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
28+
+ <PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
29+
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
30+
<PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
31+
<PreprocessorDefinitions Condition="'$(UseTIER2)' != '' and '$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>
32+
@@ -112,7 +112,7 @@
33+
<PreprocessorDefinitions Condition="'$(DisableRemoteDebug)' != 'true'">Py_REMOTE_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
34+
</ClCompile>
35+
<Link>
36+
- <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
37+
+ <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;zlib-ng.lib;%(AdditionalDependencies)</AdditionalDependencies>
38+
<AdditionalLibraryDirectories>$(condaDir)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
39+
</Link>
40+
</ItemDefinitionGroup>
41+
--
42+
2.51.0
43+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
From 7cfb45fa97bcdc97f556bf10d54bd0211f5fca74 Mon Sep 17 00:00:00 2001
2+
From: Mark Harfouche <mark.harfouche@gmail.com>
3+
Date: Sat, 1 Nov 2025 13:43:10 -0400
4+
Subject: [PATCH 27/28] Use zlib-ng on unix instead of zlib
5+
6+
---
7+
configure | 20 ++++++++++----------
8+
configure.ac | 2 +-
9+
2 files changed, 11 insertions(+), 11 deletions(-)
10+
11+
diff --git a/configure b/configure
12+
index 8af6bd4..868896f 100755
13+
--- a/configure
14+
+++ b/configure
15+
@@ -21713,19 +21713,19 @@ fi
16+
17+
18+
pkg_failed=no
19+
-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib >= 1.2.0" >&5
20+
-printf %s "checking for zlib >= 1.2.0... " >&6; }
21+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib-ng >= 2.2.5" >&5
22+
+printf %s "checking for zlib-ng >= 2.2.5... " >&6; }
23+
24+
if test -n "$ZLIB_CFLAGS"; then
25+
pkg_cv_ZLIB_CFLAGS="$ZLIB_CFLAGS"
26+
elif test -n "$PKG_CONFIG"; then
27+
if test -n "$PKG_CONFIG" && \
28+
- { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.0\""; } >&5
29+
- ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.0") 2>&5
30+
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib-ng >= 2.2.5\""; } >&5
31+
+ ($PKG_CONFIG --exists --print-errors "zlib-ng >= 2.2.5") 2>&5
32+
ac_status=$?
33+
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
34+
test $ac_status = 0; }; then
35+
- pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib >= 1.2.0" 2>/dev/null`
36+
+ pkg_cv_ZLIB_CFLAGS=`$PKG_CONFIG --cflags "zlib-ng >= 2.2.5" 2>/dev/null`
37+
test "x$?" != "x0" && pkg_failed=yes
38+
else
39+
pkg_failed=yes
40+
@@ -21737,12 +21737,12 @@ if test -n "$ZLIB_LIBS"; then
41+
pkg_cv_ZLIB_LIBS="$ZLIB_LIBS"
42+
elif test -n "$PKG_CONFIG"; then
43+
if test -n "$PKG_CONFIG" && \
44+
- { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib >= 1.2.0\""; } >&5
45+
- ($PKG_CONFIG --exists --print-errors "zlib >= 1.2.0") 2>&5
46+
+ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib-ng >= 2.2.5\""; } >&5
47+
+ ($PKG_CONFIG --exists --print-errors "zlib-ng >= 2.2.5") 2>&5
48+
ac_status=$?
49+
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
50+
test $ac_status = 0; }; then
51+
- pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib >= 1.2.0" 2>/dev/null`
52+
+ pkg_cv_ZLIB_LIBS=`$PKG_CONFIG --libs "zlib-ng >= 2.2.5" 2>/dev/null`
53+
test "x$?" != "x0" && pkg_failed=yes
54+
else
55+
pkg_failed=yes
56+
@@ -21763,9 +21763,9 @@ else
57+
_pkg_short_errors_supported=no
58+
fi
59+
if test $_pkg_short_errors_supported = yes; then
60+
- ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib >= 1.2.0" 2>&1`
61+
+ ZLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib-ng >= 2.2.5" 2>&1`
62+
else
63+
- ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib >= 1.2.0" 2>&1`
64+
+ ZLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib-ng >= 2.2.5" 2>&1`
65+
fi
66+
# Put the nasty error message in config.log where it belongs
67+
echo "$ZLIB_PKG_ERRORS" >&5
68+
diff --git a/configure.ac b/configure.ac
69+
index 480e59d..18140ec 100644
70+
--- a/configure.ac
71+
+++ b/configure.ac
72+
@@ -5416,7 +5416,7 @@ AH_TEMPLATE([HAVE_ZLIB_COPY], [Define if the zlib library has inflateCopy])
73+
dnl detect zlib from Emscripten emport
74+
PY_CHECK_EMSCRIPTEN_PORT([ZLIB], [-sUSE_ZLIB])
75+
76+
-PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [
77+
+PKG_CHECK_MODULES([ZLIB], [zlib-ng >= 2.2.5], [
78+
have_zlib=yes
79+
dnl zlib 1.2.0 (2003) added inflateCopy
80+
AC_DEFINE([HAVE_ZLIB_COPY], [1])
81+
--
82+
2.51.0
83+

0 commit comments

Comments
 (0)