summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-06 22:39:02 +0800
committerruki <[email protected]>2025-08-06 22:39:02 +0800
commit5ad9382acadf3a5d9e6cbe29ba408847b45148a1 (patch)
tree4026d5d33f381df100c5e500b493d70c1d91a611
parent944e912fd2c9c0e2806649f95ed77de522a89309 (diff)
attempt to fix linkgroups in package
-rw-r--r--xmake/core/package/package.lua2
-rw-r--r--xmake/core/project/project.lua2
-rw-r--r--xmake/core/tool/builder.lua21
3 files changed, 23 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 29499663b..3caa0ac2f 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -2160,7 +2160,7 @@ function _instance:fetch_librarydeps()
if not fetchinfo then
return
end
- fetchinfo = table.copy(fetchinfo) -- avoid the cached fetchinfo be modified
+ fetchinfo = table.clone(fetchinfo, 3) -- avoid the cached fetchinfo be modified
local librarydeps = self:librarydeps()
if librarydeps then
for _, dep in ipairs(librarydeps) do
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 86050ebec..cbcf8843d 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -566,6 +566,8 @@ function project._load_requires()
local info = {__requirestr = requirestr, __requireconfs = requireconfs}
instance = project_package.load_withinfo(name, info)
end
+ print(instance:name())
+ instance:dump()
-- add require info
requires[name] = instance
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 920897576..8336c8d71 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -475,6 +475,7 @@ function builder:_add_flags_from_language(flags, opt)
self:_add_items_from_toolchain(items, flagname, opt_)
end
end
+
end
-- sort links
@@ -579,6 +580,10 @@ function builder:_sort_links_of_items(items, opt)
linkitems = table.reverse(linkitems)
for _, item in ipairs(linkitems) do
local name = item.name
+ if item.name == "linkgroups" then
+ utils.dump(item)
+ end
+
for _, value in ipairs(item.values) do
if name == "links" or name == "syslinks" then
if not linkgroups_set:has(value) then
@@ -591,14 +596,28 @@ function builder:_sort_links_of_items(items, opt)
local extra = self:_extraconf(extras, value)
local key = extra and extra.name or tostring(value)
table.insert(links, "linkgroup::" .. key)
- linkgroups_map[key] = value
extras_map[key] = extras
+ local oldvalue = linkgroups_map[key]
+ if oldvalue == nil then
+ linkgroups_map[key] = value
+ else
+ local oldvalue_wrap_unlock = table.clone(oldvalue)
+ table.wrap_unlock(oldvalue_wrap_unlock)
+ local value_wrap_unlock = table.clone(value)
+ table.wrap_unlock(value_wrap_unlock)
+ local newvalue = table.join(oldvalue_wrap_unlock, value_wrap_unlock)
+ table.wrap_lock(newvalue)
+ linkgroups_map[key] = newvalue
+ end
+ print(key, string.serialize(linkgroups_map[key]))
+ print(key, string.serialize(extras))
end
end
end
links = table.reverse_unique(links)
end
+ utils.dump(linkgroups_map)
-- sort sublinks
if sortlinks then