diff options
| author | Saikari <[email protected]> | 2026-02-20 01:02:05 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-20 01:02:05 +0300 |
| commit | bff076bc40ff224aad1f6a1b0c6c978e7d6b7313 (patch) | |
| tree | 542441bb1ea8b829478a8eb8e00f324db7013c72 | |
| parent | b065878db47435b7ebfa9f29020c927b4eff8f7e (diff) | |
| parent | 23c62e6d3d3b91133221abe4946a5aacc298a836 (diff) | |
Merge branch 'xmake-io:dev' into sign
34 files changed, 150 insertions, 61 deletions
diff --git a/.github/workflows/alpine.yml b/.github/workflows/alpine.yml index 5bce09441..ba6d3552c 100644 --- a/.github/workflows/alpine.yml +++ b/.github/workflows/alpine.yml @@ -63,8 +63,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: Alpine-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Alpine + cancel-in-progress: true steps: - name: Prepare build tools run: | @@ -88,4 +88,3 @@ jobs: run: | xmake lua -v -D tests/run.lua xrepo --version - diff --git a/.github/workflows/archlinux.yml b/.github/workflows/archlinux.yml index 7ee73fe47..03118bbb8 100644 --- a/.github/workflows/archlinux.yml +++ b/.github/workflows/archlinux.yml @@ -19,17 +19,17 @@ jobs: script: | const fs = require('fs'); const outputFile = process.env.GITHUB_OUTPUT; - + // Always run for release events if (context.eventName === 'release') { fs.appendFileSync(outputFile, `should-run=true\n`); core.info('Release event detected. Will run tests.'); return; } - + // Execution probability (default 20%, can be overridden via env) const probability = parseFloat(process.env.RUN_PROBABILITY || '0.2'); - + // Generate deterministic "random" number based on commit SHA, run ID, and current time // Adding time ensures better randomness while keeping same commit/run consistent const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); // Round to hour for consistency @@ -43,7 +43,7 @@ jobs: // Normalize to 0-1 range const random = Math.abs(hash) / 2147483647; const shouldRun = random < probability; - + // Use environment file instead of deprecated set-output fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); if (shouldRun) { @@ -63,8 +63,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: Archlinux-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Archlinux + cancel-in-progress: true steps: - name: Prepare build tools run: | @@ -90,4 +90,3 @@ jobs: run: | xmake lua -v -D tests/run.lua xrepo --version - diff --git a/.github/workflows/dragonflybsd.yml b/.github/workflows/dragonflybsd.yml index b65a22a88..41be4d83e 100644 --- a/.github/workflows/dragonflybsd.yml +++ b/.github/workflows/dragonflybsd.yml @@ -61,8 +61,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: DragonflyBSD-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-DragonflyBSD + cancel-in-progress: true steps: - uses: actions/checkout@v2 with: @@ -84,4 +84,3 @@ jobs: xrepo --version xmake l os.meminfo xmake lua -v -D tests/run.lua - diff --git a/.github/workflows/fedora.yml b/.github/workflows/fedora.yml index 1b0ec0304..5666ce932 100644 --- a/.github/workflows/fedora.yml +++ b/.github/workflows/fedora.yml @@ -63,8 +63,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: Fedora-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Fedora + cancel-in-progress: true steps: - name: Prepare build tools run: | @@ -90,4 +90,3 @@ jobs: run: | xmake lua -v -D tests/run.lua xrepo --version - diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 92b91c84e..4f86f346c 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -19,17 +19,17 @@ jobs: script: | const fs = require('fs'); const outputFile = process.env.GITHUB_OUTPUT; - + // Always run for release events if (context.eventName === 'release') { fs.appendFileSync(outputFile, `should-run=true\n`); core.info('Release event detected. Will run tests.'); return; } - + // Execution probability (default 50%, can be overridden via env) const probability = parseFloat(process.env.RUN_PROBABILITY || '0.5'); - + // Generate deterministic "random" number based on commit SHA, run ID, and current time // Adding time ensures better randomness while keeping same commit/run consistent const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); // Round to hour for consistency @@ -43,7 +43,7 @@ jobs: // Normalize to 0-1 range const random = Math.abs(hash) / 2147483647; const shouldRun = random < probability; - + // Use environment file instead of deprecated set-output fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); if (shouldRun) { diff --git a/.github/workflows/haiku.yml b/.github/workflows/haiku.yml new file mode 100644 index 000000000..34e51392b --- /dev/null +++ b/.github/workflows/haiku.yml @@ -0,0 +1,78 @@ +name: Haiku + +on: + pull_request: + push: + release: + types: [published] + +jobs: + check: + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.check.outputs.should-run }} + steps: + - name: Random execution check + id: check + uses: actions/github-script@v7 + with: + script: | + const fs = require('fs'); + const outputFile = process.env.GITHUB_OUTPUT; + + if (context.eventName === 'release') { + fs.appendFileSync(outputFile, `should-run=true\n`); + core.info('Release event detected. Will run tests.'); + return; + } + + const probability = parseFloat(process.env.RUN_PROBABILITY || '0.2'); + const timeSeed = Math.floor(Date.now() / (1000 * 60 * 60)); + const seed = context.sha + context.runId + timeSeed; + let hash = 0; + for (let i = 0; i < seed.length; i++) { + const char = seed.charCodeAt(i); + hash = ((hash << 5) - hash) + char; + hash = hash | 0; + } + const random = Math.abs(hash) / 2147483647; + const shouldRun = random < probability; + + fs.appendFileSync(outputFile, `should-run=${shouldRun}\n`); + if (shouldRun) { + core.info(`Random check passed (${(random * 100).toFixed(2)}% < ${(probability * 100).toFixed(0)}%). Will run tests.`); + } else { + core.info(`Random check failed (${(random * 100).toFixed(2)}% >= ${(probability * 100).toFixed(0)}%). Skipping.`); + } + env: + RUN_PROBABILITY: ${{ vars.HAIKU_RUN_PROBABILITY || '0.2' }} + + build: + needs: check + if: needs.check.outputs.should-run == 'true' + runs-on: ubuntu-latest + + concurrency: + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Haiku + cancel-in-progress: true + steps: + - uses: actions/checkout@v2 + with: + submodules: true + + - name: Tests + uses: vmactions/haiku-vm@v1 + with: + usesh: true + mem: 4096 + copyback: false + prepare: | + pkgman install -y git curl unzip make bash perl + run: | + ./configure --prefix=`pwd`/dist + make -j2 + make install + export XMAKE_ROOT=y + export PATH=`pwd`/dist/bin:$PATH + xrepo --version + xmake lua -v -D tests/run.lua diff --git a/.github/workflows/linux_luajit.yml b/.github/workflows/linux_luajit.yml index 36c519245..ccbb96f59 100644 --- a/.github/workflows/linux_luajit.yml +++ b/.github/workflows/linux_luajit.yml @@ -60,8 +60,8 @@ jobs: runs-on: ubuntu-latest concurrency: # Prevent concurrent runs of the same workflow - group: Linux-Luajit-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-Linux-Luajit + cancel-in-progress: true steps: - uses: actions/checkout@v2 with: @@ -90,4 +90,3 @@ jobs: run: | xmake lua -v -D tests/run.lua xrepo --version - diff --git a/.github/workflows/netbsd.yml b/.github/workflows/netbsd.yml index bf704048f..f216f8992 100644 --- a/.github/workflows/netbsd.yml +++ b/.github/workflows/netbsd.yml @@ -61,8 +61,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: NetBSD-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-NetBSD + cancel-in-progress: true steps: - uses: actions/checkout@v2 with: @@ -85,4 +85,3 @@ jobs: xrepo --version xmake l os.meminfo xmake lua -v -D tests/run.lua - diff --git a/.github/workflows/openbsd.yml b/.github/workflows/openbsd.yml index 1e3cc912a..8c74bdaf1 100644 --- a/.github/workflows/openbsd.yml +++ b/.github/workflows/openbsd.yml @@ -61,8 +61,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: OpenBSD-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-OpenBSD + cancel-in-progress: true steps: - uses: actions/checkout@v2 with: @@ -85,4 +85,3 @@ jobs: xrepo --version xmake l os.meminfo xmake lua -v -D tests/run.lua - diff --git a/.github/workflows/windows_luajit.yml b/.github/workflows/windows_luajit.yml index c86d5e0b5..7a26cabaa 100644 --- a/.github/workflows/windows_luajit.yml +++ b/.github/workflows/windows_luajit.yml @@ -66,8 +66,8 @@ jobs: concurrency: # Prevent concurrent runs of the same workflow - group: Windows-Luajit-${{ github.event.repository.owner.login }}-${{ github.event.repository.name }}-${{ matrix.os }}-${{ matrix.arch }} - cancel-in-progress: false + group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-Windows-Luajit + cancel-in-progress: true steps: - uses: actions/checkout@v2 with: diff --git a/core/src/tbox/inc/haiku/tbox.config.h b/core/src/tbox/inc/haiku/tbox.config.h index 8a9e72ad8..dc61fce45 100644 --- a/core/src/tbox/inc/haiku/tbox.config.h +++ b/core/src/tbox/inc/haiku/tbox.config.h @@ -16,7 +16,7 @@ /*#undef TB_CONFIG_MICRO_ENABLE*/ /*#undef TB_CONFIG_TYPE_HAVE_WCHAR*/ #define TB_CONFIG_TYPE_HAVE_FLOAT 1 -/*#undef TB_CONFIG_FORCE_UTF8*/ +#define TB_CONFIG_FORCE_UTF8 1 /*#undef TB_CONFIG_API_HAVE_DEPRECATED*/ /*#undef TB_CONFIG_EXCEPTION_ENABLE*/ diff --git a/core/src/tbox/inc/iphoneos/tbox.config.h b/core/src/tbox/inc/iphoneos/tbox.config.h index 290786a50..43aa10c8b 100755 --- a/core/src/tbox/inc/iphoneos/tbox.config.h +++ b/core/src/tbox/inc/iphoneos/tbox.config.h @@ -16,7 +16,7 @@ /* #undef TB_CONFIG_MICRO_ENABLE */ /* #undef TB_CONFIG_TYPE_HAVE_WCHAR */ #define TB_CONFIG_TYPE_HAVE_FLOAT 1 -/* #undef TB_CONFIG_FORCE_UTF8 */ +#define TB_CONFIG_FORCE_UTF8 1 /* #undef TB_CONFIG_API_HAVE_DEPRECATED */ /* #undef TB_CONFIG_EXCEPTION_ENABLE */ diff --git a/core/src/tbox/inc/solaris/tbox.config.h b/core/src/tbox/inc/solaris/tbox.config.h index 89bce47bc..25bafd9f6 100644 --- a/core/src/tbox/inc/solaris/tbox.config.h +++ b/core/src/tbox/inc/solaris/tbox.config.h @@ -16,7 +16,7 @@ /*#undef TB_CONFIG_MICRO_ENABLE*/ /*#undef TB_CONFIG_TYPE_HAVE_WCHAR*/ #define TB_CONFIG_TYPE_HAVE_FLOAT 1 -/*#undef TB_CONFIG_FORCE_UTF8*/ +#define TB_CONFIG_FORCE_UTF8 1 /*#undef TB_CONFIG_API_HAVE_DEPRECATED*/ /*#undef TB_CONFIG_EXCEPTION_ENABLE*/ diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox -Subproject ef851bcb6589b6092f5bd3fca4625631237f9bd +Subproject de475fef05346a7603efea54d77afead7a16dac diff --git a/tests/actions/package/localpkg/test.lua b/tests/actions/package/localpkg/test.lua index b3b3106ff..cd8e6f75e 100644 --- a/tests/actions/package/localpkg/test.lua +++ b/tests/actions/package/localpkg/test.lua @@ -1,5 +1,5 @@ function main(t) - if (os.subarch():startswith("x") or os.subarch() == "i386") and not is_host("bsd", "solaris") then + if (os.subarch():startswith("x") or os.subarch() == "i386") and not is_host("bsd", "solaris", "haiku") then os.cd("libfoo") os.exec("xmake package -D -o ../bar/build") os.cd("../bar") diff --git a/tests/apis/namespace/package/test.lua b/tests/apis/namespace/package/test.lua index 7b7dabeff..dc9b6d9ab 100644 --- a/tests/apis/namespace/package/test.lua +++ b/tests/apis/namespace/package/test.lua @@ -1,5 +1,5 @@ function main() - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end os.exec("xmake -vD -y") 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/tests/projects/c++/linkorders/test.lua b/tests/projects/c++/linkorders/test.lua index 39898ef97..7728aa73a 100644 --- a/tests/projects/c++/linkorders/test.lua +++ b/tests/projects/c++/linkorders/test.lua @@ -1,7 +1,7 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end @@ -10,4 +10,3 @@ function main(t) t:build() end end - diff --git a/tests/projects/c++/snippet_runtimes/test.lua b/tests/projects/c++/snippet_runtimes/test.lua index e06f405f7..c20ec10ff 100644 --- a/tests/projects/c++/snippet_runtimes/test.lua +++ b/tests/projects/c++/snippet_runtimes/test.lua @@ -12,7 +12,7 @@ end function main(t) local clang = find_tool("clang") - if clang and not is_subhost("windows") and not is_subhost("bsd", "solaris") then + if clang and not is_subhost("windows") and not is_subhost("bsd", "solaris", "haiku") then os.exec("xmake f --toolchain=clang --runtimes=c++_shared --yes") _build() end diff --git a/tests/projects/c/library_with_cmakelists/test.lua b/tests/projects/c/library_with_cmakelists/test.lua index 53b02d24c..585571628 100644 --- a/tests/projects/c/library_with_cmakelists/test.lua +++ b/tests/projects/c/library_with_cmakelists/test.lua @@ -2,7 +2,7 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end diff --git a/tests/projects/package/basic/test.lua b/tests/projects/package/basic/test.lua index 65d2f2335..7728aa73a 100644 --- a/tests/projects/package/basic/test.lua +++ b/tests/projects/package/basic/test.lua @@ -1,7 +1,7 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end diff --git a/tests/projects/package/compatibility/deps_with_version/test.lua b/tests/projects/package/compatibility/deps_with_version/test.lua index b9f43bad5..f8321b2f7 100644 --- a/tests/projects/package/compatibility/deps_with_version/test.lua +++ b/tests/projects/package/compatibility/deps_with_version/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips diff --git a/tests/projects/package/compatibility/sync_requires_to_deps/test.lua b/tests/projects/package/compatibility/sync_requires_to_deps/test.lua index b9f43bad5..f8321b2f7 100644 --- a/tests/projects/package/compatibility/sync_requires_to_deps/test.lua +++ b/tests/projects/package/compatibility/sync_requires_to_deps/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips diff --git a/tests/projects/package/components/test.lua b/tests/projects/package/components/test.lua index a7e71bb89..f1634e485 100644 --- a/tests/projects/package/components/test.lua +++ b/tests/projects/package/components/test.lua @@ -1,5 +1,5 @@ function main(t) - if is_host("bsd", "solaris") or is_subhost("msys") then + if is_host("bsd", "solaris", "haiku") or is_subhost("msys") then return end if is_host("linux") and linuxos.name() == "alpine" then diff --git a/tests/projects/package/depconfigs/test.lua b/tests/projects/package/depconfigs/test.lua index b9f43bad5..f8321b2f7 100644 --- a/tests/projects/package/depconfigs/test.lua +++ b/tests/projects/package/depconfigs/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips diff --git a/tests/projects/package/inherit_base/test.lua b/tests/projects/package/inherit_base/test.lua index b9f43bad5..f8321b2f7 100644 --- a/tests/projects/package/inherit_base/test.lua +++ b/tests/projects/package/inherit_base/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips diff --git a/tests/projects/package/multiconfig/test.lua b/tests/projects/package/multiconfig/test.lua index b9f43bad5..f8321b2f7 100644 --- a/tests/projects/package/multiconfig/test.lua +++ b/tests/projects/package/multiconfig/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips diff --git a/tests/projects/package/package_rule/test.lua b/tests/projects/package/package_rule/test.lua index 65d2f2335..7728aa73a 100644 --- a/tests/projects/package/package_rule/test.lua +++ b/tests/projects/package/package_rule/test.lua @@ -1,7 +1,7 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end diff --git a/tests/projects/package/requires_lock/test.lua b/tests/projects/package/requires_lock/test.lua index 213b1ba60..40c0ebf98 100644 --- a/tests/projects/package/requires_lock/test.lua +++ b/tests/projects/package/requires_lock/test.lua @@ -172,7 +172,7 @@ end function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end diff --git a/tests/projects/package/rootconfigs/test.lua b/tests/projects/package/rootconfigs/test.lua index d98f3385f..ed5c87486 100644 --- a/tests/projects/package/rootconfigs/test.lua +++ b/tests/projects/package/rootconfigs/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end -- only for x86/x64, because it will take too long time on ci with arm/mips diff --git a/tests/projects/package/schemes/test.lua b/tests/projects/package/schemes/test.lua index 4c7bad3c2..0c31b696f 100644 --- a/tests/projects/package/schemes/test.lua +++ b/tests/projects/package/schemes/test.lua @@ -1,6 +1,6 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end diff --git a/tests/projects/package/toolchain_muslcc/test.lua b/tests/projects/package/toolchain_muslcc/test.lua index 65d2f2335..7728aa73a 100644 --- a/tests/projects/package/toolchain_muslcc/test.lua +++ b/tests/projects/package/toolchain_muslcc/test.lua @@ -1,7 +1,7 @@ function main(t) -- freebsd ci is slower - if is_host("bsd", "solaris") then + if is_host("bsd", "solaris", "haiku") then return end diff --git a/tests/projects/package/toolchain_muslcc/xmake.lua b/tests/projects/package/toolchain_muslcc/xmake.lua index 6c5e8f8b3..0f63fb0d6 100644 --- a/tests/projects/package/toolchain_muslcc/xmake.lua +++ b/tests/projects/package/toolchain_muslcc/xmake.lua @@ -25,7 +25,7 @@ toolchain_end() -- add library packages -- for testing zlib/xmake, libplist/autoconf, libogg/cmake add_requires("zlib", "libogg", {system = false}) -if is_host("macosx", "linux", "bsd", "solaris") then +if is_host("macosx", "linux", "bsd", "solaris", "haiku") then add_requires("libplist", {system = false}) 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 |
