diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libiio/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/libiio/default.nix | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libiio/default.nix b/nixpkgs/pkgs/development/libraries/libiio/default.nix index 03a907162b1..c4136428035 100644 --- a/nixpkgs/pkgs/development/libraries/libiio/default.nix +++ b/nixpkgs/pkgs/development/libraries/libiio/default.nix @@ -1,49 +1,62 @@ -{ stdenv, fetchFromGitHub -, cmake, flex, bison -, libxml2, python -, libusb1, runtimeShell +{ stdenv +, fetchFromGitHub +, cmake +, flex +, bison +, libxml2 +, python +, libusb1 +, runtimeShell }: stdenv.mkDerivation rec { pname = "libiio"; - version = "0.19"; + version = "0.21"; + + outputs = [ "out" "lib" "dev" "python" ]; src = fetchFromGitHub { - owner = "analogdevicesinc"; - repo = "libiio"; - rev = "refs/tags/v${version}"; - sha256 = "1r67h5mayx9krh3mmzs5vz20mvwb2lw04hpbyyisygl01ndc77kq"; + owner = "analogdevicesinc"; + repo = "libiio"; + rev = "v${version}"; + sha256 = "0psw67mzysdb8fkh8xpcwicm7z94k8plkcc8ymxyvl6inshq0mc7"; }; - outputs = [ "out" "lib" "dev" "python" ]; + nativeBuildInputs = [ + cmake + flex + bison + ]; + + buildInputs = [ + python + libxml2 + libusb1 + ]; - nativeBuildInputs = [ cmake flex bison ]; - buildInputs = [ libxml2 libusb1 ]; + cmakeFlags = [ + "-DUDEV_RULES_INSTALL_DIR=${placeholder "out"}/lib/udev/rules.d" + "-DPYTHON_BINDINGS=on" + ]; postPatch = '' + # Hardcode path to the shared library into the bindings. + sed "s#@libiio@#$lib/lib/libiio${stdenv.hostPlatform.extensions.sharedLibrary}#g" ${./hardcode-library-path.patch} | patch -p1 + 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" - ''; - 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 + # Move Python bindings into a separate output. + moveToOutput ${python.sitePackages} "$python" ''; 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; + homepage = "https://github.com/analogdevicesinc/libiio"; + license = licenses.lgpl21Plus; + platforms = platforms.linux; maintainers = with maintainers; [ thoughtpolice ]; }; } |