summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 1073c0a45..8704b3df1 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -642,7 +642,15 @@ end
-- is local package?
-- we will use local installdir and cachedir in current project
function _instance:is_local()
- return self:is_source_embed() or self:is_binary_embed() or self:is_thirdparty()
+ return self._IS_LOCAL or self:is_source_embed() or self:is_binary_embed() or self:is_thirdparty()
+end
+
+-- mark it as local package
+function _instance:_mark_as_local(is_local)
+ if self:is_local() ~= is_local then
+ self._INSTALLDIR = nil
+ self._IS_LOCAL = is_local
+ end
end
-- use external includes?
@@ -1807,6 +1815,23 @@ function _instance:fetch(opt)
external = self:use_external_includes()
end
+ -- always install to the local project directory?
+ -- @see https://github.com/xmake-io/xmake/pull/4376
+ local install_locally
+ if project and project.policy("package.install_locally") then
+ install_locally = true
+ end
+ if install_locally == nil and self:policy("package.install_locally") then
+ install_locally = true
+ end
+ if not self:is_local() and install_locally and system ~= true then
+ local has_global = os.isfile(self:manifest_file())
+ self:_mark_as_local(true)
+ if has_global and not os.isfile(self:manifest_file()) then
+ self:_mark_as_local(false)
+ end
+ end
+
-- fetch binary tool?
fetchinfo = nil
local is_system = nil