Bläddra i källkod

improve linux

ruki 4 år sedan
förälder
incheckning
de51f5ab64

+ 1 - 3
packages/l/linux-tools/modules/bpftool.lua

@@ -1,12 +1,10 @@
 function load(package)
-    package:add("deps", "libcap", "libelf", "zlib")
+    package:add("deps", "libcap", "libelf", "zlib", {host = true})
     package:addenv("PATH", "sbin")
 end
 
 function install(package)
 
-    assert(package:is_plat("linux"), "bpftool: only support for linux!")
-
     local cflags = {}
     local ldflags = {}
     for _, dep in ipairs(package:orderdeps()) do

+ 0 - 10
packages/l/linux-tools/modules/headers.lua

@@ -1,10 +0,0 @@
-function load(package)
-end
-
-function install(package)
-    os.vrunv("make", {"headers_install", "INSTALL_HDR_PATH=" .. package:installdir()})
-end
-
-function test(package)
-    assert(package:has_cincludes("linux/version.h"))
-end

+ 0 - 31
packages/l/linux-tools/modules/libbpf.lua

@@ -1,31 +0,0 @@
-function load(package)
-    package:add("deps", "libelf", "zlib")
-end
-
-function install(package)
-    os.cd("tools/lib/bpf")
-    io.writefile("xmake.lua", [[
-        add_rules("mode.debug", "mode.release")
-        add_requires("libelf", "zlib")
-        target("bpf")
-            set_kind("$(kind)")
-            add_files("*.c")
-            add_sysincludedirs("../../include", "../../include/uapi")
-            add_packages("libelf", "zlib")
-            add_headerfiles("*.h", {prefixdir = "bpf"})
-            if is_plat("android") then
-                add_defines("__user=", "__force=", "__poll_t=uint32_t")
-            end
-    ]])
-    local configs = {buildir = "xmakebuild"}
-    if package:config("shared") then
-        configs.kind = "shared"
-    elseif package:config("pic") ~= false then
-        configs.cxflags = "-fPIC"
-    end
-    import("package.tools.xmake").install(package, configs)
-end
-
-function test(package)
-    assert(package:has_cfuncs("bpf_object__open", {includes = "bpf/libbpf.h"}))
-end

+ 3 - 4
packages/l/linux-tools/xmake.lua

@@ -1,7 +1,8 @@
 package("linux-tools")
 
+    set_kind("binary")
     set_homepage("https://kernel.org/")
-    set_description("Tools and libraries of the Linux kernel")
+    set_description("Tools of the Linux kernel")
     set_license("GPL-2.0-only")
 
     add_urls("https://cdn.kernel.org/pub/linux/kernel/$(version).tar.xz",
@@ -14,10 +15,8 @@ package("linux-tools")
     add_versions("5.9.16", "b0d7abae88e5f91893627c645e680a95c818defd1b4fcaf3e2afb4b2b6b4ab86")
 
     add_configs("bpftool",     { description = "Enable bpftool.", default = true, type = "boolean"})
-    add_configs("libbpf",      { description = "Enable libbpf library.", default = false, type = "boolean"})
-    add_configs("headers",     { description = "Enable linux headers.", default = false, type = "boolean"})
 
-    local modules = {"bpftool", "libbpf"}
+    local modules = {"bpftool"}
 
     on_load(function (package)
         for _, name in ipairs(modules) do