From 4eee2cc0ab6baaf61d636ffa84ca28e52d215349 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 10 Dec 2021 09:37:09 +0800 Subject: [PATCH] Update xmake.lua --- packages/l/linux-headers/xmake.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/l/linux-headers/xmake.lua b/packages/l/linux-headers/xmake.lua index 552e8c718..5a74242ff 100644 --- a/packages/l/linux-headers/xmake.lua +++ b/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