summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-03-03 22:50:49 +0800
committerruki <[email protected]>2026-03-03 22:50:49 +0800
commit28f8b6894830f05dd3f5c741a988055d27514ee2 (patch)
tree2287325b33be22a88154a54898724680e308f502
parent674a953813363c330275262ed86cdf70ba1db46c (diff)
improve gzip
-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