2021-01-15 22:18:51 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, pkg-config, cmake, git, doxygen, help2man, ncurses, tecla
|
2020-04-24 23:36:52 +00:00
|
|
|
, libusb1, udev }:
|
|
|
|
let
|
|
|
|
# fetch submodule
|
|
|
|
noos = fetchFromGitHub {
|
|
|
|
owner = "analogdevicesinc";
|
|
|
|
repo = "no-OS";
|
|
|
|
rev = "0bba46e6f6f75785a65d425ece37d0a04daf6157";
|
|
|
|
sha256 = "0is79dhsyp9xmlnfdr1i5s1c22ipjafk9d35jpn5dynpvj86m99c";
|
|
|
|
};
|
2021-07-18 21:22:44 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "libbladeRF";
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "2.4.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Nuand";
|
|
|
|
repo = "bladeRF";
|
|
|
|
rev = "libbladeRF_v${version}";
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "05axh51lrzxpz2qfswnjwxpfk3mlsv2wc88dd12gfr1karn5jwz9";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config git doxygen help2man ];
|
2020-04-24 23:36:52 +00:00
|
|
|
# ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = [ tecla libusb1 ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ udev ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ ncurses ];
|
|
|
|
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
cp -r ${noos}/* source/thirdparty/analogdevicesinc/no-OS/
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Fixup shebang
|
|
|
|
prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash";
|
|
|
|
|
|
|
|
# Let us avoid nettools as a dependency.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_DOCUMENTATION=ON"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"-DUDEV_RULES_PATH=etc/udev/rules.d"
|
|
|
|
"-DINSTALL_UDEV_RULES=ON"
|
|
|
|
"-DBLADERF_GROUP=bladerf"
|
|
|
|
];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [
|
2023-02-16 17:41:37 +00:00
|
|
|
# Needed with GCC 12
|
|
|
|
"-Wno-error=array-bounds"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://nuand.com/libbladeRF-doc";
|
|
|
|
description = "Supporting library of the BladeRF SDR opensource hardware";
|
|
|
|
license = licenses.lgpl21;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|