base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / li / libbladeRF / package.nix
blob77e72d22db6c7ab44c0a1ad63144880b6c9aa814
1 { stdenv, lib, fetchFromGitHub, pkg-config, cmake, git, doxygen, help2man, ncurses, tecla
2 , libusb1, udev }:
4 stdenv.mkDerivation rec {
5   pname = "libbladeRF";
6   version = "2.5.0";
8   src = fetchFromGitHub {
9     owner = "Nuand";
10     repo = "bladeRF";
11     rev = "libbladeRF_v${version}";
12     hash = "sha256-H40w5YKp6M3QLrsPhILEnJiWutCYLtbgC4a63sV397Q=";
13     fetchSubmodules = true;
14   };
16   nativeBuildInputs = [ cmake pkg-config git doxygen help2man ];
17   # ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208
18   buildInputs = [ tecla libusb1 ]
19     ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ]
20     ++ lib.optionals stdenv.hostPlatform.isDarwin [ ncurses ];
22   # Fixup shebang
23   prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash";
25   # Let us avoid nettools as a dependency.
26   postPatch = ''
27     sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash
28   '';
30   cmakeFlags = [
31     "-DBUILD_DOCUMENTATION=ON"
32   ] ++ lib.optionals stdenv.hostPlatform.isLinux [
33     "-DUDEV_RULES_PATH=etc/udev/rules.d"
34     "-DINSTALL_UDEV_RULES=ON"
35     "-DBLADERF_GROUP=bladerf"
36   ];
38   env = lib.optionalAttrs stdenv.cc.isClang {
39     NIX_CFLAGS_COMPILE = "-Wno-error=unused-but-set-variable";
40   };
42   hardeningDisable = [ "fortify" ];
44   meta = with lib; {
45     homepage = "https://nuand.com/libbladeRF-doc";
46     description = "Supporting library of the BladeRF SDR opensource hardware";
47     license = licenses.lgpl21;
48     maintainers = with maintainers; [ markuskowa ];
49     platforms = platforms.unix;
50   };