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