2018-09-13 05:33:57 +01:00
|
|
|
{ stdenv, fetchFromGitHub
|
|
|
|
, cmake, flex, bison
|
2018-09-27 01:37:32 +01:00
|
|
|
, libxml2, python
|
2019-08-01 17:56:06 +01:00
|
|
|
, libusb1, runtimeShell
|
2018-09-13 05:33:57 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "libiio";
|
2019-05-05 14:12:17 +01:00
|
|
|
version = "0.18";
|
2018-09-13 05:33:57 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "analogdevicesinc";
|
|
|
|
repo = "libiio";
|
|
|
|
rev = "refs/tags/v${version}";
|
2019-05-05 14:12:17 +01:00
|
|
|
sha256 = "1cmg3ipam101iy9yncwz2y48idaqaw4fg7i9i4c8vfjisfcycnkk";
|
2018-09-13 05:33:57 +01:00
|
|
|
};
|
|
|
|
|
2018-09-27 01:37:32 +01:00
|
|
|
outputs = [ "out" "lib" "dev" "python" ];
|
2018-09-13 05:33:57 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake flex bison ];
|
2019-08-01 17:56:06 +01: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 05:33:57 +01:00
|
|
|
|
2018-09-27 01:37:32 +01: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 05:33:57 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "API for interfacing with the Linux Industrial I/O Subsystem";
|
|
|
|
homepage = https://github.com/analogdevicesinc/libiio;
|
|
|
|
license = licenses.lgpl21;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
|
|
|
};
|
|
|
|
}
|