2018-09-24 20:40:45 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, pkgconfig, cmake, git, doxygen, help2man, ncurses, tecla
|
2015-07-02 15:25:24 +01:00
|
|
|
, libusb1, udev }:
|
2015-01-25 10:25:47 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-09-24 21:40:45 +01:00
|
|
|
version = "2.0.2";
|
2018-05-28 13:59:57 +01:00
|
|
|
name = "libbladeRF-${version}";
|
2015-01-25 10:25:47 +00:00
|
|
|
|
2015-07-02 15:25:24 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Nuand";
|
|
|
|
repo = "bladeRF";
|
|
|
|
rev = "libbladeRF_v${version}";
|
2018-09-24 21:40:45 +01:00
|
|
|
sha256 = "18qwljjdnf4lds04kc1zvslr5hh9cjnnjkcy07lbkrq7pj0pfnc6";
|
2015-01-25 10:25:47 +00:00
|
|
|
};
|
|
|
|
|
2017-09-05 22:26:13 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
2018-06-04 03:44:25 +01:00
|
|
|
# ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208
|
|
|
|
buildInputs = [ cmake git doxygen help2man tecla libusb1 ]
|
|
|
|
++ lib.optionals stdenv.isLinux [ udev ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ ncurses ];
|
2015-01-25 10:25:47 +00:00
|
|
|
|
2015-01-25 18:01:58 +00:00
|
|
|
# Fixup shebang
|
|
|
|
prePatch = "patchShebangs host/utilities/bladeRF-cli/src/cmd/doc/generate.bash";
|
|
|
|
|
2018-09-24 20:40:45 +01:00
|
|
|
# Fixes macos and freebsd compilation issue.
|
|
|
|
# https://github.com/Nuand/bladeRF/commit/0cb4ea888543b2dc75b876f7024e180854fbe9c3
|
|
|
|
patches = [ (fetchpatch {
|
|
|
|
name = "fix-OSX-and-FreeBSD-build.patch";
|
|
|
|
url = "https://github.com/Nuand/bladeRF/commit/0cb4ea88.diff";
|
|
|
|
sha256 = "1ccpa69vz2nlpdnxprh4rd1pgphk82z5lfmbrfdkn7srw6nxl469";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2015-01-25 18:01:58 +00:00
|
|
|
# Let us avoid nettools as a dependency.
|
2018-09-24 20:40:45 +01:00
|
|
|
postPatch = ''
|
2015-01-25 18:01:58 +00:00
|
|
|
sed -i 's/$(hostname)/hostname/' host/utilities/bladeRF-cli/src/cmd/doc/generate.bash
|
|
|
|
'';
|
2015-01-25 10:25:47 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2018-06-04 03:44:25 +01:00
|
|
|
"-DBUILD_DOCUMENTATION=ON"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2017-03-03 11:03:50 +00:00
|
|
|
"-DUDEV_RULES_PATH=etc/udev/rules.d"
|
2015-01-25 10:25:47 +00:00
|
|
|
"-DINSTALL_UDEV_RULES=ON"
|
2018-09-24 20:40:45 +01:00
|
|
|
"-DBLADERF_GROUP=bladerf"
|
2015-01-25 10:25:47 +00:00
|
|
|
];
|
2015-01-25 10:25:47 +00:00
|
|
|
|
2018-06-04 03:30:27 +01:00
|
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
|
2018-06-04 03:44:25 +01:00
|
|
|
meta = with lib; {
|
2018-06-04 03:30:27 +01:00
|
|
|
homepage = https://nuand.com/libbladeRF-doc;
|
2015-01-25 10:25:47 +00:00
|
|
|
description = "Supporting library of the BladeRF SDR opensource hardware";
|
2015-07-02 15:25:24 +01:00
|
|
|
license = licenses.lgpl21;
|
|
|
|
maintainers = with maintainers; [ funfunctor ];
|
2018-06-04 03:44:25 +01:00
|
|
|
platforms = platforms.unix;
|
2015-01-25 10:25:47 +00:00
|
|
|
};
|
|
|
|
}
|