1{ stdenv, fetchurl, pkgconfig, systemd ? null, libobjc, IOKit }:
2
3stdenv.mkDerivation rec {
4 name = "libusb-1.0.22";
5
6 src = fetchurl {
7 url = "mirror://sourceforge/libusb/${name}.tar.bz2";
8 sha256 = "0mw1a5ss4alg37m6bd4k44v35xwrcwp5qm4s686q1nsgkbavkbkm";
9 };
10
11 outputs = [ "out" "dev" ]; # get rid of propagating systemd closure
12
13 nativeBuildInputs = [ pkgconfig ];
14 propagatedBuildInputs =
15 stdenv.lib.optional stdenv.isLinux systemd ++
16 stdenv.lib.optionals stdenv.isDarwin [ libobjc IOKit ];
17
18 NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
19
20 preFixup = stdenv.lib.optionalString stdenv.isLinux ''
21 sed 's,-ludev,-L${systemd.lib}/lib -ludev,' -i $out/lib/libusb-1.0.la
22 '';
23
24 meta = with stdenv.lib; {
25 homepage = "https://libusb.info/";
26 repositories.git = "https://github.com/libusb/libusb";
27 description = "cross-platform user-mode USB device library";
28 longDescription = ''
29 libusb is a cross-platform user-mode library that provides access to USB devices.
30 '';
31 platforms = platforms.all;
32 license = licenses.lgpl21Plus;
33 maintainers = [ ];
34 };
35}