systemd/kmod: fork from Alpine to support usr merge (MR 5554) (MR 5563)
actual patch to support usr merge will come later
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# Forked from Alpine to add support for usr merge
|
||||
|
||||
pkgname=kmod
|
||||
pkgver=99932
|
||||
_pkgver=32
|
||||
pkgrel=3
|
||||
pkgdesc="Linux kernel module management utilities"
|
||||
url="http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary"
|
||||
arch="all"
|
||||
options="!check" # https://bugs.gentoo.org/408915#c3
|
||||
license="GPL-2.0-or-later"
|
||||
# gnu sed is needed for symlink
|
||||
makedepends_build="sed libxslt"
|
||||
makedepends_host="$depends_dev zlib-dev xz-dev zstd-dev openssl-dev>3"
|
||||
makedepends="$makedepends_build $makedepends_host"
|
||||
triggers="$pkgname.trigger=/lib/modules/*"
|
||||
subpackages="
|
||||
$pkgname-dev
|
||||
$pkgname-doc
|
||||
$pkgname-libs
|
||||
$pkgname-bash-completion
|
||||
"
|
||||
source="https://kernel.org/pub/linux/utils/kernel/kmod/kmod-$_pkgver.tar.xz
|
||||
strndupa.patch
|
||||
portable-basename.patch
|
||||
"
|
||||
builddir="$srcdir/$pkgname-$_pkgver"
|
||||
|
||||
build() {
|
||||
if [ -z "$BOOTSTRAP" ]; then
|
||||
export CFLAGS="$CFLAGS -flto=auto"
|
||||
fi
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--prefix=/usr \
|
||||
--bindir=/bin \
|
||||
--sysconfdir=/etc \
|
||||
--with-rootlibdir=/lib \
|
||||
--with-zlib \
|
||||
--with-xz \
|
||||
--with-zstd \
|
||||
--with-openssl
|
||||
make
|
||||
}
|
||||
|
||||
package() {
|
||||
make DESTDIR="$pkgdir" install
|
||||
local i
|
||||
mkdir -p "$pkgdir"/sbin
|
||||
for i in lsmod rmmod insmod modinfo modprobe depmod; do
|
||||
ln -sf ../bin/$i "$pkgdir"/sbin/$i
|
||||
done
|
||||
}
|
||||
|
||||
libs() {
|
||||
license="LGPL-2.1-or-later"
|
||||
default_libs
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
29162135aabd025dff178a4147a754b5da5964855dbeee65ca867dec3b84437f35c1c97f0f027e974a021d3ee9a4940309a716859cc3cfe93c7ed0aada338f24 kmod-32.tar.xz
|
||||
f2ea3527bfba182c5e15557c224a5bba8c7e2ea3d21cf604e6eb2277226dcf983c3aeb9ac44a322c7f2b4942b35135da999d63a5b946b829d3f3b09c050a0f17 strndupa.patch
|
||||
5fc41a7c4ea3ad3e33516ebdf8d19ac7ce0223d75a3e99f185e8a7fd71007b9d2e2d850e319b122d470cd95f45098a5a39faa21a17c0fb82124138f97db9d85c portable-basename.patch
|
||||
"
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in "$@"; do
|
||||
if [ -e "$i"/modules.order ]; then
|
||||
/sbin/depmod ${i#/lib/modules/}
|
||||
else
|
||||
#clean up on uninstall
|
||||
rm -f "$i"/modules.alias \
|
||||
"$i"/modules.builtin.alias.bin \
|
||||
"$i"/modules.dep \
|
||||
"$i"/modules.devname \
|
||||
"$i"/modules.symbols \
|
||||
"$i"/modules.alias.bin \
|
||||
"$i"/modules.builtin.bin \
|
||||
"$i"/modules.dep.bin \
|
||||
"$i"/modules.softdep \
|
||||
"$i"/modules.symbols.bin
|
||||
rmdir "$i" 2>/dev/null || :
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
Upstream PR #32
|
||||
|
||||
musl has removed the non-prototype declaration of basename from
|
||||
string.h [1] which now results in build errors with clang-17+
|
||||
compiler.
|
||||
|
||||
https://github.com/kmod-project/kmod/pull/32
|
||||
|
||||
---
|
||||
|
||||
diff -aur a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
|
||||
--- a/libkmod/libkmod-config.c
|
||||
+++ b/libkmod/libkmod-config.c
|
||||
@@ -794,7 +794,7 @@
|
||||
bool is_single = false;
|
||||
|
||||
if (name == NULL) {
|
||||
- name = basename(path);
|
||||
+ name = gnu_basename(path);
|
||||
is_single = true;
|
||||
}
|
||||
|
||||
diff -aur a/shared/util.c b/shared/util.c
|
||||
--- a/shared/util.c
|
||||
+++ b/shared/util.c
|
||||
@@ -172,9 +172,9 @@
|
||||
|
||||
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 -aur a/shared/util.h b/shared/util.h
|
||||
--- 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 @@
|
||||
__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 -aur a/testsuite/testsuite.c b/testsuite/testsuite.c
|
||||
--- a/testsuite/testsuite.c
|
||||
+++ b/testsuite/testsuite.c
|
||||
@@ -70,7 +70,7 @@
|
||||
|
||||
printf("Usage:\n"
|
||||
"\t%s [options] <test>\n"
|
||||
- "Options:\n", basename(progname));
|
||||
+ "Options:\n", gnu_basename(progname));
|
||||
|
||||
for (itr = options, itr_short = options_short;
|
||||
itr->name != NULL; itr++, itr_short++)
|
||||
diff -aur a/tools/depmod.c b/tools/depmod.c
|
||||
--- a/tools/depmod.c
|
||||
+++ b/tools/depmod.c
|
||||
@@ -761,7 +761,7 @@
|
||||
if (name != NULL)
|
||||
namelen = strlen(name);
|
||||
else {
|
||||
- name = basename(dir);
|
||||
+ name = gnu_basename(dir);
|
||||
namelen = strlen(name);
|
||||
dirlen -= namelen + 1;
|
||||
}
|
||||
diff -aur a/tools/kmod.c b/tools/kmod.c
|
||||
--- a/tools/kmod.c
|
||||
+++ b/tools/kmod.c
|
||||
@@ -68,7 +68,7 @@
|
||||
"Options:\n"
|
||||
"\t-V, --version show version\n"
|
||||
"\t-h, --help show this help\n\n"
|
||||
- "Commands:\n", basename(argv[0]));
|
||||
+ "Commands:\n", gnu_basename(argv[0]));
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(kmod_cmds); i++) {
|
||||
if (kmod_cmds[i]->help != NULL) {
|
||||
@@ -156,7 +156,7 @@
|
||||
const char *cmd;
|
||||
size_t i;
|
||||
|
||||
- cmd = basename(argv[0]);
|
||||
+ cmd = gnu_basename(argv[0]);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(kmod_compat_cmds); i++) {
|
||||
if (streq(kmod_compat_cmds[i]->name, cmd))
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/libkmod/libkmod-util.c b/libkmod/libkmod-util.c
|
||||
index df12433..142e767 100644
|
||||
--- a/shared/util.c
|
||||
+++ b/shared/util.c
|
||||
@@ -334,7 +334,9 @@ int mkdir_p(const char *path, int len, mode_t mode)
|
||||
{
|
||||
char *start, *end;
|
||||
|
||||
- start = strndupa(path, len);
|
||||
+ start = alloca(len+1);
|
||||
+ strncpy(start, path, len);
|
||||
+ start[len] = '\0';
|
||||
end = start + len;
|
||||
|
||||
/*
|
||||
Reference in New Issue
Block a user