summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-19 22:39:41 +0800
committerruki <[email protected]>2026-02-19 22:39:41 +0800
commit562cd7187775c7b7184cc7da5fffd0dcc77550d3 (patch)
tree220676c0f290f4649cb99c0c3ce4a03e59db56bd
parenta7e81f8efefb7d1a621d4a47bfa5208a761d7af4 (diff)
fix tmpdir for haiku
-rw-r--r--.github/workflows/haiku.yml1
-rw-r--r--tests/plugins/create/test.lua8
-rw-r--r--xmake/core/base/os.lua17
-rw-r--r--xmake/core/project/config.lua8
4 files changed, 19 insertions, 15 deletions
diff --git a/.github/workflows/haiku.yml b/.github/workflows/haiku.yml
index 136788754..c872b678e 100644
--- a/.github/workflows/haiku.yml
+++ b/.github/workflows/haiku.yml
@@ -75,5 +75,4 @@ jobs:
export XMAKE_ROOT=y
export PATH=`pwd`/dist/bin:$PATH
xrepo --version
- xmake l os.meminfo
xmake lua -v -D tests/run.lua
diff --git a/tests/plugins/create/test.lua b/tests/plugins/create/test.lua
index 397f846f4..7813c3ee2 100644
--- a/tests/plugins/create/test.lua
+++ b/tests/plugins/create/test.lua
@@ -1,11 +1,11 @@
function main ()
os.tryrm("$(tmpdir)/test_create")
os.exec("xmake create -P $(tmpdir)/test_create/test")
- os.exec("xmake -P $(tmpdir)/test_create/test")
+ os.exec("xmake -vD -P $(tmpdir)/test_create/test")
os.exec("xmake create -l c++ -P $(tmpdir)/test_create/test_cpp")
- os.exec("xmake -P $(tmpdir)/test_create/test_cpp")
+ os.exec("xmake -vD -P $(tmpdir)/test_create/test_cpp")
os.exec("xmake create -l c++ -t static -P $(tmpdir)/test_create/test_cpp2")
- os.exec("xmake -P $(tmpdir)/test_create/test_cpp2")
+ os.exec("xmake -vD -P $(tmpdir)/test_create/test_cpp2")
os.exec("xmake create -l c++ -t shared -P $(tmpdir)/test_create/test_cpp3")
- os.exec("xmake -P $(tmpdir)/test_create/test_cpp3")
+ os.exec("xmake -vD -P $(tmpdir)/test_create/test_cpp3")
end
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index d20cd671a..d50ce19f2 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -768,15 +768,24 @@ 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()
+ -- TODO
+ if os.islink(tmpdir_root) then
+ tmpdir_root = os.readlink(tmpdir_root) or tmpdir_root
+ end
+ 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()
+ if os.islink(tmpdir_root) then
+ tmpdir_root = os.readlink(tmpdir_root) or tmpdir_root
+ end
+ os._ROOT_TMPDIR_RAM = tmpdir_root
end
- tmpdir_root = os._ROOT_TMPDIR_RAM
end
-- make sub-directory name
diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua
index 47d9406a8..93c1ff6af 100644
--- a/xmake/core/project/config.lua
+++ b/xmake/core/project/config.lua
@@ -165,13 +165,9 @@ function config.builddir(opt)
builddir = path.absolute(builddir, rootdir)
end
- -- Adjust path for the current directory,
- -- If it's an external directory, use the absolute path directly.
+ -- adjust path for the current directory
if not opt.absolute then
- local relativedir = path.relative(builddir, os.curdir())
- if not relativedir:startswith("..") then
- builddir = relativedir
- end
+ builddir = path.relative(builddir, os.curdir())
end
return builddir
end