Skip to content

Commit 3e0849b

Browse files
committed
winbuild: Replace zlib with zlib-ng built with CMake
1 parent 822ec3d commit 3e0849b

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

winbuild/build_prepare.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,10 @@ def cmd_msbuild(
120120
"OPENJPEG": "2.5.2",
121121
"TIFF": "4.6.0",
122122
"XZ": "5.6.3",
123-
"ZLIB": "1.3.1",
123+
"ZLIBNG": "2.2.2",
124124
}
125125
V["LIBPNG_DOTLESS"] = V["LIBPNG"].replace(".", "")
126126
V["LIBPNG_XY"] = "".join(V["LIBPNG"].split(".")[:2])
127-
V["ZLIB_DOTLESS"] = V["ZLIB"].replace(".", "")
128127

129128

130129
# dependencies, listed in order of compilation
@@ -161,18 +160,22 @@ def cmd_msbuild(
161160
"bins": ["cjpeg.exe", "djpeg.exe"],
162161
},
163162
"zlib": {
164-
"url": f"https://zlib.net/zlib{V['ZLIB_DOTLESS']}.zip",
165-
"filename": f"zlib{V['ZLIB_DOTLESS']}.zip",
166-
"dir": f"zlib-{V['ZLIB']}",
167-
"license": "README",
168-
"license_pattern": "Copyright notice:\n\n(.+)$",
163+
"url": f"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/{V['ZLIBNG']}.zip",
164+
"filename": f"zlib-ng-{V['ZLIBNG']}.zip",
165+
"dir": f"zlib-ng-{V['ZLIBNG']}",
166+
"license": "LICENSE.md",
167+
"patch": {
168+
r"CMakeLists.txt": {
169+
"set_target_properties(zlib PROPERTIES OUTPUT_NAME zlibstatic${{SUFFIX}})": "set_target_properties(zlib PROPERTIES OUTPUT_NAME zlib)", # noqa: E501
170+
},
171+
},
169172
"build": [
170-
cmd_nmake(r"win32\Makefile.msc", "clean"),
171-
cmd_nmake(r"win32\Makefile.msc", "zlib.lib"),
172-
cmd_copy("zlib.lib", "z.lib"),
173+
*cmds_cmake(
174+
"zlib", "-DBUILD_SHARED_LIBS:BOOL=OFF", "-DZLIB_COMPAT:BOOL=ON"
175+
),
173176
],
174177
"headers": [r"z*.h"],
175-
"libs": [r"*.lib"],
178+
"libs": [r"zlib.lib"],
176179
},
177180
"xz": {
178181
"url": f"https://github.com/tukaani-project/xz/releases/download/v{V['XZ']}/xz-{V['XZ']}.tar.gz",

0 commit comments

Comments
 (0)