diff --git a/packages/l/libkmod/patches/31/basename.patch b/packages/l/libkmod/patches/31/basename.patch new file mode 100644 index 000000000..d384ced90 --- /dev/null +++ b/packages/l/libkmod/patches/31/basename.patch @@ -0,0 +1,54 @@ +diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c +index e83621b..8aa555a 100644 +--- a/libkmod/libkmod-config.c ++++ b/libkmod/libkmod-config.c +@@ -794,7 +794,7 @@ static int conf_files_insert_sorted(struct kmod_ctx *ctx, + bool is_single = false; + + if (name == NULL) { +- name = basename(path); ++ name = gnu_basename(path); + is_single = true; + } + +diff --git a/shared/util.c b/shared/util.c +index e2bab83..0e16670 100644 +--- a/shared/util.c ++++ b/shared/util.c +@@ -172,9 +172,9 @@ char *modname_normalize(const char *modname, char buf[static PATH_MAX], size_t * + + char *path_to_modname(const char *path, char buf[static PATH_MAX], size_t *len) + { +- char *modname; ++ const char *modname; + +- modname = basename(path); ++ modname = gnu_basename(path); + if (modname == NULL || modname[0] == '\0') + return NULL; + +diff --git a/shared/util.h b/shared/util.h +index c4a3916..073dc5a 100644 +--- a/shared/util.h ++++ b/shared/util.h +@@ -5,6 +5,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -76,6 +77,12 @@ do { \ + __p->__v = (val); \ + } while(0) + ++static _always_inline_ const char *gnu_basename(const char *s) ++{ ++ const char *p = strrchr(s, '/'); ++ return p ? p+1 : s; ++} ++ + static _always_inline_ unsigned int ALIGN_POWER2(unsigned int u) + { + return 1 << ((sizeof(u) * 8) - __builtin_clz(u - 1)); diff --git a/packages/l/libkmod/xmake.lua b/packages/l/libkmod/xmake.lua index 8f4458f90..4f79b63f0 100644 --- a/packages/l/libkmod/xmake.lua +++ b/packages/l/libkmod/xmake.lua @@ -5,18 +5,17 @@ package("libkmod") add_urls("https://github.com/kmod-project/kmod/archive/refs/tags/$(version).tar.gz", "https://github.com/kmod-project/kmod.git") + + add_versions("v31", "16c40aaa50fc953035b4811b29ce3182f220e95f3c9e5eacb4b07b1abf85f003") add_versions("v30", "1fa3974abd80b992d61324bcc04fa65ea96cfe2e9e1150f48394833030c4b583") + add_patches("31", path.join(os.scriptdir(), "patches", "31", "basename.patch"), "83d07e169882cc91f3af162912ae97cd4b62ff48876ca83b0317c40a388773ad") + on_install("linux", "android", function (package) os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") os.cp(path.join(package:scriptdir(), "port", "config.h"), "config.h") os.cp(path.join(package:scriptdir(), "port", "endian-darwin.h"), "endian-darwin.h") - - local configs = {} - if package:config("shared") then - configs.kind = "shared" - end - import("package.tools.xmake").install(package, configs) + import("package.tools.xmake").install(package) end) on_test(function (package)