Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add on_fetch to binutils package #4636

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion packages/b/binutils/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package("binutils")
add_versions("2.41", "ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450")
add_versions("2.38", "e316477a914f567eccc34d5d29785b8b0f5a10208d36bbacedcc39048ecfe024")
add_versions("2.34", "f00b0e8803dc9bab1e2165bd568528135be734df3fabf8d0161828cd56028952")

if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::binutils")
elseif is_plat("linux") then
Expand All @@ -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)
Expand Down
Loading