diff options
| author | Saikari <[email protected]> | 2026-02-16 19:43:16 +0300 |
|---|---|---|
| committer | Saikari <[email protected]> | 2026-02-16 19:43:16 +0300 |
| commit | 530d8745ab19cf707ac0a1e729d641325455b24b (patch) | |
| tree | a6db775417364965d2f5f81e4e1c08ba706d80eb | |
| parent | 56581ecfdc1fc6982a03b9575fb66c2821f8aedd (diff) | |
retry
| -rw-r--r-- | xmake/modules/detect/tools/find_gcc.lua | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/xmake/modules/detect/tools/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua index 1a0cf4b78..10e23b797 100644 --- a/xmake/modules/detect/tools/find_gcc.lua +++ b/xmake/modules/detect/tools/find_gcc.lua @@ -26,34 +26,40 @@ import("core.cache.detectcache") -- check gigabyte gcc function _check_gigabyte_gcc(program) -- avoid gcc.exe signed by GIGA-BYTE ref: https://github.com/xmake-io/xmake/issues/5629 - if is_plat("windows", "mingw") and program:lower():endswith("gcc.exe") then - import("core.base.winos") - if winos.file_signature then - local check_signature = function (program) - if os.isfile(program) then - local signer = winos.file_signature(program) - if signer and signer.signer_name and signer.signer_name:startswith("GIGA-BYTE") then - return true + if is_host("windows") then -- is_plat("windows", "mingw") + local is_gigabyte = false + if program:lower():endswith("gcc.exe") then + import("core.base.winos") + if winos.file_signature then + local check_signature = function (program) + if os.isfile(program) then + local signer = winos.file_signature(program) + if signer and signer.signer_name and signer.signer_name:find("GIGA-BYTE", 1, true) then + return true + end end end - end - if path.is_absolute(program) then - if check_signature(program) then - return false - end - else - local paths = path.splitenv(vformat("$(env PATH)")) - for _, p in ipairs(paths) do - local prog = path.join(p, program) - if os.isfile(prog) then - if check_signature(prog) then - return false + if path.is_absolute(program) then + if check_signature(program) then + is_gigabyte = true + end + else + local paths = path.splitenv(vformat("$(env PATH)")) + for _, p in ipairs(paths) do + local prog = path.join(p, program) + if os.isfile(prog) then + if check_signature(prog) then + is_gigabyte = true + end + break end - break end end end end + if is_gigabyte then + return false + end end return true end |
