diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-30 13:25:18 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-30 13:25:18 +0200 |
commit | 9f4ef03ed488acd2af2ec5155a37677444edc605 (patch) | |
tree | 27cc108ff41ed3956c0d51a213990c59d67f88d7 /build2/dist/operation.cxx | |
parent | af635957efca0dfcd79e7c297a69db36e4971e98 (diff) |
Default to libarchive's bsdtar for tar archives on Windows
Diffstat (limited to 'build2/dist/operation.cxx')
-rw-r--r-- | build2/dist/operation.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx index fddfcea..7b07c0f 100644 --- a/build2/dist/operation.cxx +++ b/build2/dist/operation.cxx @@ -575,12 +575,19 @@ namespace build2 } else { + // On Windows we default to libarchive's bsdtar with auto-compression. + // +#ifdef _WIN32 + const char* tar = "bsdtar"; +#else + const char* tar = "tar"; + if (const char* c = (e == "tar.gz" ? "gzip" : e == "tar.xz" ? "xz" : e == "tar.bz2" ? "bzip2" : nullptr)) { - args = {"tar", + args = {tar, "--format", "ustar", "-cf", "-", pkg.c_str (), @@ -603,14 +610,16 @@ namespace build2 fail << "unable to open " << ap << ": " << e; } } - else if (e == "tar") - args = {"tar", + else +#endif + if (e == "tar") + args = {tar, "--format", "ustar", "-cf", ap.string ().c_str (), pkg.c_str (), nullptr}; else - args = {"tar", + args = {tar, "--format", "ustar", "-a", "-cf", ap.string ().c_str (), |