summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-02-23 18:01:38 +0300
committerGitHub <[email protected]>2026-02-23 18:01:38 +0300
commit3cf862ee32ea653871d4069b56b619a8cf477e38 (patch)
tree7ce15c80dc1fa5cbb894e797f0871fd0065e31f1 /xmake
parent8ed3f12c86b74cb46e110e56c2ed20d88b242cee (diff)
parentea307e0b88527bc61864766c16dfd346470b2d80 (diff)
Merge branch 'xmake-io:dev' into em
Diffstat (limited to 'xmake')
-rw-r--r--xmake/actions/run/main.lua26
-rw-r--r--xmake/core/base/os.lua27
-rw-r--r--xmake/core/sandbox/modules/import/lib/detect/find_program.lua2
-rw-r--r--xmake/core/sandbox/modules/winos.lua1
-rw-r--r--xmake/modules/detect/tools/find_gcc.lua33
-rw-r--r--xmake/modules/private/action/trybuild/cmake.lua4
-rw-r--r--xmake/rules/qt/deploy/macosx.lua5
7 files changed, 89 insertions, 9 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 6ed59f3f1..effa362e5 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -33,6 +33,24 @@ import("private.detect.check_targetname")
import("lib.detect.find_tool")
import("private.action.utils", {alias = "action_utils"})
+function _run_wasi_target(targetfile, args, opt)
+ opt = opt or {}
+ local rundir = opt.rundir
+ local addenvs = opt.addenvs
+ local setenvs = opt.setenvs
+ local wasmtime = find_tool("wasmtime")
+ if wasmtime then
+ local runargs = {targetfile}
+ if args and #args > 0 then
+ table.join2(runargs, args)
+ end
+ os.execv(wasmtime.program, runargs, {
+ curdir = rundir, detach = option.get("detach"), addenvs = addenvs, setenvs = setenvs})
+ else
+ raise("wasmtime not found, which is required for running wasi target!")
+ end
+end
+
function _run_wasm_target_in_browser(targetfile, opt)
opt = opt or {}
local rundir = opt.rundir
@@ -75,9 +93,13 @@ function _do_run_target(target)
-- get run arguments
local args = table.wrap(option.get("arguments") or target:get("runargs"))
- -- run wasm target in browser
+ -- run wasm target
if target:is_plat("wasm") then
- _run_wasm_target_in_browser(targetfile, {rundir = rundir, addenvs = addenvs, setenvs = setenvs})
+ if target:has_tool("cc", "emcc") then
+ _run_wasm_target_in_browser(targetfile, {rundir = rundir, addenvs = addenvs, setenvs = setenvs})
+ else
+ _run_wasi_target(targetfile, args, {rundir = rundir, addenvs = addenvs, setenvs = setenvs})
+ end
return
end
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index d20cd671a..1766d28f5 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -200,6 +200,21 @@ function os._ramdir()
return ramdir_root or nil
end
+-- if tmpdir_root is a symbolic link, os.tmpdir() may return a path that differs
+-- from the path style returned by os.curdir() (e.g. on Haiku).
+--
+-- Using a consistent root path can avoid errors in relative path resolution.
+--
+-- e.g.
+-- tmpdir: /tmp/.xmake0/260217/ -> /boot/system/cache/tmp/.xmake0/260217
+-- curdir: /boot/system/cache/tmp/.xmake0/260217
+function os._resolve_tmpdir(tmpdir_root)
+ if os.islink(tmpdir_root) then
+ tmpdir_root = os.readlink(tmpdir_root) or tmpdir_root
+ end
+ return tmpdir_root
+end
+
-- set on change environments callback for scheduler
function os._sched_chenvs_set(envs)
os._SCHED_CHENVS = envs
@@ -768,15 +783,19 @@ function os.tmpdir(opt)
-- get root tmpdir
local tmpdir_root = nil
if opt and opt.ramdisk == false then
+ tmpdir_root = os._ROOT_TMPDIR
if os._ROOT_TMPDIR == nil then
- os._ROOT_TMPDIR = (os.getenv("XMAKE_TMPDIR") or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ tmpdir_root = (os.getenv("XMAKE_TMPDIR") or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ tmpdir_root = os._resolve_tmpdir(tmpdir_root)
+ os._ROOT_TMPDIR = tmpdir_root
end
- tmpdir_root = os._ROOT_TMPDIR
else
+ tmpdir_root = os._ROOT_TMPDIR_RAM
if os._ROOT_TMPDIR_RAM == nil then
- os._ROOT_TMPDIR_RAM = (os.getenv("XMAKE_TMPDIR") or os._ramdir() or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ tmpdir_root = (os.getenv("XMAKE_TMPDIR") or os._ramdir() or os.getenv("TMPDIR") or os._tmpdir()):trim()
+ tmpdir_root = os._resolve_tmpdir(tmpdir_root)
+ os._ROOT_TMPDIR_RAM = tmpdir_root
end
- tmpdir_root = os._ROOT_TMPDIR_RAM
end
-- make sub-directory name
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 858b413e8..288a9089e 100644
--- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
+++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua
@@ -24,7 +24,7 @@ local sandbox_lib_detect_find_program = sandbox_lib_detect_find_program or {}
-- load modules
local os = require("base/os")
local path = require("base/path")
-local option = require("base/winos")
+local winos = require("base/winos")
local table = require("base/table")
local utils = require("base/utils")
local option = require("base/option")
diff --git a/xmake/core/sandbox/modules/winos.lua b/xmake/core/sandbox/modules/winos.lua
index 2ed01245d..0466e746b 100644
--- a/xmake/core/sandbox/modules/winos.lua
+++ b/xmake/core/sandbox/modules/winos.lua
@@ -36,6 +36,7 @@ sandbox_winos.cmdargv = winos.cmdargv
sandbox_winos.processes = winos.processes
sandbox_winos.inherit_handles_safely = winos.inherit_handles_safely
sandbox_winos.set_error_mode = winos.set_error_mode
+sandbox_winos.file_signature = winos.file_signature
-- get windows system version
function sandbox_winos.version()
diff --git a/xmake/modules/detect/tools/find_gcc.lua b/xmake/modules/detect/tools/find_gcc.lua
index b8c7b71a5..d658ca1ff 100644
--- a/xmake/modules/detect/tools/find_gcc.lua
+++ b/xmake/modules/detect/tools/find_gcc.lua
@@ -23,6 +23,33 @@ import("lib.detect.find_program")
import("lib.detect.find_programver")
import("core.cache.detectcache")
+-- check gcc/gigabyte signature
+function check_gcc_gigabyte(program)
+ if os.isfile(program) then
+ local signer = nil
+ if winos.file_signature then
+ signer = winos.file_signature(program)
+ end
+ if signer and signer.signer_name then
+ local signer_name = signer.signer_name:upper()
+ if signer_name:find("GIGA-BYTE", 1, true) then
+ return true
+ end
+ end
+ end
+end
+
+-- check gigabyte gcc
+-- avoid gcc.exe signed by GIGA-BYTE
+-- @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!")
+ end
+ return os.runv(program, {"--version"}, {envs = opt.envs, shell = opt.shell})
+end
+
-- detect whether the current gcc compiler is clang
function check_clang(program, opt)
local is_clang = false
@@ -53,7 +80,11 @@ end
--
function main(opt)
opt = opt or {}
- opt.norunfile = true
+ if is_host("windows") then
+ opt.check = _check_gcc_on_windows
+ else
+ opt.norunfile = true
+ end
local program = find_program(opt.program or "gcc", opt)
local version = nil
if program and opt.version then
diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua
index c5b807fb9..4243a7ce8 100644
--- a/xmake/modules/private/action/trybuild/cmake.lua
+++ b/xmake/modules/private/action/trybuild/cmake.lua
@@ -281,6 +281,10 @@ end
-- get configs for wasm
function _get_configs_for_wasm(configs)
+ if config.get("toolchain") == "wasi" then
+ _get_configs_for_cross(configs)
+ return
+ end
local emsdk = find_emsdk()
assert(emsdk and emsdk.emscripten, "emscripten not found!")
local emscripten_cmakefile = find_file("Emscripten.cmake", path.join(emsdk.emscripten, "cmake/Modules/Platform"))
diff --git a/xmake/rules/qt/deploy/macosx.lua b/xmake/rules/qt/deploy/macosx.lua
index deeafb11f..ac26bbd7d 100644
--- a/xmake/rules/qt/deploy/macosx.lua
+++ b/xmake/rules/qt/deploy/macosx.lua
@@ -166,7 +166,10 @@ function main(target, opt)
end
-- do deploy
- local argv = {target_app, "-always-overwrite"}
+ local argv = {target_app}
+ if target:is_rebuilt() then
+ table.insert(argv, "-always-overwrite")
+ end
if option.get("diagnosis") then
table.insert(argv, "-verbose=3")
elseif option.get("verbose") then