1{ fetchurl, stdenv, acl, openssl, libxml2, attr, zlib, bzip2, e2fsprogs, xz
2, sharutils }:
3
4stdenv.mkDerivation rec {
5 name = "libarchive-3.1.2";
6
7 src = fetchurl {
8 urls = [
9 "http://pkgs.fedoraproject.org/repo/pkgs/libarchive/libarchive-3.1.2.tar.gz/efad5a503f66329bb9d2f4308b5de98a/${name}.tar.gz"
10 "${meta.homepage}/downloads/${name}.tar.gz"
11 ];
12 sha256 = "0pixqnrcf35dnqgv0lp7qlcw7k13620qkhgxr288v7p4iz6ym1zb";
13 };
14
15 patches = [
16 ./CVE-2013-0211.patch # https://github.com/libarchive/libarchive/commit/22531545
17 ./CVE-2015-1197.patch # https://github.com/NixOS/nixpkgs/issues/6799
18 # ^ it's CVE-2015-2304 specific to libarchive
19 ];
20
21 buildInputs = [ sharutils libxml2 zlib bzip2 openssl xz ] ++
22 stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ];
23
24 preBuild = if stdenv.isCygwin then ''
25 echo "#include <windows.h>" >> config.h
26 '' else null;
27
28 preFixup = ''
29 sed 's|-lcrypto|-L${openssl}/lib -lcrypto|' -i $out/lib/libarchive.la
30 '';
31
32 meta = {
33 description = "Multi-format archive and compression library";
34 longDescription = ''
35 This library has code for detecting and reading many archive formats and
36 compressions formats including (but not limited to) tar, shar, cpio, zip, and
37 compressed with gzip, bzip2, lzma, xz, ..
38 '';
39 homepage = http://libarchive.org;
40 license = stdenv.lib.licenses.bsd3;
41 platforms = with stdenv.lib.platforms; all;
42 maintainers = with stdenv.lib.maintainers; [ jcumming ];
43 };
44}