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