nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchurl, stdenv, pkgconfig,
3 acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib,
4
5 # Optional but increases closure only negligibly.
6 xarSupport ? true,
7}:
8
9assert xarSupport -> libxml2 != null;
10
11stdenv.mkDerivation rec {
12 name = "libarchive-${version}";
13 version = "3.3.2";
14
15 src = fetchurl {
16 url = "${meta.homepage}/downloads/${name}.tar.gz";
17 sha256 = "1km0mzfl6in7l5vz9kl09a88ajx562rw93ng9h2jqavrailvsbgd";
18 };
19
20 patches = [
21 ./CVE-2017-14166.patch
22 ./CVE-2017-14502.patch
23 ];
24
25 outputs = [ "out" "lib" "dev" ];
26
27 nativeBuildInputs = [ pkgconfig ];
28 buildInputs = [ sharutils zlib bzip2 openssl xz lzo ]
29 ++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
30 ++ stdenv.lib.optional xarSupport libxml2;
31
32 # Without this, pkgconfig-based dependencies are unhappy
33 propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ];
34
35 configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2";
36
37 preBuild = if stdenv.isCygwin then ''
38 echo "#include <windows.h>" >> config.h
39 '' else null;
40
41 preFixup = ''
42 sed -i $lib/lib/libarchive.la \
43 -e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
44 -e 's|-llzo2|-L${lzo}/lib -llzo2|'
45 '';
46
47 meta = {
48 description = "Multi-format archive and compression library";
49 longDescription = ''
50 This library has code for detecting and reading many archive formats and
51 compressions formats including (but not limited to) tar, shar, cpio, zip, and
52 compressed with gzip, bzip2, lzma, xz, ...
53 '';
54 homepage = http://libarchive.org;
55 license = stdenv.lib.licenses.bsd3;
56 platforms = with stdenv.lib.platforms; all;
57 maintainers = with stdenv.lib.maintainers; [ jcumming ];
58 };
59}