summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/modules/utils/archive/archive.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/xmake/modules/utils/archive/archive.lua b/xmake/modules/utils/archive/archive.lua
index 0969eff7e..1d09da989 100644
--- a/xmake/modules/utils/archive/archive.lua
+++ b/xmake/modules/utils/archive/archive.lua
@@ -196,7 +196,20 @@ function _archive_using_gzip(archivefile, inputfiles, extension, opt)
end
-- init argv
- local argv = {"-k", "-c", archivefile}
+ local argv = {"-c", archivefile}
+ local keep = _g.gzip_keep
+ if keep == nil then
+ keep = try {function ()
+ local result = os.iorunv(gzip.program, {"--help"})
+ if result and (result:find(" -k", 1, true) or result:find("--keep", 1, true)) then
+ return true
+ end
+ end}
+ _g.gzip_keep = keep or false
+ end
+ if keep then
+ table.insert(argv, 1, "-k")
+ end
if not option.get("verbose") then
table.insert(argv, "-q")
end