From 59281f742a0ce8def71be3576129b4178ec579bb Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Thu, 19 Mar 2020 22:28:30 +0800 Subject: libusb-compat: fix up the .so so it can find libusb1 --- pkgs/development/libraries/libusb/default.nix | 22 ++++++++++++++++++---- 1 file 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"; -- cgit 1.4.1