Compare commits

...

No commits in common. "c8" and "c10s" have entirely different histories.
c8 ... c10s

12 changed files with 240 additions and 572 deletions

9
.gitignore vendored
View File

@ -1 +1,8 @@
SOURCES/zlib-1.2.8.tar.gz
zlib-1.2.3.tar.gz
/zlib-1.2.5.tar.gz
/zlib-1.2.7.tar.gz
/zlib-1.2.8.tar.gz
/zlib-1.2.11.tar.xz
/zlib-1.2.12.tar.xz
/zlib-1.2.13.tar.xz
/zlib-1.3.1.tar.xz

View File

@ -1 +0,0 @@
a4d316c404ff54ca545ea71a27af7dbc29817088 SOURCES/zlib-1.2.8.tar.gz

View File

@ -1,123 +0,0 @@
diff -urN zlib-1.2.3.orig/Makefile.am zlib-1.2.3.kasal/Makefile.am
--- zlib-1.2.3.orig/Makefile.am 1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.3.kasal/Makefile.am 2009-03-17 17:58:36.000000000 +0100
@@ -0,0 +1,70 @@
+ACLOCAL_AMFLAGS = -I m4 --install
+
+lib_LTLIBRARIES = libz.la
+
+libz_la_SOURCES = \
+ adler32.c \
+ compress.c \
+ crc32.c \
+ crc32.h \
+ gzclose.c \
+ gzlib.c \
+ gzread.c \
+ gzwrite.c \
+ uncompr.c \
+ deflate.c \
+ deflate.h \
+ trees.c \
+ trees.h \
+ zutil.c \
+ zutil.h \
+ inflate.c \
+ inflate.h \
+ infback.c \
+ inftrees.c \
+ inftrees.h \
+ inffast.c \
+ inffast.h \
+ infflate.h
+
+# Use -version-number to match the file name used before autoconfiscation.
+libz_la_LDFLAGS = -version-number 1:2:5 -no-undefined
+
+include_HEADERS = zlib.h
+nodist_include_HEADERS = zconf.h
+
+dist_man_MANS = zlib.3
+
+## libminizip:
+
+lib_LTLIBRARIES += libminizip.la
+
+libminizip_la_SOURCES = \
+ contrib/minizip/ioapi.c \
+ contrib/minizip/mztools.c \
+ contrib/minizip/unzip.c \
+ contrib/minizip/zip.c
+
+# do not build the static version of libminizip
+libminizip_la_CFLAGS = -shared
+libminizip_la_LDFLAGS = -version-info 1:0:0 -no-undefined
+libminizip_la_LIBADD = libz.la
+
+minizip_includedir = $(includedir)/minizip
+minizip_include_HEADERS = \
+ contrib/minizip/crypt.h \
+ contrib/minizip/ioapi.h \
+ contrib/minizip/mztools.h \
+ contrib/minizip/unzip.h \
+ contrib/minizip/zip.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = minizip.pc
+
+EXTRA_PROGRAMS = miniunzip minizip
+
+miniunzip_SOURCES = contrib/minizip/miniunz.c
+miniunzip_LDADD = libminizip.la
+
+minizip_SOURCES = contrib/minizip/minizip.c
+minizip_LDADD = libminizip.la
diff -urN zlib-1.2.3.orig/configure.ac zlib-1.2.3.kasal/configure.ac
--- zlib-1.2.3.orig/configure.ac 1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.3.kasal/configure.ac 2009-03-17 17:28:41.000000000 +0100
@@ -0,0 +1,13 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT([zlib], [1.2.5], [bugzilla.redhat.com])
+AC_CONFIG_SRCDIR([gzlib.c])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([foreign])
+LT_INIT
+
+AC_SUBST([HAVE_UNISTD_H], [0])
+AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], [])
+AC_CONFIG_FILES([Makefile minizip.pc zlib.pc zconf.h:zconf.h.in])
+AC_OUTPUT
diff -urN zlib-1.2.3.orig/minizip.pc.in zlib-1.2.3.kasal/minizip.pc.in
--- zlib-1.2.3.orig/minizip.pc.in 1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.3.kasal/minizip.pc.in 2009-01-07 15:49:34.000000000 +0100
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/minizip
+
+Name: minizip
+Description: Minizip zip file manipulation library
+Requires:
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lminizip -lz
+Cflags: -I${includedir}
--- zlib-1.2.3.orig/zlib.pc.in.orig 2011-08-12 13:00:47.043690473 +0200
+++ zlib-1.2.3/zlib.pc.in 2011-08-12 13:01:00.874943334 +0200
@@ -1,7 +1,6 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-sharedlibdir=@sharedlibdir@
includedir=@includedir@
Name: zlib
@@ -9,5 +8,5 @@
Version: @VERSION@
Requires:
-Libs: -L${libdir} -L${sharedlibdir} -lz
+Libs: -L${libdir} -lz
Cflags: -I${includedir}

View File

@ -1,7 +0,0 @@
--- zlib-1.2.5/win32/zlib.def.orig 2012-02-26 16:19:28.608868501 +0100
+++ zlib-1.2.5/win32/zlib.def 2012-02-26 16:19:34.156864592 +0100
@@ -1,3 +1,4 @@
+LIBRARY zlib1.dll
; zlib data compression library
EXPORTS
; basic functions

View File

@ -1,346 +0,0 @@
From 5c44459c3b28a9bd3283aaceab7c615f8020c531 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Tue, 17 Apr 2018 22:09:22 -0700
Subject: [PATCH] Fix a bug that can crash deflate on some input when using
Z_FIXED.
This bug was reported by Danilo Ramos of Eideticom, Inc. It has
lain in wait 13 years before being found! The bug was introduced
in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
option forces the use of fixed Huffman codes. For rare inputs with
a large number of distant matches, the pending buffer into which
the compressed data is written can overwrite the distance symbol
table which it overlays. That results in corrupted output due to
invalid distances, and can result in out-of-bound accesses,
crashing the application.
The fix here combines the distance buffer and literal/length
buffers into a single symbol buffer. Now three bytes of pending
buffer space are opened up for each literal or length/distance
pair consumed, instead of the previous two bytes. This assures
that the pending buffer cannot overwrite the symbol table, since
the maximum fixed code compressed length/distance is 31 bits, and
since there are four bytes of pending space for every three bytes
of symbol space.
---
deflate.c | 74 ++++++++++++++++++++++++++++++++++++++++---------------
deflate.h | 25 +++++++++----------
trees.c | 50 +++++++++++--------------------------
3 files changed, 79 insertions(+), 70 deletions(-)
diff --git a/deflate.c b/deflate.c
index 425babc..19cba87 100644
--- a/deflate.c
+++ b/deflate.c
@@ -225,11 +225,6 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
int wrap = 1;
static const char my_version[] = ZLIB_VERSION;
- ushf *overlay;
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
- * output size for (length,distance) codes is <= 24 bits.
- */
-
if (version == Z_NULL || version[0] != my_version[0] ||
stream_size != sizeof(z_stream)) {
return Z_VERSION_ERROR;
@@ -298,9 +293,47 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
- s->pending_buf = (uchf *) overlay;
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
+ /* We overlay pending_buf and sym_buf. This works since the average size
+ * for length/distance pairs over any compressed block is assured to be 31
+ * bits or less.
+ *
+ * Analysis: The longest fixed codes are a length code of 8 bits plus 5
+ * extra bits, for lengths 131 to 257. The longest fixed distance codes are
+ * 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
+ * possible fixed-codes length/distance pair is then 31 bits total.
+ *
+ * sym_buf starts one-fourth of the way into pending_buf. So there are
+ * three bytes in sym_buf for every four bytes in pending_buf. Each symbol
+ * in sym_buf is three bytes -- two for the distance and one for the
+ * literal/length. As each symbol is consumed, the pointer to the next
+ * sym_buf value to read moves forward three bytes. From that symbol, up to
+ * 31 bits are written to pending_buf. The closest the written pending_buf
+ * bits gets to the next sym_buf symbol to read is just before the last
+ * code is written. At that time, 31*(n-2) bits have been written, just
+ * after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
+ * 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
+ * symbols are written.) The closest the writing gets to what is unread is
+ * then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
+ * can range from 128 to 32768.
+ *
+ * Therefore, at a minimum, there are 142 bits of space between what is
+ * written and what is read in the overlain buffers, so the symbols cannot
+ * be overwritten by the compressed data. That space is actually 139 bits,
+ * due to the three-bit fixed-code block header.
+ *
+ * That covers the case where either Z_FIXED is specified, forcing fixed
+ * codes, or when the use of fixed codes is chosen, because that choice
+ * results in a smaller compressed block than dynamic codes. That latter
+ * condition then assures that the above analysis also covers all dynamic
+ * blocks. A dynamic-code block will only be chosen to be emitted if it has
+ * fewer bits than a fixed-code block would for the same set of symbols.
+ * Therefore its average symbol length is assured to be less than 31. So
+ * the compressed data for a dynamic block also cannot overwrite the
+ * symbols from which it is being constructed.
+ */
+
+ s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
+ s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
s->pending_buf == Z_NULL) {
@@ -309,8 +342,12 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
deflateEnd (strm);
return Z_MEM_ERROR;
}
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
+ s->sym_buf = s->pending_buf + s->lit_bufsize;
+ s->sym_end = (s->lit_bufsize - 1) * 3;
+ /* We avoid equality with lit_bufsize*3 because of wraparound at 64K
+ * on 16 bit machines and because stored blocks are restricted to
+ * 64K-1 bytes.
+ */
s->level = level;
s->strategy = strategy;
@@ -471,7 +508,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
s = strm->state;
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
+ if (s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
do {
put = Buf_size - s->bi_valid;
@@ -1020,7 +1057,6 @@ int ZEXPORT deflateCopy (dest, source)
#else
deflate_state *ds;
deflate_state *ss;
- ushf *overlay;
if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
@@ -1040,8 +1076,7 @@ int ZEXPORT deflateCopy (dest, source)
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
- ds->pending_buf = (uchf *) overlay;
+ ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
ds->pending_buf == Z_NULL) {
@@ -1055,8 +1090,7 @@ int ZEXPORT deflateCopy (dest, source)
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
+ ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;
@@ -1716,7 +1750,7 @@ local block_state deflate_fast(s, flush)
FLUSH_BLOCK(s, 1);
return finish_done;
}
- if (s->last_lit)
+ if (s->sym_next)
FLUSH_BLOCK(s, 0);
return block_done;
}
@@ -1847,7 +1881,7 @@ local block_state deflate_slow(s, flush)
FLUSH_BLOCK(s, 1);
return finish_done;
}
- if (s->last_lit)
+ if (s->sym_next)
FLUSH_BLOCK(s, 0);
return block_done;
}
@@ -1922,7 +1956,7 @@ local block_state deflate_rle(s, flush)
FLUSH_BLOCK(s, 1);
return finish_done;
}
- if (s->last_lit)
+ if (s->sym_next)
FLUSH_BLOCK(s, 0);
return block_done;
}
@@ -1961,7 +1995,7 @@ local block_state deflate_huff(s, flush)
FLUSH_BLOCK(s, 1);
return finish_done;
}
- if (s->last_lit)
+ if (s->sym_next)
FLUSH_BLOCK(s, 0);
return block_done;
}
diff --git a/deflate.h b/deflate.h
index 23ecdd3..d4cf1a9 100644
--- a/deflate.h
+++ b/deflate.h
@@ -214,7 +214,7 @@ typedef struct internal_state {
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/
- uchf *l_buf; /* buffer for literals or lengths */
+ uchf *sym_buf; /* buffer for distances and literals/lengths */
uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
@@ -236,13 +236,8 @@ typedef struct internal_state {
* - I can't count above 4
*/
- uInt last_lit; /* running index in l_buf */
-
- ushf *d_buf;
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
- * the same number of elements. To use different lengths, an extra flag
- * array would be necessary.
- */
+ uInt sym_next; /* running index in sym_buf */
+ uInt sym_end; /* symbol table full when sym_next reaches this */
ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */
@@ -322,20 +322,22 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
- s->d_buf[s->last_lit] = 0; \
- s->l_buf[s->last_lit++] = cc; \
+ s->sym_buf[s->sym_next++] = 0; \
+ s->sym_buf[s->sym_next++] = 0; \
+ s->sym_buf[s->sym_next++] = cc; \
s->dyn_ltree[cc].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
+ flush = (s->sym_next == s->sym_end); \
}
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (length); \
ush dist = (distance); \
- s->d_buf[s->last_lit] = dist; \
- s->l_buf[s->last_lit++] = len; \
+ s->sym_buf[s->sym_next++] = dist; \
+ s->sym_buf[s->sym_next++] = dist >> 8; \
+ s->sym_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
+ flush = (s->sym_next == s->sym_end); \
}
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
diff --git a/trees.c b/trees.c
index 4f4a650..decaeb7 100644
--- a/trees.c
+++ b/trees.c
@@ -418,7 +418,7 @@ local void init_block(s)
s->dyn_ltree[END_BLOCK].Freq = 1;
s->opt_len = s->static_len = 0L;
- s->last_lit = s->matches = 0;
+ s->sym_next = s->matches = 0;
}
#define SMALLEST 1
@@ -943,7 +943,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
- s->last_lit));
+ s->sym_next / 3));
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
@@ -1012,8 +1012,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
unsigned dist; /* distance of matched string */
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
{
- s->d_buf[s->last_lit] = (ush)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
+ s->sym_buf[s->sym_next++] = dist;
+ s->sym_buf[s->sym_next++] = dist >> 8;
+ s->sym_buf[s->sym_next++] = lc;
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
@@ -1028,30 +1029,7 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
s->dyn_dtree[d_code(dist)].Freq++;
}
-
-#ifdef TRUNCATE_BLOCK
- /* Try to guess if it is profitable to stop the current block here */
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
- /* Compute an upper bound for the compressed length */
- ulg out_length = (ulg)s->last_lit*8L;
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
- int dcode;
- for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
- (5L+extra_dbits[dcode]);
- }
- out_length >>= 3;
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
- s->last_lit, in_length, out_length,
- 100L - out_length*100L/in_length));
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
- }
-#endif
- return (s->last_lit == s->lit_bufsize-1);
- /* We avoid equality with lit_bufsize because of wraparound at 64K
- * on 16 bit machines and because stored blocks are restricted to
- * 64K-1 bytes.
- */
+ return (s->sym_next == s->sym_end);
}
/* ===========================================================================
@@ -1064,13 +1042,14 @@ local void compress_block(s, ltree, dtree)
{
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
- unsigned lx = 0; /* running index in l_buf */
+ unsigned sx = 0; /* running index in sym_buf */
unsigned code; /* the code to send */
int extra; /* number of extra bits to send */
- if (s->last_lit != 0) do {
- dist = s->d_buf[lx];
- lc = s->l_buf[lx++];
+ if (s->sym_next != 0) do {
+ dist = s->sym_buf[sx++] & 0xff;
+ dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
+ lc = s->sym_buf[sx++];
if (dist == 0) {
send_code(s, lc, ltree); /* send a literal byte */
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
@@ -1095,11 +1074,10 @@ local void compress_block(s, ltree, dtree)
}
} /* literal or match pair ? */
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
- "pendingBuf overflow");
+ /* Check that the overlay between pending_buf and sym_buf is ok: */
+ Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
- } while (lx < s->last_lit);
+ } while (sx < s->sym_next);
send_code(s, END_BLOCK, ltree);
}
--
2.34.1

5
gating.yaml Normal file
View File

@ -0,0 +1,5 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules: []

21
mingw-zlib-cmake.patch Normal file
View File

@ -0,0 +1,21 @@
diff -rupN --no-dereference zlib-1.3.1/CMakeLists.txt zlib-1.3.1-new/CMakeLists.txt
--- zlib-1.3.1/CMakeLists.txt 2024-01-22 19:32:37.000000000 +0100
+++ zlib-1.3.1-new/CMakeLists.txt 2024-01-31 17:58:11.511530357 +0100
@@ -167,12 +167,16 @@ if(NOT CYGWIN)
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
endif()
-if(UNIX)
+if(UNIX OR MINGW)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
+ if(MINGW)
+ set_target_properties(zlib PROPERTIES PREFIX "")
+ set_target_properties(zlib PROPERTIES RUNTIME_OUTPUT_NAME "zlib1")
+ endif()
elseif(BUILD_SHARED_LIBS AND WIN32)
# Creates zlib1.dll when building shared library version
set_target_properties(zlib PROPERTIES SUFFIX "1.dll")

View File

@ -1,41 +1,30 @@
%?mingw_package_header
%global mingw_build_ucrt64 1
%{?mingw_package_header}
Name: mingw-zlib
Version: 1.2.8
Release: 10%{?dist}
Version: 1.3.1
Release: 5%{?dist}
Summary: MinGW Windows zlib compression library
License: zlib
Group: Development/Libraries
URL: http://www.zlib.net/
Source0: http://www.zlib.net/zlib-%{version}.tar.gz
# Replace the zlib build system with an autotools based one
Patch3: mingw32-zlib-1.2.7-autotools.patch
# The .def file contains an empty LIBRARY line which isn't valid
Patch5: zlib-1.2.7-use-correct-def-file.patch
# Libtool tries to make a libz-1.dll while we expect zlib1.dll
# Force this by hacking the ltmain.sh
Patch6: mingw32-zlib-create-zlib1-dll.patch
# Backported from zlib-1.2.11-CVE-2018-25032.patch
# https://github.com/madler/zlib/commit/5c44459c3b28a9bd3283aaceab7c615f8020c531
Patch7: zlib-1.2.8-CVE-2018-25032.patch
License: Zlib
URL: https://www.zlib.net/
Source0: https://www.zlib.net/zlib-%{version}.tar.xz
# Use UNIX naming convention for libraries
Patch0: mingw-zlib-cmake.patch
BuildArch: noarch
ExclusiveArch: %{ix86} x86_64
BuildRequires: cmake
BuildRequires: make
BuildRequires: mingw32-filesystem >= 95
BuildRequires: mingw32-gcc
BuildRequires: mingw32-binutils
BuildRequires: mingw64-filesystem >= 95
BuildRequires: mingw64-gcc
BuildRequires: mingw64-binutils
BuildRequires: perl-interpreter
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: ucrt64-filesystem >= 95
BuildRequires: ucrt64-gcc
%description
@ -52,21 +41,12 @@ MinGW Windows zlib compression library for the win32 target.
%package -n mingw32-zlib-static
Summary: Static libraries for mingw32-zlib development.
Group: Development/Libraries
Requires: mingw32-zlib = %{version}-%{release}
%description -n mingw32-zlib-static
The mingw32-zlib-static package contains static library for mingw32-zlib development.
%package -n mingw32-minizip
Summary: Minizip manipulates files from a .zip archive
Group: Development/Libraries
Requires: mingw32-zlib = %{version}-%{release}
%description -n mingw32-minizip
MinGW Minizip manipulates files from a .zip archive.
# Win64
%package -n mingw64-zlib
Summary: MinGW Windows zlib compression library for the win64 target
@ -81,61 +61,45 @@ Requires: mingw64-zlib = %{version}-%{release}
%description -n mingw64-zlib-static
The mingw64-zlib-static package contains static library for mingw64-zlib development.
%package -n mingw64-minizip
Summary: Minizip manipulates files from a .zip archive
Requires: mingw64-zlib = %{version}-%{release}
%description -n mingw64-minizip
MinGW Minizip manipulates files from a .zip archive.
# UCRT64
%package -n ucrt64-zlib
Summary: MinGW Windows zlib compression library for the ucrt64 target
%description -n ucrt64-zlib
MinGW Windows zlib compression library for the ucrt64 target.
%package -n ucrt64-zlib-static
Summary: Static libraries for ucrt64-zlib development
Requires: ucrt64-zlib = %{version}-%{release}
%description -n ucrt64-zlib-static
The ucrt64-zlib-static package contains static library for ucrt64-zlib development.
%?mingw_debug_package
%{?mingw_debug_package}
%prep
%setup -q -n zlib-%{version}
%patch3 -p1 -b .atools
%patch5 -p1 -b .def
# patch cannot create an empty dir
mkdir m4
iconv -f windows-1252 -t utf-8 <ChangeLog >ChangeLog.tmp
autoreconf --install --force
%patch6 -p0 -b .libtool
%patch7 -p1 -b .CVE-2018-25032
%autosetup -p1 -n zlib-%{version}
%build
%mingw_configure
%mingw_make %{?_smp_mflags}
MINGW32_CMAKE_ARGS=-DINSTALL_PKGCONFIG_DIR=%{mingw32_libdir}/pkgconfig \
MINGW64_CMAKE_ARGS=-DINSTALL_PKGCONFIG_DIR=%{mingw64_libdir}/pkgconfig \
UCRT64_CMAKE_ARGS=-DINSTALL_PKGCONFIG_DIR=%{ucrt64_libdir}/pkgconfig \
%mingw_cmake
%mingw_make_build
%mingw_make_build
%install
# Libtool tries to install a file called libz-1.dll
# but this isn't created anymore due to patch #6
# Fool libtool until a proper fix has been found
touch build_win32/.libs/libz-1.dll build_win64/.libs/libz-1.dll
%mingw_make_install DESTDIR=$RPM_BUILD_ROOT
# Manually install the correct zlib.dll
install -m 0644 build_win32/.libs/zlib1.dll $RPM_BUILD_ROOT%{mingw32_bindir}/
install -m 0644 build_win64/.libs/zlib1.dll $RPM_BUILD_ROOT%{mingw64_bindir}/
# Install the pkgconfig file
install -m 0644 build_win32/zlib.pc $RPM_BUILD_ROOT%{mingw32_libdir}/pkgconfig/
install -m 0644 build_win64/zlib.pc $RPM_BUILD_ROOT%{mingw64_libdir}/pkgconfig/
# Drop the fake libz-1.dll
rm -f $RPM_BUILD_ROOT%{mingw32_bindir}/libz-1.dll
rm -f $RPM_BUILD_ROOT%{mingw64_bindir}/libz-1.dll
# Drop all .la files
find $RPM_BUILD_ROOT -name "*.la" -delete
%mingw_make_install
# Drop the man pages
rm -rf $RPM_BUILD_ROOT%{mingw32_mandir}
rm -rf $RPM_BUILD_ROOT%{mingw64_mandir}
rm -rf %{buildroot}%{mingw32_mandir}
rm -rf %{buildroot}%{mingw64_mandir}
rm -rf %{buildroot}%{ucrt64_mandir}
# Win32
@ -149,13 +113,6 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_mandir}
%files -n mingw32-zlib-static
%{mingw32_libdir}/libz.a
%files -n mingw32-minizip
%{mingw32_libdir}/libminizip.dll.a
%{mingw32_bindir}/libminizip-1.dll
%dir %{mingw32_includedir}/minizip
%{mingw32_includedir}/minizip/*.h
%{mingw32_libdir}/pkgconfig/minizip.pc
# Win64
%files -n mingw64-zlib
%{mingw64_includedir}/zconf.h
@ -167,22 +124,92 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_mandir}
%files -n mingw64-zlib-static
%{mingw64_libdir}/libz.a
%files -n mingw64-minizip
%{mingw64_libdir}/libminizip.dll.a
%{mingw64_bindir}/libminizip-1.dll
%dir %{mingw64_includedir}/minizip
%{mingw64_includedir}/minizip/*.h
%{mingw64_libdir}/pkgconfig/minizip.pc
# UCRT64
%files -n ucrt64-zlib
%{ucrt64_includedir}/zconf.h
%{ucrt64_includedir}/zlib.h
%{ucrt64_libdir}/libz.dll.a
%{ucrt64_bindir}/zlib1.dll
%{ucrt64_libdir}/pkgconfig/zlib.pc
%files -n ucrt64-zlib-static
%{ucrt64_libdir}/libz.a
%changelog
* Mon May 09 2022 Uri Lublin <uril@redhat.com> - 1.2.8-10
- Fix CVE-2018-25032
Resolves: rhbz#2068370
* Tue Jan 14 2025 Miroslav Rezanina <mrezanin@redhat.com> - 1.3.1-5
- Synchronize with Fedora Rawhide
Resolves: RHEL-73826
* Tue Aug 14 2018 Victor Toso <victortoso@redhat.com> - 1.2.8-9
- ExclusiveArch: i686, x86_64
- Related: rhbz#1615874
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.3.1-4
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Fri Jun 28 2024 Konstantin Kostiuk <kkostiuk@redhat.com> - 1.3.1-3
- Bump release
- RHEL-45476 - Update gating.yaml for RHEL10
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.3.1-2
- Bump release for June 2024 mass rebuild
* Wed Jan 31 2024 Sandro Mani <manisandro@gmail.com> - 1.3.1-1
- Update to 1.3.1
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.13-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.13-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Dec 13 2022 Sandro Mani <manisandro@gmail.com> - 1.2.13-1
- Update to 1.2.13
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Thu Jun 30 2022 Sandro Mani <manisandro@gmail.com> - 1.2.12-1
- Update to 1.2.12
* Fri Mar 25 2022 Sandro Mani <manisandro@gmail.com> - 1.2.11-8
- Rebuild with mingw-gcc-12
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Nov 12 2020 Sandro Mani <manisandro@gmail.com> - 1.2.11-4
- Drop minizip subpackages, it's a separate package now
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Aug 13 2019 Marc-André Lureau <marcandre.lureau@redhat.com> - 1.2.11-1
- Update to 1.2.11
* Tue Aug 06 2019 Thomas Sailer <t.sailer@alumni.ethz.ch> - 1.2.8-12
- update pkgconf file version to 1.2.8
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

View File

@ -0,0 +1,76 @@
diff -rupN --no-dereference zlib-1.2.11/configure.ac zlib-1.2.11-new/configure.ac
--- zlib-1.2.11/configure.ac 1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.11-new/configure.ac 2020-11-12 22:09:58.320508742 +0100
@@ -0,0 +1,13 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT([zlib], [1.2.11], [bugzilla.redhat.com])
+AC_CONFIG_SRCDIR([gzlib.c])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+LT_INIT
+
+AC_SUBST([HAVE_UNISTD_H], [0])
+AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], [])
+AC_CONFIG_FILES([Makefile zlib.pc zconf.h:zconf.h.in])
+AC_OUTPUT
diff -rupN --no-dereference zlib-1.2.11/Makefile.am zlib-1.2.11-new/Makefile.am
--- zlib-1.2.11/Makefile.am 1970-01-01 01:00:00.000000000 +0100
+++ zlib-1.2.11-new/Makefile.am 2020-11-12 22:09:58.320508742 +0100
@@ -0,0 +1,37 @@
+ACLOCAL_AMFLAGS = -I m4 --install
+
+lib_LTLIBRARIES = libz.la
+
+libz_la_SOURCES = \
+ adler32.c \
+ compress.c \
+ crc32.c \
+ crc32.h \
+ gzclose.c \
+ gzlib.c \
+ gzread.c \
+ gzwrite.c \
+ uncompr.c \
+ deflate.c \
+ deflate.h \
+ trees.c \
+ trees.h \
+ zutil.c \
+ zutil.h \
+ inflate.c \
+ inflate.h \
+ infback.c \
+ inftrees.c \
+ inftrees.h \
+ inffast.c \
+ inffast.h \
+ infflate.h
+
+# Use -version-number to match the file name used before autoconfiscation.
+libz_la_LDFLAGS = -version-number 1:2:11 -no-undefined
+
+include_HEADERS = zlib.h
+nodist_include_HEADERS = zconf.h
+
+dist_man_MANS = zlib.3
+
diff -rupN --no-dereference zlib-1.2.11/zlib.pc.in zlib-1.2.11-new/zlib.pc.in
--- zlib-1.2.11/zlib.pc.in 2010-04-18 08:48:15.000000000 +0200
+++ zlib-1.2.11-new/zlib.pc.in 2020-11-12 22:09:58.320508742 +0100
@@ -1,7 +1,6 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
-sharedlibdir=@sharedlibdir@
includedir=@includedir@
Name: zlib
@@ -9,5 +8,5 @@ Description: zlib compression library
Version: @VERSION@
Requires:
-Libs: -L${libdir} -L${sharedlibdir} -lz
+Libs: -L${libdir} -lz
Cflags: -I${includedir}

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (zlib-1.3.1.tar.xz) = 1e8e70b362d64a233591906a1f50b59001db04ca14aaffad522198b04680be501736e7d536b4191e2f99767e7001ca486cd802362cca2be05d5d409b83ea732d

View File

@ -0,0 +1,8 @@
diff -rupN --no-dereference zlib-1.2.11/win32/zlib.def zlib-1.2.11-new/win32/zlib.def
--- zlib-1.2.11/win32/zlib.def 2017-01-01 08:37:10.000000000 +0100
+++ zlib-1.2.11-new/win32/zlib.def 2020-11-12 22:09:58.338508692 +0100
@@ -1,3 +1,4 @@
+LIBRARY zlib1.dll
; zlib data compression library
EXPORTS
; basic functions