summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-02-20 16:06:09 +0300
committerSaikari <[email protected]>2026-02-20 16:06:09 +0300
commitb66b14a6b56e3eab79ebedd51be44fee81be174e (patch)
tree0ded4591b030880c0e132a6e51d1931a86cdaf12
parentbff076bc40ff224aad1f6a1b0c6c978e7d6b7313 (diff)
Test
-rw-r--r--xmake/modules/detect/tools/find_gcc.lua28
1 files changed, 24 insertions, 4 deletions
diff --git a/xmake/modules/detect/tools/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua
index d658ca1ff..651fbe102 100644
--- a/xmake/modules/detect/tools/find_gcc.lua
+++ b/xmake/modules/detect/tools/find_gcc.lua
@@ -25,10 +25,18 @@ import("core.cache.detectcache")
-- check gcc/gigabyte signature
function check_gcc_gigabyte(program)
- if os.isfile(program) then
+ local filepath = program
+ if path.is_absolute(filepath) then
+ filepath = path.translate(filepath)
+ end
+ -- we only check signature for gcc.exe
+ if not filepath:lower():endswith("gcc.exe") then
+ return
+ end
+ if os.isfile(filepath) then
local signer = nil
if winos.file_signature then
- signer = winos.file_signature(program)
+ signer = winos.file_signature(filepath)
end
if signer and signer.signer_name then
local signer_name = signer.signer_name:upper()
@@ -44,8 +52,20 @@ end
-- @see https://github.com/xmake-io/xmake/issues/5629
function _check_gcc_on_windows(program, opt)
opt = opt or {}
- if check_gcc_gigabyte(program) then
- raise("gcc.exe signed by GIGA-BYTE is not allowed!")
+ if path.is_absolute(program) then
+ if check_gcc_gigabyte(program) then
+ raise("gcc.exe signed by GIGA-BYTE is not allowed!")
+ end
+ else
+ local paths = path.splitenv(vformat("$(env PATH)"))
+ if paths then
+ for _, p in ipairs(paths) do
+ local prog = path.join(p, program)
+ if os.isfile(prog) and check_gcc_gigabyte(prog) then
+ raise("gcc.exe signed by GIGA-BYTE is not allowed!")
+ end
+ end
+ end
end
return os.runv(program, {"--version"}, {envs = opt.envs, shell = opt.shell})
end