Auto-update libkmod to v31 (#3196)

* Update libkmod to v31

* patch basename

* fix patch

* add v32

* Revert "add v32"

This reverts commit 2b315bbde8.

---------

Co-authored-by: star9029 <hengxings783@gmail.com>
pull/3514/head
ruki 8 months ago committed by GitHub
parent c1cdc7419c
commit 798d28964e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 54
      packages/l/libkmod/patches/31/basename.patch
  2. 11
      packages/l/libkmod/xmake.lua

@ -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 <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
@@ -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));

@ -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)

Loading…
Cancel
Save