2016-08-19 03:56:39 +00:00
|
|
|
{
|
2021-01-21 17:00:13 +00:00
|
|
|
fetchFromGitHub, lib, stdenv, pkg-config, autoreconfHook,
|
2020-06-04 13:30:23 +00:00
|
|
|
acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib, zstd,
|
2016-08-19 03:56:39 +00:00
|
|
|
|
2020-10-29 00:38:45 +00:00
|
|
|
# Optional but increases closure only negligibly. Also, while libxml2
|
|
|
|
# builds fine on windows, but libarchive has trouble linking windows
|
|
|
|
# things it depends on for some reason.
|
|
|
|
xarSupport ? stdenv.hostPlatform.isUnix,
|
2016-08-19 03:56:39 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert xarSupport -> libxml2 != null;
|
2009-04-21 23:18:09 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "libarchive";
|
2022-02-12 07:04:57 +00:00
|
|
|
version = "3.6.0";
|
2009-04-21 23:18:09 +00:00
|
|
|
|
2019-07-20 21:53:56 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libarchive";
|
|
|
|
repo = "libarchive";
|
|
|
|
rev = "v${version}";
|
2022-02-12 07:04:57 +00:00
|
|
|
sha256 = "sha256-u6Zeu9yTjhx5U7KZVUkuuUsQPjWN71mE5egG4T+FGfY=";
|
2009-04-21 23:18:09 +00:00
|
|
|
};
|
|
|
|
|
2016-09-19 12:33:25 +00:00
|
|
|
outputs = [ "out" "lib" "dev" ];
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config autoreconfHook ];
|
2020-10-29 00:38:45 +00:00
|
|
|
buildInputs =
|
2021-01-21 17:00:13 +00:00
|
|
|
lib.optional stdenv.hostPlatform.isUnix sharutils
|
2020-10-29 00:38:45 +00:00
|
|
|
++ [ zlib bzip2 openssl xz lzo zstd ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
|
|
|
|
++ lib.optional xarSupport libxml2;
|
2011-03-25 12:55:22 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
# Without this, pkg-config-based dependencies are unhappy
|
2021-01-21 17:00:13 +00:00
|
|
|
propagatedBuildInputs = lib.optionals stdenv.isLinux [ attr acl ];
|
2016-04-29 03:29:30 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
configureFlags = lib.optional (!xarSupport) "--without-xml2";
|
2016-08-19 03:56:39 +00:00
|
|
|
|
2014-10-29 22:45:15 +00:00
|
|
|
preBuild = if stdenv.isCygwin then ''
|
|
|
|
echo "#include <windows.h>" >> config.h
|
|
|
|
'' else null;
|
|
|
|
|
2018-04-25 03:20:18 +00:00
|
|
|
doCheck = false; # fails
|
|
|
|
|
2015-07-28 13:22:40 +00:00
|
|
|
preFixup = ''
|
2016-09-19 12:33:25 +00:00
|
|
|
sed -i $lib/lib/libarchive.la \
|
2015-10-14 23:07:37 +00:00
|
|
|
-e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
|
2015-09-25 12:06:23 +00:00
|
|
|
-e 's|-llzo2|-L${lzo}/lib -llzo2|'
|
2015-07-28 13:22:40 +00:00
|
|
|
'';
|
|
|
|
|
2018-06-04 12:48:39 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2009-04-21 23:18:09 +00:00
|
|
|
meta = {
|
2012-10-21 05:17:14 +00:00
|
|
|
description = "Multi-format archive and compression library";
|
|
|
|
longDescription = ''
|
|
|
|
This library has code for detecting and reading many archive formats and
|
|
|
|
compressions formats including (but not limited to) tar, shar, cpio, zip, and
|
2016-09-19 12:33:25 +00:00
|
|
|
compressed with gzip, bzip2, lzma, xz, ...
|
2012-10-21 05:17:14 +00:00
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://libarchive.org";
|
2020-12-02 17:19:06 +00:00
|
|
|
changelog = "https://github.com/libarchive/libarchive/releases/tag/v${version}";
|
2021-01-21 17:00:13 +00:00
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
platforms = with lib.platforms; all;
|
|
|
|
maintainers = with lib.maintainers; [ jcumming ];
|
2009-04-21 23:18:09 +00:00
|
|
|
};
|
|
|
|
}
|