summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2020-03-19 22:28:30 +0800
committerPeter Hoeg <peter@hoeg.com>2020-03-21 12:49:48 +0800
commit59281f742a0ce8def71be3576129b4178ec579bb (patch)
tree2de6bc301dbcff514e791e433444fce82e294aee
parent8c514e9e7ba9883a48a91e0db08f08d44ca46036 (diff)
downloadnixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.tar
nixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.tar.gz
nixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.tar.bz2
nixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.tar.lz
nixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.tar.xz
nixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.tar.zst
nixpkgs-59281f742a0ce8def71be3576129b4178ec579bb.zip
libusb-compat: fix up the .so so it can find libusb1
-rw-r--r--pkgs/development/libraries/libusb/default.nix22
1 files changed, 18 insertions, 4 deletions
diff --git a/pkgs/development/libraries/libusb/default.nix b/pkgs/development/libraries/libusb/default.nix
index 681b2eef456..2830ef28458 100644
--- a/pkgs/development/libraries/libusb/default.nix
+++ b/pkgs/development/libraries/libusb/default.nix
@@ -1,14 +1,22 @@
-{stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libusb1}:
+{ stdenv
+, lib
+, fetchFromGitHub
+, autoreconfHook
+, patchelf
+, pkgconfig
+, libusb1
+}:
 
 stdenv.mkDerivation rec {
-  name = "libusb-compat-${version}";
+  pname = "libusb-compat";
   version = "0.1.7";
 
   outputs = [ "out" "dev" ]; # get rid of propagating systemd closure
   outputBin = "dev";
 
-  nativeBuildInputs = [ pkgconfig autoreconfHook ];
-  propagatedBuildInputs = [ libusb1 ];
+  nativeBuildInputs = [ autoreconfHook patchelf pkgconfig ];
+
+  buildInputs = [ libusb1 ];
 
   src = fetchFromGitHub {
     owner = "libusb";
@@ -19,6 +27,12 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
 
+  # without this, libusb-compat is unable to find libusb1
+  postFixup = ''
+    find $out/lib -name \*.so\* -type f -exec \
+      patchelf --set-rpath ${lib.makeLibraryPath buildInputs} {} \;
+  '';
+
   meta = with stdenv.lib; {
     homepage = "https://libusb.info/";
     repositories.git = "https://github.com/libusb/libusb-compat-0.1";