libusb-compat: fix up the .so so it can find libusb1

This commit is contained in:
Peter Hoeg 2020-03-19 22:28:30 +08:00
parent 8c514e9e7b
commit 59281f742a

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