usbutils: 017 -> 018; add darwin support (#370911)

This commit is contained in:
K900
2025-02-09 09:12:07 +03:00
committed by GitHub
2 changed files with 46 additions and 31 deletions
+12 -9
View File
@@ -1,11 +1,14 @@
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,7 +61,7 @@ EXTRA_DIST = \
LICENSES/GPL-3.0-only.txt
diff --git a/lsusb.py b/lsusb.py
index bbc4dbb..8af1b1f 100755
--- a/lsusb.py
+++ b/lsusb.py
@@ -27,8 +27,7 @@ showwakeup = False
lsusb.py: $(srcdir)/lsusb.py.in
- sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@
+ sed 's|VERSION|$(VERSION)|g;s|@usbids@|@hwdata@/share/hwdata/usb.ids|g' $< >$@
chmod 755 $@
prefix = "/sys/bus/usb/devices/"
usbids = [
- "/usr/share/hwdata/usb.ids",
- "/usr/share/usb.ids",
+ "@hwdata@/share/hwdata/usb.ids",
]
cols = ("", "", "", "", "", "")
lsusb.8: $(srcdir)/lsusb.8.in
+34 -22
View File
@@ -3,7 +3,9 @@
stdenv,
fetchurl,
substituteAll,
autoreconfHook,
fetchpatch,
meson,
ninja,
pkg-config,
libusb1,
hwdata,
@@ -12,22 +14,30 @@
stdenv.mkDerivation rec {
pname = "usbutils";
version = "017";
version = "018";
src = fetchurl {
url = "mirror://kernel/linux/utils/usb/usbutils/usbutils-${version}.tar.xz";
hash = "sha256-pqJf/c+RA+ONekRzKsoXBz9OYCuS5K5VYlIxqCcC4Fs=";
hash = "sha256-g/aLWbWFR1icACZugmcYZGJ1k6tDYtjIB/UO6pI8rZM=";
};
patches = [
(substituteAll {
src = ./fix-paths.patch;
inherit hwdata;
})
];
patches =
[
(substituteAll {
src = ./fix-paths.patch;
inherit hwdata;
})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(fetchpatch {
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/24a6945778381a62ecdcc1d78bcc16b9f86778c1/usbutils/portable.patch";
hash = "sha256-spTkWURij4sPLoWtDaWVMIk81AS5W+qUUOQL1pAZEvs=";
})
];
nativeBuildInputs = [
autoreconfHook
meson
ninja
pkg-config
];
buildInputs = [
@@ -35,17 +45,16 @@ stdenv.mkDerivation rec {
python3
];
outputs = [
"out"
"man"
"python"
];
outputs =
[
"out"
"man"
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"python" # uses sysfs
];
postBuild = ''
$CC $NIX_CFLAGS -o usbreset usbreset.c
'';
postInstall = ''
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
moveToOutput "bin/lsusb.py" "$python"
install -Dm555 usbreset -t $out/bin
'';
@@ -53,12 +62,15 @@ stdenv.mkDerivation rec {
meta = {
homepage = "http://www.linux-usb.org/";
description = "Tools for working with USB devices, such as lsusb";
maintainers = with lib.maintainers; [ cafkafk ];
maintainers = with lib.maintainers; [
cafkafk
chuangzhu
];
license = with lib.licenses; [
gpl2Only # manpages, usbreset
gpl2Plus # most of the code
];
platforms = lib.platforms.linux;
platforms = with lib.platforms; linux ++ darwin;
mainProgram = "lsusb";
};
}