Skip to content

Commit

Permalink
Merge pull request #186604 from panicgh/sigrok
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 authored Aug 17, 2022
2 parents ab223b2 + d8f986d commit b3da007
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 23 deletions.
8 changes: 4 additions & 4 deletions pkgs/applications/science/electronics/pulseview/default.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{ mkDerivation, lib, fetchurl, fetchpatch, pkg-config, cmake, glib, boost, libsigrok
, libsigrokdecode, libserialport, libzip, udev, libusb1, libftdi1, glibmm
, pcre, librevisa, python3, qtbase, qtsvg
, pcre, librevisa, python3, qtbase, qtsvg, qttools
}:

mkDerivation rec {
pname = "pulseview";
version = "0.4.1";
version = "0.4.2";

src = fetchurl {
url = "https://sigrok.org/download/source/pulseview/${pname}-${version}.tar.gz";
sha256 = "0bvgmkgz37n2bi9niskpl05hf7rsj1lj972fbrgnlz25s4ywxrwy";
sha256 = "1jxbpz1h3m1mgrxw74rnihj8vawgqdpf6c33cqqbyd8v7rxgfhph";
};

nativeBuildInputs = [ cmake pkg-config ];

buildInputs = [
glib boost libsigrok libsigrokdecode libserialport libzip udev libusb1 libftdi1 glibmm
pcre librevisa python3
qtbase qtsvg
qtbase qtsvg qttools
];

patches = [
Expand Down
40 changes: 29 additions & 11 deletions pkgs/development/tools/libsigrok/default.nix
Original file line number Diff line number Diff line change
@@ -1,32 +1,50 @@
{ lib, stdenv, fetchurl, pkg-config, libzip, glib, libusb1, libftdi1, check
, libserialport, librevisa, doxygen, glibmm, python
, version ? "0.5.1", sha256 ? "171b553dir5gn6w4f7n37waqk62nq2kf1jykx4ifjacdz5xdw3z4", doInstallCheck ? true
{ lib
, stdenv
, fetchurl
, pkg-config
, libzip
, glib
, libusb1
, libftdi1
, check
, libserialport
, librevisa
, doxygen
, glibmm
, python
, hidapi
, libieee1284
, bluez
, sigrok-firmware-fx2lafw
}:

stdenv.mkDerivation rec {
inherit version doInstallCheck;
pname = "libsigrok";
version = "0.5.2";

src = fetchurl {
url = "https://sigrok.org/download/source/${pname}/${pname}-${version}.tar.gz";
inherit sha256;
sha256 = "0g6fl684bpqm5p2z4j12c62m45j1dircznjina63w392ns81yd2d";
};

firmware = fetchurl {
url = "https://sigrok.org/download/binary/sigrok-firmware-fx2lafw/sigrok-firmware-fx2lafw-bin-0.1.6.tar.gz";
sha256 = "14sd8xqph4kb109g073daiavpadb20fcz7ch1ipn0waz7nlly4sw";
};
enableParallelBuilding = true;

nativeBuildInputs = [ doxygen pkg-config python ];
buildInputs = [ libzip glib libusb1 libftdi1 check libserialport librevisa glibmm ];
buildInputs = [
libzip glib libusb1 libftdi1 check libserialport librevisa glibmm hidapi
] ++ lib.optionals stdenv.isLinux [ libieee1284 bluez ];

strictDeps = true;

postInstall = ''
mkdir -p $out/etc/udev/rules.d
cp contrib/*.rules $out/etc/udev/rules.d
mkdir -p "$out/share/sigrok-firmware/"
tar --strip-components=1 -xvf "${firmware}" -C "$out/share/sigrok-firmware/"
cp ${sigrok-firmware-fx2lafw}/share/sigrok-firmware/* "$out/share/sigrok-firmware/"
'';

doInstallCheck = true;
installCheckPhase = ''
# assert that c++ bindings are included
# note that this is only true for modern (>0.5) versions; the 0.3 series does not have these
Expand Down
35 changes: 35 additions & 0 deletions pkgs/development/tools/sigrok-firmware-fx2lafw/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ lib
, stdenv
, fetchurl
, sdcc
}:

stdenv.mkDerivation rec {
pname = "sigrok-firmware-fx2lafw";
version = "0.1.7";

src = fetchurl {
url = "https://sigrok.org/download/source/sigrok-firmware-fx2lafw/sigrok-firmware-fx2lafw-${version}.tar.gz";
sha256 = "sha256-o/RA1qhSpG4sXRmfwcjk2s0Aa8BODVV2KY7lXQVqzjs=";
};

enableParallelBuilding = true;

nativeBuildInputs = [ sdcc ];

meta = with lib; {
description = "Firmware for FX2 logic analyzers";
homepage = "https://sigrok.org/";

# licensing details explained in:
# https://sigrok.org/gitweb/?p=sigrok-firmware-fx2lafw.git;a=blob;f=README;hb=HEAD#l122
license = with licenses; [
gpl2Plus # overall
lgpl21Plus # fx2lib, Hantek 6022BE, Sainsmart DDS120 firmwares
];

sourceProvenance = with sourceTypes; [ fromSource ];
platforms = platforms.all;
maintainers = with maintainers; [ panicgh ];
};
}
10 changes: 2 additions & 8 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5026,7 +5026,6 @@ with pkgs;
convertlit = callPackage ../tools/text/convertlit { };

collectd = callPackage ../tools/system/collectd {
libsigrok = libsigrok_0_3; # not compatible with >= 0.4.0 yet
jdk = jdk8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
inherit (darwin.apple_sdk.frameworks) IOKit;
};
Expand Down Expand Up @@ -15897,13 +15896,6 @@ with pkgs;
libsigrok = callPackage ../development/tools/libsigrok {
python = python3;
};
# old version:
libsigrok_0_3 = libsigrok.override {
python = python3;
version = "0.3.0";
sha256 = "0l3h7zvn3w4c1b9dgvl3hirc4aj1csfkgbk87jkpl7bgl03nk4j3";
doInstallCheck = false;
};

libsigrokdecode = callPackage ../development/tools/libsigrokdecode {
python3 = python38;
Expand All @@ -15913,6 +15905,8 @@ with pkgs;
libsigrok4dsl = callPackage ../applications/science/electronics/dsview/libsigrok4dsl.nix { };
libsigrokdecode4dsl = callPackage ../applications/science/electronics/dsview/libsigrokdecode4dsl.nix { };

sigrok-firmware-fx2lafw = callPackage ../development/tools/sigrok-firmware-fx2lafw { };

cli11 = callPackage ../development/tools/misc/cli11 { };

datree = callPackage ../development/tools/datree { };
Expand Down

0 comments on commit b3da007

Please sign in to comment.