1{ lib, stdenv, fetchurl, pkg-config, libzip, glib, libusb1, libftdi1, check
2, libserialport, librevisa, doxygen, glibmm, python3
3, version ? "0.5.1", sha256 ? "171b553dir5gn6w4f7n37waqk62nq2kf1jykx4ifjacdz5xdw3z4", doInstallCheck ? true
4}:
5
6stdenv.mkDerivation rec {
7 inherit version doInstallCheck;
8 pname = "libsigrok";
9
10 src = fetchurl {
11 url = "https://sigrok.org/download/source/${pname}/${pname}-${version}.tar.gz";
12 inherit sha256;
13 };
14
15 firmware = fetchurl {
16 url = "https://sigrok.org/download/binary/sigrok-firmware-fx2lafw/sigrok-firmware-fx2lafw-bin-0.1.6.tar.gz";
17 sha256 = "14sd8xqph4kb109g073daiavpadb20fcz7ch1ipn0waz7nlly4sw";
18 };
19
20 nativeBuildInputs = [ doxygen pkg-config python3 ];
21 buildInputs = [ libzip glib libusb1 libftdi1 check libserialport librevisa glibmm ];
22
23 strictDeps = true;
24
25 postInstall = ''
26 mkdir -p "$out/share/sigrok-firmware/"
27 tar --strip-components=1 -xvf "${firmware}" -C "$out/share/sigrok-firmware/"
28 '';
29
30 installCheckPhase = ''
31 # assert that c++ bindings are included
32 # note that this is only true for modern (>0.5) versions; the 0.3 series does not have these
33 [[ -f $out/include/libsigrokcxx/libsigrokcxx.hpp ]] \
34 || { echo 'C++ bindings were not generated; check configure output'; false; }
35 '';
36
37 meta = with lib; {
38 description = "Core library of the sigrok signal analysis software suite";
39 homepage = "https://sigrok.org/";
40 license = licenses.gpl3Plus;
41 platforms = platforms.linux ++ platforms.darwin;
42 maintainers = with maintainers; [ bjornfor ];
43 };
44}