summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-08-20 23:58:35 +0800
committerruki <[email protected]>2026-08-20 23:58:35 +0800
commit0597f61b9feffd5b4b59f9329419649e025f7177 (patch)
treee43bcd018aea88b1a7fe3d5b4fe70fa6159c8645
parentde769d5574d92a37253d16b9617d998605bfd727 (diff)
add host install locally policy
-rw-r--r--xmake/core/package/package.lua10
-rw-r--r--xmake/core/project/policy.lua6
2 files changed, 14 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 2d2720fba..ca5d84204 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2117,11 +2117,17 @@ function _instance:fetch(opt)
-- always install to the local project directory?
-- @see https://github.com/xmake-io/xmake/pull/4376
+ --
+ -- @note the host packages are the tools which build the other packages, e.g. the toolchains,
+ -- they do not depend on the project configuration and they are shared between the projects,
+ -- so they are only installed locally with their own policy
+ -- @see https://github.com/xmake-io/xmake/issues/7716
+ local policyname = self:is_host() and "package.host.install_locally" or "package.install_locally"
local install_locally
- if project and project.policy("package.install_locally") then
+ if project and project.policy(policyname) then
install_locally = true
end
- if install_locally == nil and self:policy("package.install_locally") then
+ if install_locally == nil and self:policy(policyname) then
install_locally = true
end
if not self:is_local() and install_locally and system ~= true then
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 617a792d6..81a8b6924 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -158,6 +158,12 @@ function policy.policies()
["package.install_always"] = {description = "Always install packages every time.", type = "boolean"},
-- Install packages in the local project folder
["package.install_locally"] = {description = "Install packages in the local project folder.", default = false, type = "boolean"},
+ -- Install the host packages in the local project folder
+ --
+ -- the host packages are the tools which build the other packages, e.g. the toolchains,
+ -- they do not depend on the project configuration and they are shared between the projects,
+ -- so they have their own policy, @see https://github.com/xmake-io/xmake/issues/7716
+ ["package.host.install_locally"] = {description = "Install the host packages in the local project folder.", default = false, type = "boolean"},
-- Keep package source code after installing (disable source dir cleanup)
["package.keep_source"] = {description = "Keep package source code after installing.", default = false, type = "boolean"},
-- Set custom headers when downloading package