summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-11-22 23:07:42 +0800
committerruki <[email protected]>2024-11-22 23:07:42 +0800
commit6be0e0d88c4bcf3f045a3a499dce8bbd66eb6197 (patch)
tree2ce4e450fdb16bfb0d898363037df1ff4fed92d8
parent9b75cbbca9898bf38651bef1feb8caaaf56aaf7d (diff)
fix package linkgroups #5806
-rw-r--r--xmake/core/project/package.lua31
-rw-r--r--xmake/modules/private/action/require/impl/register_packages.lua1
2 files changed, 29 insertions, 3 deletions
diff --git a/xmake/core/project/package.lua b/xmake/core/project/package.lua
index c253ee0a2..70f89a1f8 100644
--- a/xmake/core/project/package.lua
+++ b/xmake/core/project/package.lua
@@ -216,6 +216,24 @@ function _instance:extraconf(name, item, key)
return value
end
+-- add extra configuration
+function _instance:extraconf_add(name, item)
+ local extraconfs = self:get("extras")
+ if not extraconfs then
+ extraconfs = {}
+ end
+
+ local extraconf = extraconfs[name]
+ if extraconf ~= nil then
+ extraconf = table.wrap(extraconf)
+ table.join2(extraconf, item)
+ else
+ extraconf = item
+ end
+ extraconfs[name] = extraconf
+ self:set("extras", extraconfs)
+end
+
-- get order dependencies of the given component
function _instance:component_orderdeps(name)
local component_orderdeps = self._COMPONENT_ORDERDEPS
@@ -252,8 +270,17 @@ end
-- add the value to the requires info
function _instance:add(name_or_info, ...)
if type(name_or_info) == "string" then
- local info = table.wrap(self._INFO[name_or_info])
- self._INFO[name_or_info] = table.unwrap(table.unique(table.join(info, ...)))
+ local name = name_or_info
+ if name == "extras" then
+ for _, extraconf in ipairs({...}) do
+ for k, v in pairs(extraconf) do
+ self:extraconf_add(k, v)
+ end
+ end
+ else
+ local info = table.wrap(self._INFO[name])
+ self._INFO[name] = table.unwrap(table.unique(table.join(info, ...)))
+ end
elseif table.is_dictionary(name_or_info) then
for name, info in pairs(table.join(name_or_info, ...)) do
self:add(name, info)
diff --git a/xmake/modules/private/action/require/impl/register_packages.lua b/xmake/modules/private/action/require/impl/register_packages.lua
index 621e383d1..ed6079f29 100644
--- a/xmake/modules/private/action/require/impl/register_packages.lua
+++ b/xmake/modules/private/action/require/impl/register_packages.lua
@@ -51,7 +51,6 @@ function _register_required_package_libs(instance, required_package, is_deps)
fetchinfo.static = nil
fetchinfo.shared = nil
fetchinfo.installdir = nil
- fetchinfo.extras = nil
fetchinfo.components = nil
end