linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / libarchive / default.nix
blobf53d1b1a12f7d974f71d39f3ba5814ce4b1ca66e
2   fetchFromGitHub, lib, stdenv, pkg-config, autoreconfHook,
3   acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib, zstd,
5   # Optional but increases closure only negligibly. Also, while libxml2
6   # builds fine on windows, but libarchive has trouble linking windows
7   # things it depends on for some reason.
8   xarSupport ? stdenv.hostPlatform.isUnix,
9 }:
11 assert xarSupport -> libxml2 != null;
13 stdenv.mkDerivation rec {
14   pname = "libarchive";
15   version = "3.5.1";
17   src = fetchFromGitHub {
18     owner = "libarchive";
19     repo = "libarchive";
20     rev = "v${version}";
21     sha256 = "sha256-RFPhe4PCq8OLwa6c7ir+5u9jBsUxS5M/fcZYAG9W6R0=";
22   };
24   outputs = [ "out" "lib" "dev" ];
26   nativeBuildInputs = [ pkg-config autoreconfHook ];
27   buildInputs =
28     lib.optional stdenv.hostPlatform.isUnix sharutils
29     ++ [ zlib bzip2 openssl xz lzo zstd ]
30     ++ lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
31     ++ lib.optional xarSupport libxml2;
33   # Without this, pkg-config-based dependencies are unhappy
34   propagatedBuildInputs = lib.optionals stdenv.isLinux [ attr acl ];
36   configureFlags = lib.optional (!xarSupport) "--without-xml2";
38   preBuild = if stdenv.isCygwin then ''
39     echo "#include <windows.h>" >> config.h
40   '' else null;
42   doCheck = false; # fails
44   preFixup = ''
45     sed -i $lib/lib/libarchive.la \
46       -e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
47       -e 's|-llzo2|-L${lzo}/lib -llzo2|'
48   '';
50   enableParallelBuilding = true;
52   meta = {
53     description = "Multi-format archive and compression library";
54     longDescription = ''
55       This library has code for detecting and reading many archive formats and
56       compressions formats including (but not limited to) tar, shar, cpio, zip, and
57       compressed with gzip, bzip2, lzma, xz, ...
58     '';
59     homepage = "http://libarchive.org";
60     changelog = "https://github.com/libarchive/libarchive/releases/tag/v${version}";
61     license = lib.licenses.bsd3;
62     platforms = with lib.platforms; all;
63     maintainers = with lib.maintainers; [ jcumming ];
64   };