@@ -1,5 +1,12 @@
1−{ fetchurl, stdenv, acl, openssl, libxml2, attr, zlib, bzip2, e2fsprogs, xz, lzo
2−, sharutils }:
1+{
2+ fetchurl, stdenv, pkgconfig,
3+ acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib,
4+
5+ # Optional but increases closure only negligibly.
6+ xarSupport ? true,
7+}:
8+
9+assert xarSupport -> libxml2 != null;
310
411stdenv.mkDerivation rec {
512 name = "libarchive-${version}";
@@ -10,12 +17,16 @@ stdenv.mkDerivation rec {
1017 sha256 = "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj";
1118 };
1219
13− buildInputs = [ sharutils libxml2 zlib bzip2 openssl xz lzo ] ++
14− stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ];
20+ nativeBuildInputs = [ pkgconfig ];
21+ buildInputs = [ sharutils zlib bzip2 openssl xz lzo ]
22+ ++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
23+ ++ stdenv.lib.optional xarSupport libxml2;
1524
1625 # Without this, pkgconfig-based dependencies are unhappy
1726 propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ];
1827
28+ configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2";
29+
1930 preBuild = if stdenv.isCygwin then ''
2031 echo "#include <windows.h>" >> config.h
2132 '' else null;