Browse Source

improve libelf and linux-tools

ruki 4 years ago
parent
commit
1feba52b41

+ 6 - 3
packages/l/libelf/xmake.lua

@@ -18,15 +18,18 @@ package("libelf")
         if package:debug() then
             table.insert(configs, "--enable-debug")
         end
-        local cxflags
+        local cxflags = {}
         if package:config("pic") ~= false then
-            cxflags = "-fPIC"
+            table.insert(cxflags, "-fPIC")
         end
         if package:is_plat("android") then
             io.replace("./configure", "#define off_t long", "")
             io.replace("lib/private.h", "HAVE_MEMMOVE", "1")
             io.replace("lib/private.h", "HAVE_MEMCPY", "1")
-            cxflags = (cxflags or "") .. " -D__LIBELF64=1 -D__LIBELF64_LINUX=1 -D__libelf_u64_t=uint64_t -D__libelf_i64_t=int64_t"
+            table.insert(cxflags, "-D__LIBELF64=1")
+            table.insert(cxflags, "-D__LIBELF64_LINUX=1")
+            table.insert(cxflags, "-D__libelf_u64_t=uint64_t")
+            table.insert(cxflags, "-D__libelf_i64_t=int64_t")
             package:add("defines", "__LIBELF64=1")
             package:add("defines", "__LIBELF64_LINUX=1")
             package:add("defines", "__libelf_u64_t=uint64_t")

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

@@ -0,0 +1,10 @@
+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

+ 1 - 0
packages/l/linux-tools/xmake.lua

@@ -15,6 +15,7 @@ package("linux-tools")
 
     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"}