nixpkgs/pkgs/by-name/gu/gusb/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

98 lines
1.9 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, meson
, ninja
, pkg-config
2024-10-10 09:27:40 +00:00
, buildPackages
, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages
, gobject-introspection
, gi-docgen
, python3
, glib
, libusb1
, json-glib
, vala
, hwdata
, umockdev
2013-05-10 17:17:36 +00:00
}:
2020-09-20 14:24:43 +00:00
let
pythonEnv = python3.pythonOnBuildForHost.withPackages (ps: with ps; [
2020-09-20 14:24:43 +00:00
setuptools
]);
in
2015-01-14 12:36:45 +00:00
stdenv.mkDerivation rec {
pname = "gusb";
2024-04-22 16:44:09 +00:00
version = "0.4.9";
2018-10-26 18:54:43 +00:00
2024-10-10 09:27:40 +00:00
outputs = [ "bin" "out" "dev" ]
++ lib.optionals withIntrospection [ "devdoc" ];
2013-05-10 17:17:36 +00:00
src = fetchFromGitHub {
owner = "hughsie";
repo = "libgusb";
rev = "refs/tags/${version}";
2024-04-22 16:44:09 +00:00
hash = "sha256-piIPNLc3deToyQaajXFvM+CKh9ni8mb0P3kb+2RoJOs=";
2013-05-10 17:17:36 +00:00
};
2021-08-11 14:47:09 +00:00
patches = [
(substituteAll {
src = ./fix-python-path.patch;
python = "${pythonEnv}/bin/python3";
})
];
strictDeps = true;
depsBuildBuild = [
pkg-config
];
2018-10-26 18:54:43 +00:00
nativeBuildInputs = [
meson
ninja
pkg-config
2024-10-10 09:27:40 +00:00
] ++ lib.optionals withIntrospection [
gobject-introspection
gi-docgen
vala
2018-10-26 18:54:43 +00:00
];
2013-05-10 17:17:36 +00:00
# all required in gusb.pc
propagatedBuildInputs = [
glib
libusb1
json-glib
];
2017-02-27 13:30:20 +00:00
2018-10-26 18:54:43 +00:00
mesonFlags = [
2024-10-10 09:27:40 +00:00
(lib.mesonBool "docs" withIntrospection)
(lib.mesonBool "introspection" withIntrospection)
(lib.mesonBool "tests" doCheck)
2024-10-10 09:27:40 +00:00
(lib.mesonBool "vapi" withIntrospection)
(lib.mesonOption "usb_ids" "${hwdata}/share/hwdata/usb.ids")
];
checkInputs = [
umockdev
2018-10-26 18:54:43 +00:00
];
doCheck = false; # tests try to access USB
postFixup = ''
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
moveToOutput "share/doc" "$devdoc"
'';
meta = with lib; {
2013-05-10 17:17:36 +00:00
description = "GLib libusb wrapper";
mainProgram = "gusbcmd";
homepage = "https://github.com/hughsie/libgusb";
2018-10-26 18:54:43 +00:00
license = licenses.lgpl21;
maintainers = [ maintainers.marcweber ];
platforms = platforms.unix;
2013-05-10 17:17:36 +00:00
};
}