summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaleb Kiage <[email protected]>2023-07-13 11:55:29 +0300
committerCaleb Kiage <[email protected]>2023-07-13 11:55:29 +0300
commitb0f468882333adaa3e450422e8aa6fe0f897935a (patch)
tree60f27018e05d8e25802f5ba399a40abdaaaac55d
parent7939d750e9dcd51b5bac3e4f4a7ead5a81b2bed0 (diff)
Fix tar extraction in mingw windows
-rw-r--r--xmake/core/base/os.lua5
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua2
-rw-r--r--xmake/modules/utils/archive/extract.lua8
3 files changed, 8 insertions, 7 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index bb2ebec53..e4dc6ebf6 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -1002,8 +1002,9 @@ end
-- get the system null device
function os.nuldev(input)
+ -- mingw and cygwin have /dev/null
if input then
- if os.host() == "windows" then
+ if os.host() == "windows" and not os.is_subhost("msys", "cygwin") then
-- init the input nuldev
if xmake._NULDEV_INPUT == nil then
-- create an empty file
@@ -1023,7 +1024,7 @@ function os.nuldev(input)
end
return xmake._NULDEV_INPUT
else
- if os.host() == "windows" then
+ if os.host() == "windows" and not os.is_subhost("msys", "cygwin") then
-- @note cannot cache this file path to avoid multi-processes writing to the same file at the same time
return os.tmpfile()
else
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
index dad9dbdd4..a4e3c2849 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -227,7 +227,7 @@ function sandbox_lib_detect_find_program._find(name, paths, opt)
if envpaths then
table.join2(syspaths, path.splitenv(envpaths))
end]]
- if os.host() ~= "windows" then
+ if os.host() ~= "windows" or os.is_subhost("msys", "cygwin") then
table.insert(syspaths, "/usr/local/bin")
table.insert(syspaths, "/usr/bin")
end
diff --git a/xmake/modules/utils/archive/extract.lua b/xmake/modules/utils/archive/extract.lua
index 620c84d69..4a91e1a78 100644
--- a/xmake/modules/utils/archive/extract.lua
+++ b/xmake/modules/utils/archive/extract.lua
@@ -33,7 +33,7 @@ import("extension", {alias = "get_archive_extension"})
function _extract_using_tar(archivefile, outputdir, extension, opt)
-- the tar of windows can only extract "*.tar"
- if os.host() == "windows" and extension ~= ".tar" then
+ if os.host() == "windows" and not os.is_subhost("msys", "cygwin") and extension ~= ".tar" then
return false
end
@@ -45,7 +45,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
-- init argv
local argv = {}
- if is_host("windows") then
+ if is_host("windows") and not os.is_subhost("msys", "cygwin") then
-- force "x:\\xx" as local file
local force_local = _g.force_local
if force_local == nil then
@@ -70,7 +70,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
end
-- set outputdir
- if not is_host("windows") then
+ if not is_host("windows") or os.is_subhost("msys", "cygwin") then
table.insert(argv, "-C")
table.insert(argv, outputdir)
end
@@ -84,7 +84,7 @@ function _extract_using_tar(archivefile, outputdir, extension, opt)
end
-- extract it
- if is_host("windows") then
+ if is_host("windows") and not os.is_subhost("msys", "cygwin") then
os.vrunv(program, argv, {curdir = outputdir})
else
os.vrunv(program, argv)