nixpkgs-suyu/pkgs/development/libraries/libarchive/default.nix
Aneesh Agrawal 0187c7df7c libarchive: make libxml2 (XAR support) optional
Defaults to unincluded to reduce closure size.
2016-08-18 23:58:03 -04:00

51 lines
1.5 KiB
Nix

{
fetchurl, stdenv,
acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib,
# Optional
xarSupport ? false,
}:
assert xarSupport -> libxml2 != null;
stdenv.mkDerivation rec {
name = "libarchive-${version}";
version = "3.2.1";
src = fetchurl {
url = "${meta.homepage}/downloads/${name}.tar.gz";
sha256 = "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj";
};
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;
preFixup = ''
sed -i $out/lib/libarchive.la \
-e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
-e 's|-llzo2|-L${lzo}/lib -llzo2|'
'';
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 ];
};
}