diff options
| author | Shiffted <[email protected]> | 2026-06-11 00:49:37 +0200 |
|---|---|---|
| committer | Shiffted <[email protected]> | 2026-06-11 10:37:09 +0200 |
| commit | 9d9673d3eb54aacb2f37c6b1f6425ea9f267c119 (patch) | |
| tree | 4fc94d983cb3a63e48ee01cf511efcf96a2a1dfb | |
| parent | 4e41db7c11117eca50f8cec6cbdfc0f746965d3e (diff) | |
pass explicit tar compression flags
| -rw-r--r-- | xmake/modules/utils/archive/extract.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua index a11f4146f..8116617fb 100644 --- a/xmake/modules/utils/archive/extract.lua +++ b/xmake/modules/utils/archive/extract.lua @@ -65,6 +65,25 @@ function _extract_using_tar(archivefile, outputdir, extension, opt) table.insert(argv, "--force-local") end end + + if is_host("bsd") then + -- pass explicit compression flag only to tar without auto-detection, + -- as auto-detection can handle more cases. + local auto_detect = _g.compression_auto_detect + if auto_detect == nil then + auto_detect = try { function () os.runv(program, {"--version"}); return true end } or false + _g.compression_auto_detect = auto_detect + end + if not auto_detect then + if extension == ".tgz" or extension == ".tar.gz" then + table.insert(argv, "-z") + elseif extension == ".tar.bz2" then + table.insert(argv, "-j") + elseif extension == ".tar.Z" then + table.insert(argv, "-Z") + end + end + end table.insert(argv, "-xf") table.insert(argv, path.absolute(archivefile)) |
