2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, substituteAll
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, gobject-introspection
|
|
|
|
, gi-docgen
|
|
|
|
, python3
|
|
|
|
, glib
|
|
|
|
, libusb1
|
|
|
|
, json-glib
|
|
|
|
, vala
|
|
|
|
, hwdata
|
|
|
|
, umockdev
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2020-11-12 09:05:59 +00:00
|
|
|
|
|
|
|
let
|
2023-11-16 04:20:00 +00:00
|
|
|
pythonEnv = python3.pythonOnBuildForHost.withPackages (ps: with ps; [
|
2020-11-12 09:05:59 +00:00
|
|
|
setuptools
|
|
|
|
]);
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gusb";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.4.9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "bin" "out" "dev" "devdoc" ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hughsie";
|
|
|
|
repo = "libgusb";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-piIPNLc3deToyQaajXFvM+CKh9ni8mb0P3kb+2RoJOs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-08-18 13:19:15 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-python-path.patch;
|
|
|
|
python = "${pythonEnv}/bin/python3";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
gobject-introspection
|
|
|
|
gi-docgen
|
|
|
|
vala
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# all required in gusb.pc
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
glib
|
|
|
|
libusb1
|
|
|
|
json-glib
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mesonFlags = [
|
2023-07-15 17:15:38 +00:00
|
|
|
(lib.mesonBool "tests" doCheck)
|
|
|
|
(lib.mesonOption "usb_ids" "${hwdata}/share/hwdata/usb.ids")
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
umockdev
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = false; # tests try to access USB
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
postFixup = ''
|
|
|
|
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
|
|
|
|
moveToOutput "share/doc" "$devdoc"
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "GLib libusb wrapper";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "gusbcmd";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/hughsie/libgusb";
|
|
|
|
license = licenses.lgpl21;
|
|
|
|
maintainers = [ maintainers.marcweber ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|