Browse Source

Update xmake.lua

ruki 3 năm trước cách đây
mục cha
commit
4eee2cc0ab
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  1. 12 0
      packages/l/linux-headers/xmake.lua

+ 12 - 0
packages/l/linux-headers/xmake.lua

@@ -25,6 +25,18 @@ package("linux-headers")
         end
     end)
 
+    on_fetch(function (package, opt)
+        if opt.system then
+            import("lib.detect.find_path")
+            local linux_headersdir = find_path("include/linux", "/usr/src/linux-headers-*")
+            if linux_headersdir then
+                -- parse version, linux-headers-5.11.0-41-generic, linux-headers-5.11.0-41
+                local version = path.filename(linux_headersdir):match("linux%-headers%-(%d+%.%d+%.%d+).*")
+                return {includedirs = path.join(linux_headersdir, "include"), version = version}
+            end
+        end
+    end)
+
     on_install("linux", function (package)
         import("package.tools.make")
         if package:config("driver_modules") then