add on_fetch to binutils package (#4636)

* add on_fetch to binutils package

* Update xmake.lua

* Update xmake.lua

* check more tools in binutil's on_fetch

* fix boolean operator

---------

Co-authored-by: ruki <waruqi@gmail.com>
pull/4664/head
Enzo Einhorn 7 months ago committed by GitHub
parent de97c7eb65
commit 2a2247530b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 25
      packages/b/binutils/xmake.lua

@ -19,6 +19,31 @@ package("binutils")
add_extsources("brew::binutils")
end
on_fetch("@linux", "@macosx", "@msys", function (package, opt)
if opt.system then
if package:is_binary() then
local tools = {"lb", "ranlib", "objcopy"}
for _, tool in ipairs(tools) do
if not package:find_tool(tool) then
return
end
end
return {}
elseif package:is_library() then
local libs = {"bfd", "ctf", "opcodes"}
local result
for _, lib in ipairs(libs) do
local libinfo = package:find_package("system::" .. lib)
if libinfo then
result = result or {links = {}}
table.insert(result.links, libinfo.links)
end
end
return result
end
end
end)
add_deps("bison")
on_install("@linux", "@macosx", "@msys", function (package)

Loading…
Cancel
Save