2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, pkgconfig
|
2020-11-12 09:05:59 +00:00
|
|
|
, enableUdev ? stdenv.isLinux && !stdenv.hostPlatform.isMusl
|
|
|
|
, udev ? null
|
2020-04-24 23:36:52 +00:00
|
|
|
, libobjc
|
|
|
|
, IOKit
|
|
|
|
, withStatic ? false
|
|
|
|
}:
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
assert enableUdev -> udev != null;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libusb";
|
|
|
|
version = "1.0.23";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libusb";
|
|
|
|
repo = "libusb";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0mxbpg01kgbk5nh6524b0m4xk7ywkyzmc3yhi5asqcsd3rbhjj98";
|
|
|
|
};
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig autoreconfHook ];
|
|
|
|
propagatedBuildInputs =
|
2020-11-12 09:05:59 +00:00
|
|
|
stdenv.lib.optional enableUdev udev ++
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
|
|
|
|
|
|
|
|
dontDisableStatic = withStatic;
|
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
configureFlags = stdenv.lib.optional (!enableUdev) "--disable-udev";
|
2020-06-18 07:06:33 +00:00
|
|
|
|
2020-11-12 09:05:59 +00:00
|
|
|
preFixup = stdenv.lib.optionalString enableUdev ''
|
|
|
|
sed 's,-ludev,-L${stdenv.lib.getLib udev}/lib -ludev,' -i $out/lib/libusb-1.0.la
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "https://libusb.info/";
|
|
|
|
repositories.git = "https://github.com/libusb/libusb";
|
|
|
|
description = "cross-platform user-mode USB device library";
|
|
|
|
longDescription = ''
|
|
|
|
libusb is a cross-platform user-mode library that provides access to USB devices.
|
|
|
|
'';
|
|
|
|
platforms = platforms.all;
|
|
|
|
license = licenses.lgpl21Plus;
|
|
|
|
maintainers = [ ];
|
|
|
|
};
|
|
|
|
}
|