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