gh-91349: Replace zlib with zlib-ng in Windows build (GH-131438)

This commit is contained in:
Steve Dower 2025-03-19 19:03:25 +00:00 committed by GitHub
parent c1a02f9101
commit 63a638c43f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 1277 additions and 38 deletions

View File

@ -330,6 +330,18 @@ the following constants:
.. versionadded:: 3.3
.. data:: ZLIBNG_VERSION
The version string of the zlib-ng library that was used for building the
module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and
:data:`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API
provided by zlib-ng.
If zlib-ng was not used to build the module, this constant will be absent.
.. versionadded:: 3.14
.. seealso::
Module :mod:`gzip`

View File

@ -1026,6 +1026,7 @@ zipinfo
to produce reproducible output.
(Contributed by Jiahao Li in :gh:`91279`.)
.. Add improved modules above alphabetically, not here at the end.
Optimizations
@ -1078,6 +1079,18 @@ uuid
(Contributed by Bénédikt Tran in :gh:`128150`.)
zlib
----
* On Windows, ``zlib-ng`` is now used as the implementation of the
:mod:`zlib` module. This should produce compatible and comparable
results with better performance, though it is worth noting that
``zlib.Z_BEST_SPEED`` (1) may result in significantly less
compression than the previous implementation (while also significantly
reducing the time taken to compress).
(Contributed by Steve Dower in :gh:`91349`.)
Deprecated
==========

View File

@ -651,7 +651,7 @@ def collect_zlib(info_add):
except ImportError:
return
attributes = ('ZLIB_VERSION', 'ZLIB_RUNTIME_VERSION')
attributes = ('ZLIB_VERSION', 'ZLIB_RUNTIME_VERSION', 'ZLIBNG_VERSION')
copy_attributes(info_add, zlib, 'zlib.%s', attributes)

View File

@ -0,0 +1,2 @@
Replaces our copy of ``zlib`` with ``zlib-ng``, for performance improvements
in :mod:`zlib`.

View File

@ -171,25 +171,25 @@
"versionInfo": "5.2.5"
},
{
"SPDXID": "SPDXRef-PACKAGE-zlib",
"SPDXID": "SPDXRef-PACKAGE-zlib-ng",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "e3f3fb32564952006eb18b091ca8464740e5eca29d328cfb0b2da22768e0b638"
"checksumValue": "00bbd88709bc416cb96160ab61d3e1c8f76e106799af7328d0fe434dc7dd5004"
}
],
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-1.3.1.tar.gz",
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-ng-2.2.4.tar.gz",
"externalRefs": [
{
"referenceCategory": "SECURITY",
"referenceLocator": "cpe:2.3:a:zlib:zlib:1.3.1:*:*:*:*:*:*:*",
"referenceLocator": "cpe:2.3:a:zlib-ng:zlib-ng:2.2.4:*:*:*:*:*:*:*",
"referenceType": "cpe23Type"
}
],
"licenseConcluded": "NOASSERTION",
"name": "zlib",
"name": "zlib-ng",
"primaryPackagePurpose": "SOURCE",
"versionInfo": "1.3.1"
"versionInfo": "2.2.4"
}
],
"spdxVersion": "SPDX-2.3"

View File

@ -2101,6 +2101,12 @@ zlib_exec(PyObject *mod)
PyUnicode_FromString(zlibVersion())) < 0) {
return -1;
}
#ifdef ZLIBNG_VERSION
if (PyModule_Add(mod, "ZLIBNG_VERSION",
PyUnicode_FromString(ZLIBNG_VERSION)) < 0) {
return -1;
}
#endif
if (PyModule_AddStringConstant(mod, "__version__", "1.0") < 0) {
return -1;
}

343
PC/zbuild.h Normal file
View File

@ -0,0 +1,343 @@
#ifndef _ZBUILD_H
#define _ZBUILD_H
#define _POSIX_SOURCE 1 /* fileno */
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE 200809L /* snprintf, posix_memalign, strdup */
#endif
#ifndef _ISOC11_SOURCE
# define _ISOC11_SOURCE 1 /* aligned_alloc */
#endif
#ifdef __OpenBSD__
# define _BSD_SOURCE 1
#endif
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
/* Determine compiler version of C Standard */
#ifdef __STDC_VERSION__
# if __STDC_VERSION__ >= 199901L
# ifndef STDC99
# define STDC99
# endif
# endif
# if __STDC_VERSION__ >= 201112L
# ifndef STDC11
# define STDC11
# endif
# endif
#endif
#ifndef Z_HAS_ATTRIBUTE
# if defined(__has_attribute)
# define Z_HAS_ATTRIBUTE(a) __has_attribute(a)
# else
# define Z_HAS_ATTRIBUTE(a) 0
# endif
#endif
#ifndef Z_FALLTHROUGH
# if Z_HAS_ATTRIBUTE(__fallthrough__) || (defined(__GNUC__) && (__GNUC__ >= 7))
# define Z_FALLTHROUGH __attribute__((__fallthrough__))
# else
# define Z_FALLTHROUGH do {} while(0) /* fallthrough */
# endif
#endif
#ifndef Z_TARGET
# if Z_HAS_ATTRIBUTE(__target__)
# define Z_TARGET(x) __attribute__((__target__(x)))
# else
# define Z_TARGET(x)
# endif
#endif
/* This has to be first include that defines any types */
#if defined(_MSC_VER)
# if defined(_WIN64)
typedef __int64 ssize_t;
# else
typedef long ssize_t;
# endif
# if defined(_WIN64)
#define SSIZE_MAX _I64_MAX
# else
#define SSIZE_MAX LONG_MAX
# endif
#endif
/* MS Visual Studio does not allow inline in C, only C++.
But it provides __inline instead, so use that. */
#if defined(_MSC_VER) && !defined(inline) && !defined(__cplusplus)
# define inline __inline
#endif
#if defined(ZLIB_COMPAT)
# define PREFIX(x) x
# define PREFIX2(x) ZLIB_ ## x
# define PREFIX3(x) z_ ## x
# define PREFIX4(x) x ## 64
# define zVersion zlibVersion
#else
# define PREFIX(x) zng_ ## x
# define PREFIX2(x) ZLIBNG_ ## x
# define PREFIX3(x) zng_ ## x
# define PREFIX4(x) zng_ ## x
# define zVersion zlibng_version
# define z_size_t size_t
#endif
/* In zlib-compat some functions and types use unsigned long, but zlib-ng use size_t */
#if defined(ZLIB_COMPAT)
# define z_uintmax_t unsigned long
#else
# define z_uintmax_t size_t
#endif
/* Minimum of a and b. */
#define MIN(a, b) ((a) > (b) ? (b) : (a))
/* Maximum of a and b. */
#define MAX(a, b) ((a) < (b) ? (b) : (a))
/* Ignore unused variable warning */
#define Z_UNUSED(var) (void)(var)
#if defined(HAVE_VISIBILITY_INTERNAL)
# define Z_INTERNAL __attribute__((visibility ("internal")))
#elif defined(HAVE_VISIBILITY_HIDDEN)
# define Z_INTERNAL __attribute__((visibility ("hidden")))
#else
# define Z_INTERNAL
#endif
/* Symbol versioning helpers, allowing multiple versions of a function to exist.
* Functions using this must also be added to zlib-ng.map for each version.
* Double @@ means this is the default for newly compiled applications to link against.
* Single @ means this is kept for backwards compatibility.
* This is only used for Zlib-ng native API, and only on platforms supporting this.
*/
#if defined(HAVE_SYMVER)
# define ZSYMVER(func,alias,ver) __asm__(".symver " func ", " alias "@ZLIB_NG_" ver);
# define ZSYMVER_DEF(func,alias,ver) __asm__(".symver " func ", " alias "@@ZLIB_NG_" ver);
#else
# define ZSYMVER(func,alias,ver)
# define ZSYMVER_DEF(func,alias,ver)
#endif
#ifndef __cplusplus
# define Z_REGISTER register
#else
# define Z_REGISTER
#endif
/* Reverse the bytes in a value. Use compiler intrinsics when
possible to take advantage of hardware implementations. */
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
# include <stdlib.h>
# pragma intrinsic(_byteswap_ulong)
# define ZSWAP16(q) _byteswap_ushort(q)
# define ZSWAP32(q) _byteswap_ulong(q)
# define ZSWAP64(q) _byteswap_uint64(q)
#elif defined(__clang__) || (defined(__GNUC__) && \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
# define ZSWAP16(q) __builtin_bswap16(q)
# define ZSWAP32(q) __builtin_bswap32(q)
# define ZSWAP64(q) __builtin_bswap64(q)
#elif defined(__GNUC__) && (__GNUC__ >= 2) && defined(__linux__)
# include <byteswap.h>
# define ZSWAP16(q) bswap_16(q)
# define ZSWAP32(q) bswap_32(q)
# define ZSWAP64(q) bswap_64(q)
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
# include <sys/endian.h>
# define ZSWAP16(q) bswap16(q)
# define ZSWAP32(q) bswap32(q)
# define ZSWAP64(q) bswap64(q)
#elif defined(__OpenBSD__)
# include <sys/endian.h>
# define ZSWAP16(q) swap16(q)
# define ZSWAP32(q) swap32(q)
# define ZSWAP64(q) swap64(q)
#elif defined(__INTEL_COMPILER)
/* ICC does not provide a two byte swap. */
# define ZSWAP16(q) ((((q) & 0xff) << 8) | (((q) & 0xff00) >> 8))
# define ZSWAP32(q) _bswap(q)
# define ZSWAP64(q) _bswap64(q)
#else
# define ZSWAP16(q) ((((q) & 0xff) << 8) | (((q) & 0xff00) >> 8))
# define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
# define ZSWAP64(q) \
(((q & 0xFF00000000000000u) >> 56u) | \
((q & 0x00FF000000000000u) >> 40u) | \
((q & 0x0000FF0000000000u) >> 24u) | \
((q & 0x000000FF00000000u) >> 8u) | \
((q & 0x00000000FF000000u) << 8u) | \
((q & 0x0000000000FF0000u) << 24u) | \
((q & 0x000000000000FF00u) << 40u) | \
((q & 0x00000000000000FFu) << 56u))
#endif
/* Only enable likely/unlikely if the compiler is known to support it */
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__INTEL_COMPILER) || defined(__clang__)
# define LIKELY_NULL(x) __builtin_expect((x) != 0, 0)
# define LIKELY(x) __builtin_expect(!!(x), 1)
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
#else
# define LIKELY_NULL(x) x
# define LIKELY(x) x
# define UNLIKELY(x) x
#endif /* (un)likely */
#if defined(HAVE_ATTRIBUTE_ALIGNED)
# define ALIGNED_(x) __attribute__ ((aligned(x)))
#elif defined(_MSC_VER)
# define ALIGNED_(x) __declspec(align(x))
#else
/* TODO: Define ALIGNED_ for your compiler */
# define ALIGNED_(x)
#endif
#ifdef HAVE_BUILTIN_ASSUME_ALIGNED
# define HINT_ALIGNED(p,n) __builtin_assume_aligned((void *)(p),(n))
#else
# define HINT_ALIGNED(p,n) (p)
#endif
#define HINT_ALIGNED_16(p) HINT_ALIGNED((p),16)
#define HINT_ALIGNED_64(p) HINT_ALIGNED((p),64)
#define HINT_ALIGNED_4096(p) HINT_ALIGNED((p),4096)
/* PADSZ returns needed bytes to pad bpos to pad size
* PAD_NN calculates pad size and adds it to bpos, returning the result.
* All take an integer or a pointer as bpos input.
*/
#define PADSZ(bpos, pad) (((pad) - ((uintptr_t)(bpos) % (pad))) % (pad))
#define PAD_16(bpos) ((bpos) + PADSZ((bpos),16))
#define PAD_64(bpos) ((bpos) + PADSZ((bpos),64))
#define PAD_4096(bpos) ((bpos) + PADSZ((bpos),4096))
/* Diagnostic functions */
#ifdef ZLIB_DEBUG
# include <stdio.h>
extern int Z_INTERNAL z_verbose;
extern void Z_INTERNAL z_error(const char *m);
# define Assert(cond, msg) {int _cond = (cond); if (!_cond) z_error(msg);}
# define Trace(x) {if (z_verbose >= 0) fprintf x;}
# define Tracev(x) {if (z_verbose > 0) fprintf x;}
# define Tracevv(x) {if (z_verbose > 1) fprintf x;}
# define Tracec(c, x) {if (z_verbose > 0 && (c)) fprintf x;}
# define Tracecv(c, x) {if (z_verbose > 1 && (c)) fprintf x;}
#else
# define Assert(cond, msg)
# define Trace(x)
# define Tracev(x)
# define Tracevv(x)
# define Tracec(c, x)
# define Tracecv(c, x)
#endif
/* OPTIMAL_CMP values determine the comparison width:
* 64: Best for 64-bit architectures with unaligned access
* 32: Best for 32-bit architectures with unaligned access
* 16: Safe default for unknown architectures
* 8: Safe fallback for architectures without unaligned access
* Note: The unaligned access mentioned is cpu-support, this allows compiler or
* separate unaligned intrinsics to utilize safe unaligned access, without
* utilizing unaligned C pointers that are known to have undefined behavior.
*/
#if !defined(OPTIMAL_CMP)
# if defined(__x86_64__) || defined(_M_X64) || defined(__amd64__) || defined(_M_AMD64)
# define OPTIMAL_CMP 64
# elif defined(__i386__) || defined(__i486__) || defined(__i586__) || \
defined(__i686__) || defined(_X86_) || defined(_M_IX86)
# define OPTIMAL_CMP 32
# elif defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
# if defined(__ARM_FEATURE_UNALIGNED) || defined(_WIN32)
# define OPTIMAL_CMP 64
# else
# define OPTIMAL_CMP 8
# endif
# elif defined(__arm__) || defined(_M_ARM)
# if defined(__ARM_FEATURE_UNALIGNED) || defined(_WIN32)
# define OPTIMAL_CMP 32
# else
# define OPTIMAL_CMP 8
# endif
# elif defined(__powerpc64__) || defined(__ppc64__)
# define OPTIMAL_CMP 64
# elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__)
# define OPTIMAL_CMP 32
# endif
#endif
#if !defined(OPTIMAL_CMP)
# define OPTIMAL_CMP 16
#endif
#if defined(__has_feature)
# if __has_feature(address_sanitizer)
# define Z_ADDRESS_SANITIZER 1
# endif
#elif defined(__SANITIZE_ADDRESS__)
# define Z_ADDRESS_SANITIZER 1
#endif
/*
* __asan_loadN() and __asan_storeN() calls are inserted by compilers in order to check memory accesses.
* They can be called manually too, with the following caveats:
* gcc says: "warning: implicit declaration of function '...'"
* g++ says: "error: new declaration '...' ambiguates built-in declaration '...'"
* Accommodate both.
*/
#ifdef Z_ADDRESS_SANITIZER
#ifndef __cplusplus
void __asan_loadN(void *, long);
void __asan_storeN(void *, long);
#endif
#else
# define __asan_loadN(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
# define __asan_storeN(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
#endif
#if defined(__has_feature)
# if __has_feature(memory_sanitizer)
# define Z_MEMORY_SANITIZER 1
# include <sanitizer/msan_interface.h>
# endif
#endif
#ifndef Z_MEMORY_SANITIZER
# define __msan_check_mem_is_initialized(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
# define __msan_unpoison(a, size) do { Z_UNUSED(a); Z_UNUSED(size); } while (0)
#endif
/* Notify sanitizer runtime about an upcoming read access. */
#define instrument_read(a, size) do { \
void *__a = (void *)(a); \
long __size = size; \
__asan_loadN(__a, __size); \
__msan_check_mem_is_initialized(__a, __size); \
} while (0)
/* Notify sanitizer runtime about an upcoming write access. */
#define instrument_write(a, size) do { \
void *__a = (void *)(a); \
long __size = size; \
__asan_storeN(__a, __size); \
} while (0)
/* Notify sanitizer runtime about an upcoming read/write access. */
#define instrument_read_write(a, size) do { \
void *__a = (void *)(a); \
long __size = size; \
__asan_storeN(__a, __size); \
__msan_check_mem_is_initialized(__a, __size); \
} while (0)
#endif

174
PC/zconf-ng.h Normal file
View File

@ -0,0 +1,174 @@
/* zconf-ng.h -- configuration of the zlib-ng compression library
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifndef ZCONFNG_H
#define ZCONFNG_H
#if !defined(_WIN32) && defined(__WIN32__)
# define _WIN32
#endif
/* Clang macro for detecting declspec support
* https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute
*/
#ifndef __has_declspec_attribute
# define __has_declspec_attribute(x) 0
#endif
/* Always define z_const as const */
#define z_const const
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# define MAX_MEM_LEVEL 9
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MIN_WBITS
# define MIN_WBITS 8 /* 256 LZ77 window */
#endif
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects.
*/
/* Type declarations */
#ifdef ZLIB_INTERNAL
# define Z_INTERNAL ZLIB_INTERNAL
#endif
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
# ifdef Z_INTERNAL
# define Z_EXTERN extern __declspec(dllexport)
# else
# define Z_EXTERN extern __declspec(dllimport)
# endif
#endif
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
#if defined(ZLIB_WINAPI) && defined(_WIN32)
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define Z_EXPORT WINAPI
# define Z_EXPORTVA WINAPIV
#endif
#ifndef Z_EXTERN
# define Z_EXTERN extern
#endif
#ifndef Z_EXPORT
# define Z_EXPORT
#endif
#ifndef Z_EXPORTVA
# define Z_EXPORTVA
#endif
/* Conditional exports */
#define ZNG_CONDEXPORT Z_EXPORT
/* Fallback for something that includes us. */
typedef unsigned char Byte;
typedef Byte Bytef;
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
typedef char charf;
typedef int intf;
typedef uInt uIntf;
typedef uLong uLongf;
typedef void const *voidpc;
typedef void *voidpf;
typedef void *voidp;
#if 0 /* was set to #if 0 by configure/cmake/etc */
# define Z_HAVE_UNISTD_H
#endif
#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */
typedef PTRDIFF_TYPE ptrdiff_t;
#endif
#include <sys/types.h> /* for off_t */
#include <stddef.h> /* for wchar_t and NULL */
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifndef z_off_t
# define z_off_t off_t
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET) && defined(WITH_GZFILEOP)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(__MSYS__)
# define z_off64_t _off64_t
# elif defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
#endif /* ZCONFNG_H */

204
PC/zconf.h Normal file
View File

@ -0,0 +1,204 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifndef ZCONF_H
#define ZCONF_H
#if !defined(_WIN32) && defined(__WIN32__)
# define _WIN32
#endif
/* Clang macro for detecting declspec support
* https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute
*/
#ifndef __has_declspec_attribute
# define __has_declspec_attribute(x) 0
#endif
#if defined(ZLIB_CONST) && !defined(z_const)
# define z_const const
#else
# define z_const
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# define MAX_MEM_LEVEL 9
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MIN_WBITS
# define MIN_WBITS 8 /* 256 LZ77 window */
#endif
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# define OF(args) args
#endif
#ifdef ZLIB_INTERNAL
# define Z_INTERNAL ZLIB_INTERNAL
#endif
/* If building or using zlib as a DLL, define ZLIB_DLL.
* This is not mandatory, but it offers a little performance increase.
*/
#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
# ifdef Z_INTERNAL
# define Z_EXTERN extern __declspec(dllexport)
# else
# define Z_EXTERN extern __declspec(dllimport)
# endif
#endif
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
* define ZLIB_WINAPI.
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
*/
#if defined(ZLIB_WINAPI) && defined(_WIN32)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
/* No need for _export, use ZLIB.DEF instead. */
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
# define Z_EXPORT WINAPI
# define Z_EXPORTVA WINAPIV
#endif
#ifndef Z_EXTERN
# define Z_EXTERN extern
#endif
#ifndef Z_EXPORT
# define Z_EXPORT
#endif
#ifndef Z_EXPORTVA
# define Z_EXPORTVA
#endif
/* Conditional exports */
#define ZNG_CONDEXPORT Z_INTERNAL
/* For backwards compatibility */
#ifndef ZEXTERN
# define ZEXTERN Z_EXTERN
#endif
#ifndef ZEXPORT
# define ZEXPORT Z_EXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA Z_EXPORTVA
#endif
#ifndef FAR
# define FAR
#endif
/* Legacy zlib typedefs for backwards compatibility. Don't assume stdint.h is defined. */
typedef unsigned char Byte;
typedef Byte Bytef;
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
typedef char charf;
typedef int intf;
typedef uInt uIntf;
typedef uLong uLongf;
typedef void const *voidpc;
typedef void *voidpf;
typedef void *voidp;
typedef unsigned int z_crc_t;
#if 0 /* was set to #if 0 by configure/cmake/etc */
# define Z_HAVE_UNISTD_H
#endif
#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */
typedef PTRDIFF_TYPE ptrdiff_t;
#endif
#include <sys/types.h> /* for off_t */
#include <stddef.h> /* for wchar_t and NULL */
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
* though the former does not conform to the LFS document), but considering
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
* equivalently requesting no 64-bit operations
*/
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
# undef _LARGEFILE64_SOURCE
#endif
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
# ifndef z_off_t
# define z_off_t off_t
# endif
#endif
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
# define Z_LARGE64
#endif
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
# define Z_WANT64
#endif
#if !defined(SEEK_SET)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
# if defined(__MSYS__)
# define z_off64_t _off64_t
# elif defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
# endif
#endif
typedef size_t z_size_t;
#endif /* ZCONF_H */

View File

@ -59,7 +59,7 @@ set libraries=%libraries% sqlite-3.45.3.0
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.15.0
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.15.0
set libraries=%libraries% xz-5.2.5
set libraries=%libraries% zlib-1.3.1
set libraries=%libraries% zlib-ng-2.2.4
for %%e in (%libraries%) do (
if exist "%EXTERNALS_DIR%\%%e" (

View File

@ -47,6 +47,8 @@
</Projects2>
</ItemDefinitionGroup>
<ItemGroup>
<!-- Static libraries for use later in the build -->
<Projects Include="zlib-ng.vcxproj" Condition="$(zlibNgDir) != '' and Exists('$(zlibNgDir)\zlib-ng.h.in')" />
<!-- pythonXY.dll -->
<!--
Parallel build is explicitly disabled for this project because it

View File

@ -161,6 +161,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testclinic_limited", "_tes
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testlimitedcapi", "_testlimitedcapi.vcxproj", "{7467D86C-1CEB-4CB9-B65E-E9A54ABDC933}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib-ng", "zlib-ng.vcxproj", "{FB91C8B2-6FBC-3A01-B644-1637111F902D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
@ -1682,6 +1684,38 @@ Global
{7467D86C-1CEB-4CB9-B65E-E9A54ABDC933}.Release|Win32.Build.0 = Release|Win32
{7467D86C-1CEB-4CB9-B65E-E9A54ABDC933}.Release|x64.ActiveCfg = Release|x64
{7467D86C-1CEB-4CB9-B65E-E9A54ABDC933}.Release|x64.Build.0 = Release|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|ARM.ActiveCfg = Debug|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|ARM.Build.0 = Debug|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|ARM64.ActiveCfg = Debug|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|ARM64.Build.0 = Debug|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|Win32.ActiveCfg = Debug|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|Win32.Build.0 = Debug|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|x64.ActiveCfg = Debug|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Debug|x64.Build.0 = Debug|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|ARM.ActiveCfg = PGInstrument|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|ARM.Build.0 = PGInstrument|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|ARM64.ActiveCfg = PGInstrument|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|ARM64.Build.0 = PGInstrument|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGInstrument|x64.Build.0 = PGInstrument|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|ARM.ActiveCfg = PGUpdate|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|ARM.Build.0 = PGUpdate|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|ARM64.ActiveCfg = PGUpdate|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|ARM64.Build.0 = PGUpdate|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.PGUpdate|x64.Build.0 = PGUpdate|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|ARM.ActiveCfg = Release|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|ARM.Build.0 = Release|ARM
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|ARM64.ActiveCfg = Release|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|ARM64.Build.0 = Release|ARM64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|Win32.ActiveCfg = Release|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|Win32.Build.0 = Release|Win32
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|x64.ActiveCfg = Release|x64
{FB91C8B2-6FBC-3A01-B644-1637111F902D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -13,6 +13,7 @@
<!-- pyconfig.h is updated by pythoncore.vcxproj, so it's always in pythoncore's IntDir -->
<GeneratedPyConfigDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\pythoncore\</GeneratedPyConfigDir>
<GeneratedFrozenModulesDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)_frozen\</GeneratedFrozenModulesDir>
<GeneratedZlibNgDir>$(Py_IntDir)\$(MajorVersionNumber)$(MinorVersionNumber)$(ArchName)_$(Configuration)\zlib-ng\</GeneratedZlibNgDir>
<TargetName Condition="'$(TargetName)' == ''">$(ProjectName)</TargetName>
<TargetName>$(TargetName)$(PyDebugExt)</TargetName>
<GenerateManifest>false</GenerateManifest>
@ -107,6 +108,7 @@
<AdditionalOptions Condition="$(MSVCHasBrokenARM64Clamping) == 'true' and $(Platform) == 'ARM64'">-d2:-pattern-opt-disable:-932189325 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Lib>
<LinkTimeCodeGeneration>false</LinkTimeCodeGeneration>
<LinkTimeCodeGeneration Condition="$(Configuration) == 'Release'">true</LinkTimeCodeGeneration>
<LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGInstrument'">true</LinkTimeCodeGeneration>
<LinkTimeCodeGeneration Condition="$(SupportPGO) and $(Configuration) == 'PGUpdate'">true</LinkTimeCodeGeneration>

View File

@ -76,6 +76,7 @@
<opensslIncludeDir Condition="$(opensslIncludeDir) == ''">$(opensslOutDir)include</opensslIncludeDir>
<nasmDir Condition="$(nasmDir) == ''">$(ExternalsDir)\nasm-2.11.06\</nasmDir>
<zlibDir Condition="$(zlibDir) == ''">$(ExternalsDir)\zlib-1.3.1\</zlibDir>
<zlibNgDir Condition="$(zlibNgDir) == ''">$(ExternalsDir)\zlib-ng-2.2.4\</zlibNgDir>
</PropertyGroup>
<PropertyGroup>

View File

@ -82,7 +82,7 @@
<PropertyGroup>
<KillPython>true</KillPython>
<RequireProfileData>true</RequireProfileData>
<IncludeExternals Condition="$(IncludeExternals) == '' and Exists('$(zlibDir)\zlib.h')">true</IncludeExternals>
<IncludeExternals Condition="$(IncludeExternals) == '' and Exists('$(zlibNgDir)\zlib-ng.h.in')">true</IncludeExternals>
<IncludeExternals Condition="$(IncludeExternals) == ''">false</IncludeExternals>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
@ -101,8 +101,8 @@
<ClCompile>
<AdditionalOptions>/Zm200 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>$(PySourcePath)Modules\_hacl;$(PySourcePath)Modules\_hacl\include;$(PySourcePath)Python;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories Condition="$(IncludeExternals)">$(zlibNgDir);$(GeneratedZlibNgDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";ZLIB_COMPAT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(UseTIER2)' != '' and '$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -111,6 +111,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies Condition="$(IncludeExternals)">zlib-ng$(PyDebugExt).lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -408,19 +409,6 @@
<ClInclude Include="..\Python\stdlib_module_names.h" />
<ClInclude Include="..\Python\thread_nt.h" />
</ItemGroup>
<ItemGroup Condition="$(IncludeExternals)">
<ClInclude Include="$(zlibDir)\crc32.h" />
<ClInclude Include="$(zlibDir)\deflate.h" />
<ClInclude Include="$(zlibDir)\inffast.h" />
<ClInclude Include="$(zlibDir)\inffixed.h" />
<ClInclude Include="$(zlibDir)\inflate.h" />
<ClInclude Include="$(zlibDir)\inftrees.h" />
<ClInclude Include="$(zlibDir)\trees.h" />
<ClInclude Include="$(zlibDir)\zconf.h" />
<ClInclude Include="$(zlibDir)\zconf.h.in" />
<ClInclude Include="$(zlibDir)\zlib.h" />
<ClInclude Include="$(zlibDir)\zutil.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Modules\_abc.c" />
<ClCompile Include="..\Modules\_bisectmodule.c" />
@ -669,19 +657,6 @@
</ItemGroup>
<ItemGroup Condition="$(IncludeExternals)">
<ClCompile Include="..\Modules\zlibmodule.c" />
<ClCompile Include="$(zlibDir)\adler32.c" />
<ClCompile Include="$(zlibDir)\compress.c" />
<ClCompile Include="$(zlibDir)\crc32.c" />
<ClCompile Include="$(zlibDir)\deflate.c">
<DisableSpecificWarnings>4244</DisableSpecificWarnings>
</ClCompile>
<ClCompile Include="$(zlibDir)\infback.c" />
<ClCompile Include="$(zlibDir)\inffast.c" />
<ClCompile Include="$(zlibDir)\inflate.c" />
<ClCompile Include="$(zlibDir)\inftrees.c" />
<ClCompile Include="$(zlibDir)\trees.c" />
<ClCompile Include="$(zlibDir)\uncompr.c" />
<ClCompile Include="$(zlibDir)\zutil.c" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\PC\dl_nt.c" />
@ -689,6 +664,12 @@
<ItemGroup>
<ResourceCompile Include="..\PC\python_nt.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="zlib-ng.vcxproj" Condition="$(IncludeExternals)">
<Project>{fb91c8b2-6fbc-3a01-b644-1637111f902d}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="regen.targets" />
@ -750,7 +731,7 @@
<Warning Text="Toolset $(PlatformToolset) is not used for official builds. Your build may have errors or incompatibilities." />
</Target>
<Target Name="_WarnAboutZlib" BeforeTargets="PrepareForBuild" Condition="!$(IncludeExternals)">
<Warning Text="Not including zlib is not a supported configuration." />
<Warning Text="Not including zlib or zlib-ng is not a supported configuration." />
</Target>
<Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">

View File

@ -252,6 +252,16 @@ _tkinter
Win32 and "tcltk64" on x64. They also copy the Tcl and Tk DLLs
into the current output directory, which should ensure that Tkinter
is able to load Tcl/Tk without having to change your PATH.
zlib-ng
Compiles zlib-ng as a static library, which is later included by
pythoncore.vcxproj. This was generated using CMake against zlib-ng
version 2.2.4, and should be minimally updated as needed to adapt
to changes in their source layout. The zbuild.h, zconf.h and
zconf-ng.h file in the PC directory were likewise generated and
vendored.
Sources for zlib-ng are imported unmodified into our source
repository at https://github.com/python/cpython-source-deps.
Getting External Sources

206
PCbuild/zlib-ng.vcxproj Normal file
View File

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|ARM">
<Configuration>PGInstrument</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|ARM64">
<Configuration>PGInstrument</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|Win32">
<Configuration>PGInstrument</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|x64">
<Configuration>PGInstrument</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|ARM">
<Configuration>PGUpdate</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|ARM64">
<Configuration>PGUpdate</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|Win32">
<Configuration>PGUpdate</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|x64">
<Configuration>PGUpdate</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FB91C8B2-6FBC-3A01-B644-1637111F902D}</ProjectGuid>
<RootNamespace>zlib-ng</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="python.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="pyproject.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) /utf-8 /w34242</AdditionalOptions>
<DisableSpecificWarnings>4206;4054;4324</DisableSpecificWarnings>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories>$(zlibNgDir);$(PySourceDir)PC;$(GeneratedZlibNgDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions);ZLIB_COMPAT;WITH_GZFILEOP;NO_FSEEKO;HAVE_BUILTIN_ASSUME_ALIGNED;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Platform) == 'Win32' or $(Platform) == 'x64'">%(PreprocessorDefinitions);X86_FEATURES;X86_HAVE_XSAVE_INTRIN;X86_SSE2;X86_SSSE3;X86_SSE42;X86_PCLMULQDQ_CRC;X86_AVX2;X86_AVX512;X86_AVX512VNNI;X86_VPCLMULQDQ_CRC</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration) == 'Debug'">%(PreprocessorDefinitions);ZLIB_DEBUG</PreprocessorDefinitions>
<EnableEnhancedInstructionSet Condition="$(Platform) == 'Win32' or $(Platform) == 'x64'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(zlibNgDir)\arch\generic\adler32_c.c" />
<ClCompile Include="$(zlibNgDir)\arch\generic\adler32_fold_c.c" />
<ClCompile Include="$(zlibNgDir)\arch\generic\chunkset_c.c" />
<ClCompile Include="$(zlibNgDir)\arch\generic\compare256_c.c" />
<ClCompile Include="$(zlibNgDir)\arch\generic\crc32_braid_c.c" />
<ClCompile Include="$(zlibNgDir)\arch\generic\crc32_fold_c.c" />
<ClCompile Include="$(zlibNgDir)\arch\generic\slide_hash_c.c" />
<ClCompile Include="$(zlibNgDir)\adler32.c" />
<ClCompile Include="$(zlibNgDir)\compress.c" />
<ClCompile Include="$(zlibNgDir)\crc32.c" />
<ClCompile Include="$(zlibNgDir)\crc32_braid_comb.c" />
<ClCompile Include="$(zlibNgDir)\deflate.c" />
<ClCompile Include="$(zlibNgDir)\deflate_fast.c" />
<ClCompile Include="$(zlibNgDir)\deflate_huff.c" />
<ClCompile Include="$(zlibNgDir)\deflate_medium.c" />
<ClCompile Include="$(zlibNgDir)\deflate_quick.c" />
<ClCompile Include="$(zlibNgDir)\deflate_rle.c" />
<ClCompile Include="$(zlibNgDir)\deflate_slow.c" />
<ClCompile Include="$(zlibNgDir)\deflate_stored.c" />
<ClCompile Include="$(zlibNgDir)\functable.c" />
<ClCompile Include="$(zlibNgDir)\infback.c" />
<ClCompile Include="$(zlibNgDir)\inflate.c" />
<ClCompile Include="$(zlibNgDir)\inftrees.c" />
<ClCompile Include="$(zlibNgDir)\insert_string.c" />
<ClCompile Include="$(zlibNgDir)\insert_string_roll.c" />
<ClCompile Include="$(zlibNgDir)\trees.c" />
<ClCompile Include="$(zlibNgDir)\uncompr.c" />
<ClCompile Include="$(zlibNgDir)\zutil.c" />
<ClCompile Include="$(zlibNgDir)\cpu_features.c" />
<ClInclude Include="$(zlibNgDir)\arch\generic\generic_functions.h" />
<ClInclude Include="$(zlibNgDir)\fallback_builtins.h" />
</ItemGroup>
<ItemGroup Condition="$(Platform) == 'Win32' or $(Platform) == 'x64'">
<ClInclude Include="$(zlibNgDir)\arch\x86\x86_functions.h" />
<ClInclude Include="$(zlibNgDir)\arch\x86\x86_features.h" />
<ClInclude Include="$(zlibNgDir)\arch\x86\adler32_avx512_p.h" />
<ClCompile Include="$(zlibNgDir)\arch\x86\x86_features.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_sse2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\compare256_sse2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\slide_hash_sse2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_ssse3.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_ssse3.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_sse42.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\crc32_pclmulqdq.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\slide_hash_avx2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_avx2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\compare256_avx2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_avx2.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_avx512.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_avx512.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_avx512_vnni.c" />
<ClCompile Include="$(zlibNgDir)\arch\x86\crc32_vpclmulqdq.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\PC\zconf.h" />
<ClInclude Include="..\PC\zlib.h" />
<ClInclude Include="$(zlibNgDir)\arch\generic\chunk_permute_table.h" />
<ClInclude Include="$(zlibNgDir)\arch\generic\compare256_p.h" />
<ClInclude Include="$(zlibNgDir)\adler32_p.h" />
<ClInclude Include="$(zlibNgDir)\chunkset_tpl.h" />
<ClInclude Include="$(zlibNgDir)\compare256_rle.h" />
<ClInclude Include="$(zlibNgDir)\arch_functions.h" />
<ClInclude Include="$(zlibNgDir)\crc32_braid_p.h" />
<ClInclude Include="$(zlibNgDir)\crc32_braid_comb_p.h" />
<ClInclude Include="$(zlibNgDir)\crc32_braid_tbl.h" />
<ClInclude Include="$(zlibNgDir)\deflate.h" />
<ClInclude Include="$(zlibNgDir)\deflate_p.h" />
<ClInclude Include="$(zlibNgDir)\functable.h" />
<ClInclude Include="$(zlibNgDir)\inffast_tpl.h" />
<ClInclude Include="$(zlibNgDir)\inffixed_tbl.h" />
<ClInclude Include="$(zlibNgDir)\inflate.h" />
<ClInclude Include="$(zlibNgDir)\inflate_p.h" />
<ClInclude Include="$(zlibNgDir)\inftrees.h" />
<ClInclude Include="$(zlibNgDir)\insert_string_tpl.h" />
<ClInclude Include="$(zlibNgDir)\match_tpl.h" />
<ClInclude Include="$(zlibNgDir)\trees.h" />
<ClInclude Include="$(zlibNgDir)\trees_emit.h" />
<ClInclude Include="$(zlibNgDir)\trees_tbl.h" />
<ClInclude Include="$(zlibNgDir)\zbuild.h" />
<ClInclude Include="$(zlibNgDir)\zendian.h" />
<ClInclude Include="$(zlibNgDir)\zutil.h" />
<ClInclude Include="$(zlibNgDir)\cpu_features.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<Target Name="_EnsureZlibH" Inputs="$(zlibNgDir)\zlib.h.in" Outputs="$(IntDir)zlib.h">
<PropertyGroup>
<Text>$([System.IO.File]::ReadAllText('$(zlibNgDir)\zlib.h.in').Replace('@ZLIB_SYMBOL_PREFIX@', ''))</Text>
</PropertyGroup>
<WriteLinesToFile File="$(IntDir)zlib.h" Lines="$(Text)" />
</Target>
<Target Name="_EnsureZlibNgH" Inputs="$(zlibNgDir)\zlib-ng.h.in" Outputs="$(IntDir)zlib-ng.h">
<PropertyGroup>
<Text>$([System.IO.File]::ReadAllText('$(zlibNgDir)\zlib-ng.h.in').Replace('@ZLIB_SYMBOL_PREFIX@', ''))</Text>
</PropertyGroup>
<WriteLinesToFile File="$(IntDir)zlib-ng.h" Lines="$(Text)" />
</Target>
<Target Name="_EnsureZlibNgHeaders" BeforeTargets="PrepareForBuild"
DependsOnTargets="_EnsureZlibH;_EnsureZlibNgH" />
</Project>

View File

@ -0,0 +1,249 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="$(zlibNgDir)\adler32.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_avx2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_avx512.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_avx512_vnni.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\adler32_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\adler32_fold_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_sse42.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\adler32_ssse3.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_avx2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_avx512.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\chunkset_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_sse2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\chunkset_ssse3.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\compare256_avx2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\compare256_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\compare256_sse2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\compress.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\cpu_features.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\crc32.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\crc32_braid_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\crc32_braid_comb.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\crc32_fold_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\crc32_pclmulqdq.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\crc32_vpclmulqdq.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_fast.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_huff.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_medium.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_quick.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_rle.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_slow.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\deflate_stored.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\functable.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\infback.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\inflate.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\inftrees.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\insert_string.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\insert_string_roll.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\slide_hash_avx2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\generic\slide_hash_c.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\slide_hash_sse2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\trees.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\uncompr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\arch\x86\x86_features.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="$(zlibNgDir)\zutil.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(zlibNgDir)\arch\x86\adler32_avx512_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\adler32_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\arch_functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\arch\generic\chunk_permute_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\chunkset_tpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\arch\generic\compare256_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\compare256_rle.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\cpu_features.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\crc32_braid_comb_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\crc32_braid_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\crc32_braid_tbl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\deflate.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\deflate_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\fallback_builtins.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\functable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\arch\generic\generic_functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\inffast_tpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\inffixed_tbl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\inflate.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\inflate_p.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\inftrees.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\insert_string_tpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\match_tpl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\trees.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\trees_emit.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\trees_tbl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\arch\x86\x86_features.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\arch\x86\x86_functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\zbuild.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PC\zconf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\zendian.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PC\zlib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(zlibNgDir)\zutil.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{967252c0-03f1-4991-897f-db8f4cd7dc44}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{4c0539fb-5187-41a1-abe5-bf7cd416d7bd}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>