1{ lib, stdenv, fetchFromGitHub, cmake, libiio }:
2
3stdenv.mkDerivation rec {
4 pname = "libad9361";
5 version = "0.3";
6
7 src = fetchFromGitHub {
8 owner = "analogdevicesinc";
9 repo = "libad9361-iio";
10 rev = "v${version}";
11 hash = "sha256-9e66qSrKpczatZY9lPAzi/6f7lHChnl2+Pih53oa28Y=";
12 };
13
14 nativeBuildInputs = [ cmake ];
15
16 buildInputs = [ libiio ];
17
18 postPatch = lib.optionalString stdenv.isDarwin ''
19 # Fix iio include path on darwin to match linux
20 for i in test/*.c; do
21 substituteInPlace $i \
22 --replace 'iio/iio.h' 'iio.h'
23 done
24 '';
25
26 meta = with lib; {
27 description = "IIO AD9361 library for filter design and handling, multi-chip sync, etc";
28 homepage = "http://analogdevicesinc.github.io/libad9361-iio/";
29 license = licenses.lgpl21Plus;
30 maintainers = with maintainers; [ sikmir ];
31 platforms = platforms.linux ++ platforms.darwin;
32 };
33}