summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-03-14 23:19:41 +0800
committerruki <[email protected]>2019-03-14 13:58:10 +0800
commit98673a8aaf92c8cf5c8bddeb49f1c02a69952ac1 (patch)
treea7307436a09cd093a84c81c1038e944fe4f6b0dd /xmake/core/package/package.lua
parentfbf5ca5b9f93713dd2d7017674aebcdd31aaa2aa (diff)
improve package.configs
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua22
1 files changed, 19 insertions, 3 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index e3a6579d6..b81536443 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -433,10 +433,26 @@ end
-- get the configurations of package
function _instance:configs()
- local requireinfo = self:requireinfo()
- if requireinfo then
- return requireinfo.configs
+ local configs = self._CONFIGS
+ if configs == nil then
+ local configs_defined = self:get("configs")
+ if configs_defined then
+ configs = {}
+ local requireinfo = self:requireinfo()
+ local configs_required = requireinfo and requireinfo.configs or {}
+ for _, name in ipairs(table.wrap(configs_defined)) do
+ local value = configs_required[name]
+ if value == nil then
+ value = self:extraconf("configs", name, "default")
+ end
+ configs[name] = value
+ end
+ else
+ configs = false
+ end
+ self._CONFIGS = configs
end
+ return configs and configs or nil
end
-- get the build hash