summaryrefslogtreecommitdiff
path: root/libz/README-DEV
blob: aa7874f0a37eca6c53351e73e0d3454f130b8c3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
This document describes how libz was packaged for build2. In particular, this
understanding will be useful when upgrading to a new upstream version. See
../README-DEV for general notes on zlib packaging.

Symlink the required upstream files into libz/:

$ cd libz &&
  ln -s ../../upstream/*.{c,h,map} ../../upstream/win32/*.def ./ &&
  rm zconf.h zlib.h

The upstream's (hand written) configure script pre-processes zconf.h.in and
replaces '#ifdef HAVE_UNISTD_H' and '#ifdef HAVE_STDARG_H' with '#if 1' on
POSIX. We replace these constructs in zconf.h.in with '#if @HAVE_...@' and use
the in module to generate zconf.h. We also edit zlib.h to include zconf.h
using angle brackets rather that quotes for the headers auto-generating
machinery to work properly.

$ cp ../../upstream/{zconf.h.in,zlib.h} ./
$ touch zconf.h
$ patch -p0 <zconf.h.in.patch
$ patch -p0 <zlib.h.patch

Apply patches to fix CVE-2022-37434:

$ rm inflate.c
$ cp ../../upstream/inflate.c .
$ patch -p0 <CVE-2022-37434-eff308a.patch
$ patch -p0 <CVE-2022-37434-1eb7682.patch

@@ TMP Remove the CVE-2022-37434-* patches, the above notes, and turn libz.c
   back into symlink to ../../upstream/inflate.c when upgrade to upstream
   version > 1.2.12.

Note that there is no LICENSE/COPYING file in the upstream project as the
copyright notice is provided at the end of its README file. We extract it into
a separate (installable) LICENSE file.

Use the upstream's minigzip test for testing:

ln -s ../../../upstream/test/minigzip.c ../tests/minigzip/