about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gusb
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gusb')
-rw-r--r--nixpkgs/pkgs/development/libraries/gusb/default.nix51
-rw-r--r--nixpkgs/pkgs/development/libraries/gusb/fix-python-path.patch14
2 files changed, 65 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..449a7a17623b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gusb/default.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv, fetchurl, substituteAll, meson, ninja, pkg-config, gettext, gobject-introspection
+, gtk-doc, docbook_xsl, docbook_xml_dtd_412, docbook_xml_dtd_44, python3
+, glib, systemd, libusb1, vala, hwdata
+}:
+
+let
+  pythonEnv = python3.withPackages(ps: with ps; [
+    setuptools
+  ]);
+in
+stdenv.mkDerivation rec {
+  pname = "gusb";
+  version = "0.3.7";
+
+  outputs = [ "bin" "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "https://people.freedesktop.org/~hughsient/releases/libgusb-${version}.tar.xz";
+    sha256 = "sha256-2l8l1oc2ImibM1FIbL4CjvwlRAP2Rt2BIl3+hULYxn0=";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./fix-python-path.patch;
+      python = "${pythonEnv}/bin/python3";
+    })
+  ];
+
+  nativeBuildInputs = [
+    meson ninja pkg-config gettext pythonEnv
+    gtk-doc docbook_xsl docbook_xml_dtd_412 docbook_xml_dtd_44
+    gobject-introspection vala
+  ];
+  buildInputs = [ systemd glib ];
+
+  propagatedBuildInputs = [ libusb1 ];
+
+  mesonFlags = [
+    "-Dusb_ids=${hwdata}/share/hwdata/usb.ids"
+  ];
+
+  doCheck = false; # tests try to access USB
+
+  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:
+