2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, libusb1
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libusb-compat";
|
2023-03-24 00:07:29 +00:00
|
|
|
version = "0.1.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ]; # get rid of propagating systemd closure
|
|
|
|
outputBin = "dev";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libusb";
|
|
|
|
repo = "libusb-compat-0.1";
|
|
|
|
rev = "v${version}";
|
2023-03-24 00:07:29 +00:00
|
|
|
sha256 = "sha256-pAPERYSxoc47gwpPUoMkrbK8TOXyx03939vlFN0hHRg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
patches = lib.optional stdenv.hostPlatform.isMusl ./fix-headers.patch;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [ libusb1 ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# without this, libusb-compat is unable to find libusb1
|
|
|
|
postFixup = ''
|
|
|
|
find $out/lib -name \*.so\* -type f -exec \
|
|
|
|
patchelf --set-rpath ${lib.makeLibraryPath buildInputs} {} \;
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://libusb.info/";
|
|
|
|
description = "cross-platform user-mode USB device library";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "libusb-config";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
|
|
|
libusb is a cross-platform user-mode library that provides access to USB devices.
|
|
|
|
The current API is of 1.0 version (libusb-1.0 API), this library is a wrapper exposing the legacy API.
|
|
|
|
'';
|
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|