nixpkgs/pkgs/development/tools/libsigrok/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

64 lines
1.6 KiB
Nix

{ lib
, stdenv
, fetchgit
, autoreconfHook
, pkg-config
, libzip
, glib
, libusb1
, libftdi1
, check
, libserialport
, doxygen
, glibmm
, python
, hidapi
, libieee1284
, bluez
, sigrok-firmware-fx2lafw
}:
stdenv.mkDerivation rec {
pname = "libsigrok";
version = "0.5.2-unstable-2024-01-03";
src = fetchgit {
url = "git://sigrok.org/libsigrok";
rev = "b503d24cdf56abf8c0d66d438ccac28969f01670";
hash = "sha256-9EW0UCzU6MqBX6rkT5CrBsDkAi6/CLyS9MZHsDV+1IQ=";
};
enableParallelBuilding = true;
nativeBuildInputs = [ autoreconfHook doxygen pkg-config python ];
buildInputs = [
libzip glib libusb1 libftdi1 check libserialport glibmm hidapi
] ++ lib.optionals stdenv.hostPlatform.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/"
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
[[ -f $out/include/libsigrokcxx/libsigrokcxx.hpp ]] \
|| { echo 'C++ bindings were not generated; check configure output'; false; }
'';
meta = with lib; {
description = "Core library of the sigrok signal analysis software suite";
homepage = "https://sigrok.org/";
license = licenses.gpl3Plus;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ bjornfor vifino ];
};
}