1{ stdenv, fetchurl, zlib }:
2
3stdenv.mkDerivation rec {
4 name = "libzip-0.11.2";
5
6 src = fetchurl {
7 url = "http://www.nih.at/libzip/${name}.tar.gz";
8 sha256 = "1mcqrz37vjrfr4gnss37z1m7xih9x9miq3mms78zf7wn7as1znw3";
9 };
10
11 # fix CVE-2015-2331 taken from Debian patch:
12 # https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=12;filename=libzip-0.11.2-1.2-nmu.diff;att=1;bug=780756
13 postPatch = ''
14 substituteInPlace lib/zip_dirent.c --replace \
15 'else if ((cd->entry=(struct zip_entry *)' \
16 'else if (nentry > ((size_t)-1)/sizeof(*(cd->entry)) || (cd->entry=(struct zip_entry *)'
17 cat lib/zip_dirent.c
18 '';
19
20 propagatedBuildInputs = [ zlib ];
21
22 # At least mysqlWorkbench cannot find zipconf.h; I think also openoffice
23 # had this same problem. This links it somewhere that mysqlworkbench looks.
24 postInstall = ''
25 ( cd $out/include ; ln -s ../lib/libzip/include/zipconf.h zipconf.h )
26 '';
27
28 meta = {
29 homepage = http://www.nih.at/libzip;
30 description = "A C library for reading, creating and modifying zip archives";
31 };
32}