nixpkgs/pkgs/development/libraries/libarchive/default.nix
2020-04-10 17:54:53 +01:00

61 lines
1.8 KiB
Nix

{
fetchFromGitHub, stdenv, pkgconfig, autoreconfHook,
acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib,
# Optional but increases closure only negligibly.
xarSupport ? true,
}:
assert xarSupport -> libxml2 != null;
stdenv.mkDerivation rec {
pname = "libarchive";
version = "3.4.2";
src = fetchFromGitHub {
owner = "libarchive";
repo = "libarchive";
rev = "v${version}";
sha256 = "0mjm77wbqs8sbn9j44lj39nwbg6anmgz6pkyfxsww54a4rs0p3iz";
};
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [ pkgconfig autoreconfHook ];
buildInputs = [ sharutils zlib bzip2 openssl xz lzo ]
++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
++ stdenv.lib.optional xarSupport libxml2;
# Without this, pkgconfig-based dependencies are unhappy
propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ];
configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2";
preBuild = if stdenv.isCygwin then ''
echo "#include <windows.h>" >> config.h
'' else null;
doCheck = false; # fails
preFixup = ''
sed -i $lib/lib/libarchive.la \
-e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
-e 's|-llzo2|-L${lzo}/lib -llzo2|'
'';
enableParallelBuilding = true;
meta = {
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
compressed with gzip, bzip2, lzma, xz, ...
'';
homepage = "http://libarchive.org";
license = stdenv.lib.licenses.bsd3;
platforms = with stdenv.lib.platforms; all;
maintainers = with stdenv.lib.maintainers; [ jcumming ];
};
}