diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gusb')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/gusb/default.nix | 90 | ||||
-rw-r--r-- | nixpkgs/pkgs/development/libraries/gusb/fix-python-path.patch | 14 |
2 files changed, 104 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gusb/default.nix b/nixpkgs/pkgs/development/libraries/gusb/default.nix new file mode 100644 index 000000000000..d6fe70440132 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gusb/default.nix @@ -0,0 +1,90 @@ +{ lib +, stdenv +, fetchFromGitHub +, substituteAll +, meson +, ninja +, pkg-config +, gobject-introspection +, gi-docgen +, python3 +, glib +, libusb1 +, json-glib +, vala +, hwdata +, umockdev +}: + +let + pythonEnv = python3.pythonOnBuildForHost.withPackages (ps: with ps; [ + setuptools + ]); +in +stdenv.mkDerivation rec { + pname = "gusb"; + version = "0.4.8"; + + outputs = [ "bin" "out" "dev" "devdoc" ]; + + src = fetchFromGitHub { + owner = "hughsie"; + repo = "libgusb"; + rev = "refs/tags/${version}"; + hash = "sha256-xhWx45uOh8Yokd3/32CQ6tsdkgGaYUOvaylrq/jmoP0="; + }; + + patches = [ + (substituteAll { + src = ./fix-python-path.patch; + python = "${pythonEnv}/bin/python3"; + }) + ]; + + strictDeps = true; + + depsBuildBuild = [ + pkg-config + ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + gobject-introspection + gi-docgen + vala + ]; + + # all required in gusb.pc + propagatedBuildInputs = [ + glib + libusb1 + json-glib + ]; + + mesonFlags = [ + (lib.mesonBool "tests" doCheck) + (lib.mesonOption "usb_ids" "${hwdata}/share/hwdata/usb.ids") + ]; + + checkInputs = [ + umockdev + ]; + + doCheck = false; # tests try to access USB + + postFixup = '' + # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. + ls -la "$out/share/doc" + moveToOutput "share/doc" "$devdoc" + ''; + + meta = with lib; { + description = "GLib libusb wrapper"; + homepage = "https://github.com/hughsie/libgusb"; + license = licenses.lgpl21; + maintainers = [ maintainers.marcweber ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/gusb/fix-python-path.patch b/nixpkgs/pkgs/development/libraries/gusb/fix-python-path.patch new file mode 100644 index 000000000000..5f04387a537e --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/gusb/fix-python-path.patch @@ -0,0 +1,14 @@ +diff --git a/gusb/meson.build b/gusb/meson.build +index 8236a2b..282aa48 100644 +--- a/gusb/meson.build ++++ b/gusb/meson.build +@@ -147,7 +147,7 @@ libgusb_gir = libgusb_girtarget[0] + libgusb_typelib = libgusb_girtarget[1] + + pymod = import('python') +-py_installation = pymod.find_installation() ++py_installation = pymod.find_installation('@python@') + + # Verify the map file is correct -- note we can't actually use the generated + # file for two reasons: + |