Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/riscv:master commit in: sys-libs/zlib/, sys-libs/zlib/files/
Date: Sat, 05 Sep 2020 21:00:20
Message-Id: 1599339576.98db05471db283f4897c2537ae5456e62cf5483b.dilfridge@gentoo
1 commit: 98db05471db283f4897c2537ae5456e62cf5483b
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 5 20:59:36 2020 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 5 20:59:36 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/riscv.git/commit/?id=98db0547
7
8 sys-libs/zlib: Copy from main tree to get additional abis
9
10 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
11
12 sys-libs/zlib/Manifest | 1 +
13 .../zlib-1.2.11-fix-deflateParams-usage.patch | 67 +++++++++++
14 .../zlib-1.2.11-minizip-drop-crypt-header.patch | 38 +++++++
15 sys-libs/zlib/metadata.xml | 14 +++
16 sys-libs/zlib/zlib-1.2.11-r2.ebuild | 123 +++++++++++++++++++++
17 5 files changed, 243 insertions(+)
18
19 diff --git a/sys-libs/zlib/Manifest b/sys-libs/zlib/Manifest
20 new file mode 100644
21 index 0000000..1db6ff6
22 --- /dev/null
23 +++ b/sys-libs/zlib/Manifest
24 @@ -0,0 +1 @@
25 +DIST zlib-1.2.11.tar.gz 607698 BLAKE2B 6bfc4bca5dcadba8a0d4121a2b3ed0bfe440c261003521862c8e6381f1a6f0a72d3fc037351d30afd7ef321e8e8d2ec817c046ac749f2ca0c97fbdc2f7e840b7 SHA512 73fd3fff4adeccd4894084c15ddac89890cd10ef105dd5e1835e1e9bbb6a49ff229713bd197d203edfa17c2727700fce65a2a235f07568212d820dca88b528ae
26
27 diff --git a/sys-libs/zlib/files/zlib-1.2.11-fix-deflateParams-usage.patch b/sys-libs/zlib/files/zlib-1.2.11-fix-deflateParams-usage.patch
28 new file mode 100644
29 index 0000000..1876484
30 --- /dev/null
31 +++ b/sys-libs/zlib/files/zlib-1.2.11-fix-deflateParams-usage.patch
32 @@ -0,0 +1,67 @@
33 +From f9694097dd69354b03cb8af959094c7f260db0a1 Mon Sep 17 00:00:00 2001
34 +From: Mark Adler <madler@××××××××××××××.edu>
35 +Date: Mon, 16 Jan 2017 09:49:35 -0800
36 +Subject: [PATCH] Permit a deflateParams() parameter change as soon as
37 + possible.
38 +
39 +This commit allows a parameter change even if the input data has
40 +not all been compressed and copied to the application output
41 +buffer, so long as all of the input data has been compressed to
42 +the internal pending output buffer. This also allows an immediate
43 +deflateParams change so long as there have been no deflate calls
44 +since initialization or reset.
45 +---
46 + deflate.c | 6 +++---
47 + zlib.h | 11 ++++++-----
48 + 2 files changed, 9 insertions(+), 8 deletions(-)
49 +
50 +diff --git a/deflate.c b/deflate.c
51 +index b63311a5..20bda4f6 100644
52 +--- a/deflate.c
53 ++++ b/deflate.c
54 +@@ -494,7 +494,7 @@ int ZEXPORT deflateResetKeep (strm)
55 + s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
56 + #endif
57 + adler32(0L, Z_NULL, 0);
58 +- s->last_flush = Z_NO_FLUSH;
59 ++ s->last_flush = -2;
60 +
61 + _tr_init(s);
62 +
63 +@@ -587,12 +587,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
64 + func = configuration_table[s->level].func;
65 +
66 + if ((strategy != s->strategy || func != configuration_table[level].func) &&
67 +- s->high_water) {
68 ++ s->last_flush != -2) {
69 + /* Flush the last buffer: */
70 + int err = deflate(strm, Z_BLOCK);
71 + if (err == Z_STREAM_ERROR)
72 + return err;
73 +- if (strm->avail_out == 0)
74 ++ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
75 + return Z_BUF_ERROR;
76 + }
77 + if (s->level != level) {
78 +diff --git a/zlib.h b/zlib.h
79 +index 5daf4f28..577d81e3 100644
80 +--- a/zlib.h
81 ++++ b/zlib.h
82 +@@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
83 + used to switch between compression and straight copy of the input data, or
84 + to switch to a different kind of input data requiring a different strategy.
85 + If the compression approach (which is a function of the level) or the
86 +- strategy is changed, and if any input has been consumed in a previous
87 +- deflate() call, then the input available so far is compressed with the old
88 +- level and strategy using deflate(strm, Z_BLOCK). There are three approaches
89 +- for the compression levels 0, 1..3, and 4..9 respectively. The new level
90 +- and strategy will take effect at the next call of deflate().
91 ++ strategy is changed, and if there have been any deflate() calls since the
92 ++ state was initialized or reset, then the input available so far is
93 ++ compressed with the old level and strategy using deflate(strm, Z_BLOCK).
94 ++ There are three approaches for the compression levels 0, 1..3, and 4..9
95 ++ respectively. The new level and strategy will take effect at the next call
96 ++ of deflate().
97 +
98 + If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
99 + not have enough output space to complete, then the parameter change will not
100
101 diff --git a/sys-libs/zlib/files/zlib-1.2.11-minizip-drop-crypt-header.patch b/sys-libs/zlib/files/zlib-1.2.11-minizip-drop-crypt-header.patch
102 new file mode 100644
103 index 0000000..2e0a93e
104 --- /dev/null
105 +++ b/sys-libs/zlib/files/zlib-1.2.11-minizip-drop-crypt-header.patch
106 @@ -0,0 +1,38 @@
107 +https://bugs.gentoo.org/658536
108 +https://github.com/madler/zlib/pull/229
109 +
110 +From e490ddad3091574a0c2e3b5a66a8fee9a7ab212f Mon Sep 17 00:00:00 2001
111 +From: Pavel Raiskup <praiskup@××××××.com>
112 +Date: Sun, 19 Feb 2017 16:42:12 +0100
113 +Subject: [PATCH] minizip: don't install crypt.h
114 +
115 +People did mistakenly or unintentionally include crypt.h before,
116 +don't install this internal header from now.
117 +---
118 + contrib/minizip/Makefile.am | 4 +++-
119 + 1 file changed, 3 insertions(+), 1 deletion(-)
120 +
121 +diff --git a/contrib/minizip/Makefile.am b/contrib/minizip/Makefile.am
122 +index d343011ebc3b..4f46610238d2 100644
123 +--- a/contrib/minizip/Makefile.am
124 ++++ b/contrib/minizip/Makefile.am
125 +@@ -26,13 +26,15 @@ libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz
126 +
127 + minizip_includedir = $(includedir)/minizip
128 + minizip_include_HEADERS = \
129 +- crypt.h \
130 + ioapi.h \
131 + mztools.h \
132 + unzip.h \
133 + zip.h \
134 + ${iowin32_h}
135 +
136 ++noinst_HEADERS = \
137 ++ crypt.h
138 ++
139 + pkgconfigdir = $(libdir)/pkgconfig
140 + pkgconfig_DATA = minizip.pc
141 +
142 +--
143 +2.17.1
144 +
145
146 diff --git a/sys-libs/zlib/metadata.xml b/sys-libs/zlib/metadata.xml
147 new file mode 100644
148 index 0000000..105b205
149 --- /dev/null
150 +++ b/sys-libs/zlib/metadata.xml
151 @@ -0,0 +1,14 @@
152 +<?xml version="1.0" encoding="UTF-8"?>
153 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
154 +<pkgmetadata>
155 +<maintainer type="project">
156 + <email>base-system@g.o</email>
157 + <name>Gentoo Base System</name>
158 +</maintainer>
159 +<use>
160 + <flag name="minizip">include the minizip library for quick and dirty zip extraction</flag>
161 +</use>
162 +<upstream>
163 + <remote-id type="cpe">cpe:/a:gnu:zlib</remote-id>
164 +</upstream>
165 +</pkgmetadata>
166
167 diff --git a/sys-libs/zlib/zlib-1.2.11-r2.ebuild b/sys-libs/zlib/zlib-1.2.11-r2.ebuild
168 new file mode 100644
169 index 0000000..b43e10d
170 --- /dev/null
171 +++ b/sys-libs/zlib/zlib-1.2.11-r2.ebuild
172 @@ -0,0 +1,123 @@
173 +# Copyright 1999-2020 Gentoo Authors
174 +# Distributed under the terms of the GNU General Public License v2
175 +
176 +EAPI="5"
177 +AUTOTOOLS_AUTO_DEPEND="no"
178 +
179 +inherit autotools toolchain-funcs multilib multilib-minimal usr-ldscript
180 +
181 +DESCRIPTION="Standard (de)compression library"
182 +HOMEPAGE="https://zlib.net/"
183 +SRC_URI="https://zlib.net/${P}.tar.gz
184 + http://www.gzip.org/zlib/${P}.tar.gz
185 + http://www.zlib.net/current/beta/${P}.tar.gz"
186 +
187 +LICENSE="ZLIB"
188 +SLOT="0/1" # subslot = SONAME
189 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
190 +IUSE="minizip static-libs"
191 +
192 +DEPEND="minizip? ( ${AUTOTOOLS_DEPEND} )"
193 +RDEPEND="!<dev-libs/libxml2-2.7.7" #309623
194 +
195 +src_prepare() {
196 + epatch "${FILESDIR}"/${PN}-1.2.11-fix-deflateParams-usage.patch
197 + epatch "${FILESDIR}"/${PN}-1.2.11-minizip-drop-crypt-header.patch #658536
198 +
199 + if use minizip ; then
200 + cd contrib/minizip || die
201 + eautoreconf
202 + fi
203 +
204 + case ${CHOST} in
205 + *-mingw*|mingw*)
206 + # uses preconfigured Makefile rather than configure script
207 + multilib_copy_sources
208 + ;;
209 + esac
210 +}
211 +
212 +echoit() { echo "$@"; "$@"; }
213 +
214 +multilib_src_configure() {
215 + case ${CHOST} in
216 + *-mingw*|mingw*)
217 + ;;
218 + *) # not an autoconf script, so can't use econf
219 + local uname=$("${EPREFIX}"/usr/share/gnuconfig/config.sub "${CHOST}" | cut -d- -f3) #347167
220 + echoit "${S}"/configure \
221 + --shared \
222 + --prefix="${EPREFIX}/usr" \
223 + --libdir="${EPREFIX}/usr/$(get_libdir)" \
224 + ${uname:+--uname=${uname}} \
225 + || die
226 + ;;
227 + esac
228 +
229 + if use minizip ; then
230 + local minizipdir="contrib/minizip"
231 + mkdir -p "${BUILD_DIR}/${minizipdir}" || die
232 + cd ${minizipdir} || die
233 + ECONF_SOURCE="${S}/${minizipdir}" \
234 + econf $(use_enable static-libs static)
235 + fi
236 +}
237 +
238 +multilib_src_compile() {
239 + case ${CHOST} in
240 + *-mingw*|mingw*)
241 + emake -f win32/Makefile.gcc STRIP=true PREFIX=${CHOST}-
242 + sed \
243 + -e 's|@prefix@|/usr|g' \
244 + -e 's|@exec_prefix@|${prefix}|g' \
245 + -e 's|@libdir@|${exec_prefix}/'$(get_libdir)'|g' \
246 + -e 's|@sharedlibdir@|${exec_prefix}/'$(get_libdir)'|g' \
247 + -e 's|@includedir@|${prefix}/include|g' \
248 + -e 's|@VERSION@|'${PV}'|g' \
249 + zlib.pc.in > zlib.pc || die
250 + ;;
251 + *)
252 + emake
253 + ;;
254 + esac
255 + use minizip && emake -C contrib/minizip
256 +}
257 +
258 +sed_macros() {
259 + # clean up namespace a little #383179
260 + # we do it here so we only have to tweak 2 files
261 + sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "$@" || die
262 +}
263 +
264 +multilib_src_install() {
265 + case ${CHOST} in
266 + *-mingw*|mingw*)
267 + emake -f win32/Makefile.gcc install \
268 + BINARY_PATH="${ED}/usr/bin" \
269 + LIBRARY_PATH="${ED}/usr/$(get_libdir)" \
270 + INCLUDE_PATH="${ED}/usr/include" \
271 + SHARED_MODE=1
272 + # overwrites zlib.pc created from win32/Makefile.gcc #620136
273 + insinto /usr/$(get_libdir)/pkgconfig
274 + doins zlib.pc
275 + ;;
276 +
277 + *)
278 + emake install DESTDIR="${D}" LDCONFIG=:
279 + gen_usr_ldscript -a z
280 + ;;
281 + esac
282 + sed_macros "${ED}"/usr/include/*.h
283 +
284 + if use minizip ; then
285 + emake -C contrib/minizip install DESTDIR="${D}"
286 + sed_macros "${ED}"/usr/include/minizip/*.h
287 + fi
288 +
289 + use static-libs || rm -f "${ED}"/usr/$(get_libdir)/lib{z,minizip}.{a,la} #419645
290 +}
291 +
292 +multilib_src_install_all() {
293 + dodoc FAQ README ChangeLog doc/*.txt
294 + use minizip && dodoc contrib/minizip/*.txt
295 +}