2018-09-13 06:33:57 +02:00
|
|
|
{ stdenv, fetchFromGitHub
|
|
|
|
, cmake, flex, bison
|
2018-09-27 02:37:32 +02:00
|
|
|
, libxml2, python
|
2019-08-01 18:56:06 +02:00
|
|
|
, libusb1, runtimeShell
|
2018-09-13 06:33:57 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "libiio";
|
2020-06-06 13:28:37 +02:00
|
|
|
version = "0.20";
|
2018-09-13 06:33:57 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "analogdevicesinc";
|
|
|
|
repo = "libiio";
|
|
|
|
rev = "refs/tags/v${version}";
|
2020-06-06 13:28:37 +02:00
|
|
|
sha256 = "1929gvizkqmm9cwh3vihxxszfxvgcp5saq9q6chdk3fpdhzajc00";
|
2018-09-13 06:33:57 +02:00
|
|
|
};
|
|
|
|
|
2018-09-27 02:37:32 +02:00
|
|
|
outputs = [ "out" "lib" "dev" "python" ];
|
2018-09-13 06:33:57 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
2019-08-01 18:56:06 +02:00
|
|
|
buildInputs = [ libxml2 libusb1 ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace libiio.rules.cmakein \
|
|
|
|
--replace /bin/sh ${runtimeShell}
|
|
|
|
'';
|
|
|
|
|
|
|
|
# since we can't expand $out in cmakeFlags
|
|
|
|
preConfigure = ''
|
|
|
|
cmakeFlags="$cmakeFlags -DUDEV_RULES_INSTALL_DIR=$out/etc/udev/rules.d"
|
|
|
|
'';
|
2018-09-13 06:33:57 +02:00
|
|
|
|
2018-09-27 02:37:32 +02:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $python/lib/${python.libPrefix}/site-packages/
|
|
|
|
touch $python/lib/${python.libPrefix}/site-packages/
|
|
|
|
cp ../bindings/python/iio.py $python/lib/${python.libPrefix}/site-packages/
|
|
|
|
|
|
|
|
substitute ../bindings/python/iio.py $python/lib/${python.libPrefix}/site-packages/iio.py \
|
|
|
|
--replace 'libiio.so.0' $lib/lib/libiio.so.0
|
|
|
|
'';
|
|
|
|
|
2018-09-13 06:33:57 +02:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "API for interfacing with the Linux Industrial I/O Subsystem";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/analogdevicesinc/libiio";
|
2018-09-13 06:33:57 +02:00
|
|
|
license = licenses.lgpl21;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
|
|
|
};
|
|
|
|
}
|