summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-12-29 01:04:58 +0800
committerGitHub <[email protected]>2024-12-29 01:04:58 +0800
commit5665dc8df7a837d09c905c62591efefba92fb4df (patch)
tree63d217ea073b3248e4264baba2491855d4b92f16
parentb4d52bde5ff47bef46b0acc3e54227d9ef6877a1 (diff)
parent7f3f5b55c298e4402e50d3f323bfad4cd405ca43 (diff)
Merge pull request #6015 from Doekin/zig-cc-win-bash
zig cc: fix wrapper not working properly in Git Bash
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua5
-rw-r--r--xmake/modules/package/tools/autoconf.lua6
-rw-r--r--xmake/modules/package/tools/make.lua7
3 files changed, 15 insertions, 3 deletions
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 3b20eb938..fcf552f20 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -83,7 +83,10 @@ function sandbox_lib_detect_find_program._check(program, opt)
elseif os.subhost() == "msys" and os.isfile(program) and os.filesize(program) < 256 then
-- only a sh script on msys2? e.g. c:/msys64/usr/bin/7z
-- we need to use sh to wrap it, otherwise os.exec cannot run it
- program = "sh " .. program
+ local program_lower = program:lower()
+ if not program_lower:endswith(".exe") and not program_lower:endswith(".cmd") and not program_lower:endswith(".bat") then
+ program = "sh " .. program
+ end
findname = program
end
if sandbox_lib_detect_find_program._do_check(findname, opt) then
diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua
index 345b0fde9..8c800c190 100644
--- a/xmake/modules/package/tools/autoconf.lua
+++ b/xmake/modules/package/tools/autoconf.lua
@@ -60,7 +60,11 @@ end
function _translate_windows_bin_path(bin_path)
if bin_path then
local argv = os.argv(bin_path)
- argv[1] = path.unix(argv[1]) .. ".exe"
+ argv[1] = path.unix(argv[1])
+ local path_lower = argv[1]:lower()
+ if not path_lower:endswith(".exe") and not path_lower:endswith(".cmd") and not path_lower:endswith(".bat") then
+ argv[1] = argv[1] .. ".exe"
+ end
return os.args(argv)
end
end
diff --git a/xmake/modules/package/tools/make.lua b/xmake/modules/package/tools/make.lua
index 9399fa900..cec1361ad 100644
--- a/xmake/modules/package/tools/make.lua
+++ b/xmake/modules/package/tools/make.lua
@@ -27,7 +27,12 @@ import("private.utils.toolchain", {alias = "toolchain_utils"})
-- translate bin path
function _translate_bin_path(bin_path)
if is_host("windows") and bin_path then
- return bin_path:gsub("\\", "/") .. ".exe"
+ bin_path = bin_path:gsub("\\", "/")
+ local bin_path_lower = bin_path:lower()
+ if not bin_path_lower:endswith(".exe") and not bin_path_lower:endswith(".cmd") and not bin_path_lower:endswith(".bat") then
+ bin_path = bin_path .. ".exe"
+ end
+ return bin_path
end
return bin_path
end