package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.5 KiB

function load(package)
package:add("deps", "libcap", "elfutils", "zlib", {host = true})
package:add("deps", "python 3.x", {kind = "binary"})
package:addenv("PATH", "sbin")
end
function install(package)
local cflags = {}
local ldflags = {}
for _, dep in ipairs(package:librarydeps()) do
local fetchinfo = dep:fetch()
if fetchinfo then
for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
table.insert(cflags, "-isystem " .. includedir)
end
for _, linkdir in ipairs(fetchinfo.linkdirs) do
table.insert(ldflags, "-L" .. linkdir)
end
for _, link in ipairs(fetchinfo.links) do
table.insert(ldflags, "-l" .. link)
end
end
end
local configs = {}
table.insert(configs, "EXTRA_CFLAGS=" .. table.concat(cflags, " "))
table.insert(configs, "LDFLAGS=" .. table.concat(ldflags, " "))
os.cd("tools/bpf/bpftool")
io.replace("Makefile", "prefix ?= /usr/local", "prefix ?= " .. package:installdir(), {plain = true})
io.replace("Makefile", "bash_compdir ?= /usr/share", "bash_compdir ?= " .. package:installdir("share"), {plain = true})
io.replace("Makefile", "-lelf -lz", "-lelf -lzstd -lz", {plain = true})
io.replace("Makefile", "$(Q)$(LLVM_STRIP) -g $@", "echo skip", {plain = true})
import("package.tools.make").build(package, configs)
os.vrunv("make", table.join("install", configs))
end
function test(package)
os.vrun("bpftool --version")
end