diff options
| author | ruki <[email protected]> | 2025-11-07 22:59:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-07 22:59:40 +0800 |
| commit | b7899c1574c5108fa5cb629a7b43462d7769c23a (patch) | |
| tree | 7c288f532e873368180ca8a97b00c809961004f5 /xmake/core/package/package.lua | |
| parent | 596e7569d045ac73807b7b673c9bdf1c7490d24e (diff) | |
limit get build envs in package configs
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 80189425d..bf07fa8e8 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -1248,16 +1248,33 @@ function _instance:build_envs(lazy_loading) if build_envs == nil then -- lazy loading the given environment value and cache it build_envs = {} + local builtin_configs = hashset.of("cflags", "cxflags", "cxxflags", "ldflags", "shflags", "asflags") setmetatable(build_envs, { __index = function (tbl, key) + local result = {} local value = config.get(key) if value == nil then value = self:tool(key) end - value = table.unique(table.join(table.wrap(value), table.wrap(self:config(key)), self:toolconfig(key))) - if #value > 0 then - value = table.unwrap(value) - rawset(tbl, key, value) - return value + if value then + table.join2(result, value) + end + -- we can only get the builtin config values + -- https://github.com/xmake-io/xmake/issues/6897 + if builtin_configs:has(key) then + value = self:config(key) + if value then + table.join2(result, value) + end + end + value = self:toolconfig(key) + if value then + table.join2(result, value) + end + result = table.unique(result) + if #result > 0 then + result = table.unwrap(result) + rawset(tbl, key, result) + return result end return rawget(tbl, key) end}) |
