Merge pull request #82944 from peterhoeg/f/libusb

libusb-compat: fix up the .so so it can find libusb1
This commit is contained in:
Peter Hoeg 2020-03-21 12:50:54 +08:00 committed by GitHub
commit 438f094334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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";