libarchive: make libxml2 (XAR support) optional

Defaults to unincluded to reduce closure size.
This commit is contained in:
Aneesh Agrawal 2016-08-18 23:56:39 -04:00
parent c89959e625
commit 0187c7df7c

View File

@ -1,5 +1,12 @@
{ fetchurl, stdenv, acl, openssl, libxml2, attr, zlib, bzip2, e2fsprogs, xz, lzo {
, sharutils }: fetchurl, stdenv,
acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib,
# Optional
xarSupport ? false,
}:
assert xarSupport -> libxml2 != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libarchive-${version}"; name = "libarchive-${version}";
@ -10,12 +17,15 @@ stdenv.mkDerivation rec {
sha256 = "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj"; sha256 = "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj";
}; };
buildInputs = [ sharutils libxml2 zlib bzip2 openssl xz lzo ] ++ buildInputs = [ sharutils zlib bzip2 openssl xz lzo ]
stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]; ++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
++ stdenv.lib.optional xarSupport libxml2;
# Without this, pkgconfig-based dependencies are unhappy # Without this, pkgconfig-based dependencies are unhappy
propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ]; propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ];
configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2";
preBuild = if stdenv.isCygwin then '' preBuild = if stdenv.isCygwin then ''
echo "#include <windows.h>" >> config.h echo "#include <windows.h>" >> config.h
'' else null; '' else null;