Skip to content

Commit

Permalink
Merge pull request #6015 from Doekin/zig-cc-win-bash
Browse files Browse the repository at this point in the history
zig cc: fix wrapper not working properly in Git Bash
  • Loading branch information
waruqi authored Dec 28, 2024
2 parents b4d52bd + 7f3f5b5 commit 5665dc8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion xmake/modules/package/tools/autoconf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion xmake/modules/package/tools/make.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5665dc8

Please sign in to comment.