lol
1{ lib
2, stdenv
3, fetchurl
4, pkg-config
5, libzip
6, glib
7, libusb1
8, libftdi1
9, check
10, libserialport
11, doxygen
12, glibmm
13, python
14, hidapi
15, libieee1284
16, bluez
17, sigrok-firmware-fx2lafw
18}:
19
20stdenv.mkDerivation rec {
21 pname = "libsigrok";
22 version = "0.5.2";
23
24 src = fetchurl {
25 url = "https://sigrok.org/download/source/${pname}/${pname}-${version}.tar.gz";
26 sha256 = "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d";
27 };
28
29 enableParallelBuilding = true;
30
31 nativeBuildInputs = [ doxygen pkg-config python ];
32 buildInputs = [
33 libzip glib libusb1 libftdi1 check libserialport glibmm hidapi
34 ] ++ lib.optionals stdenv.isLinux [ libieee1284 bluez ];
35
36 strictDeps = true;
37
38 postInstall = ''
39 mkdir -p $out/etc/udev/rules.d
40 cp contrib/*.rules $out/etc/udev/rules.d
41
42 mkdir -p "$out/share/sigrok-firmware/"
43 cp ${sigrok-firmware-fx2lafw}/share/sigrok-firmware/* "$out/share/sigrok-firmware/"
44 '';
45
46 doInstallCheck = true;
47 installCheckPhase = ''
48 # assert that c++ bindings are included
49 # note that this is only true for modern (>0.5) versions; the 0.3 series does not have these
50 [[ -f $out/include/libsigrokcxx/libsigrokcxx.hpp ]] \
51 || { echo 'C++ bindings were not generated; check configure output'; false; }
52 '';
53
54 meta = with lib; {
55 description = "Core library of the sigrok signal analysis software suite";
56 homepage = "https://sigrok.org/";
57 license = licenses.gpl3Plus;
58 platforms = platforms.linux ++ platforms.darwin;
59 maintainers = with maintainers; [ bjornfor ];
60 };
61}