mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-21 21:23:06 +00:00
0b0b74367f
* Format with nixpkgs-format. * Reorder the attribute to be more in line with convention. * Use simpler git ref. * Hardcode paths within bindings using patch (the replaced value actually changed in this version and without this clean-up, it would have gone unnoticed.) * Let the build script install the python bindings instead of doing it manually (required the same hardcoding as above in the setup.py.) * Use cmakeFlags attribute with placeholder instead of doing that in preConfigure. * Move udev rules to lib since etc is meant for admins. * License is actually lgpl2.1+.
63 lines
1.3 KiB
Nix
63 lines
1.3 KiB
Nix
{ stdenv
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, flex
|
|
, bison
|
|
, libxml2
|
|
, python
|
|
, libusb1
|
|
, runtimeShell
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "libiio";
|
|
version = "0.21";
|
|
|
|
outputs = [ "out" "lib" "dev" "python" ];
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "analogdevicesinc";
|
|
repo = "libiio";
|
|
rev = "v${version}";
|
|
sha256 = "0psw67mzysdb8fkh8xpcwicm7z94k8plkcc8ymxyvl6inshq0mc7";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
flex
|
|
bison
|
|
];
|
|
|
|
buildInputs = [
|
|
python
|
|
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}
|
|
'';
|
|
|
|
postInstall = ''
|
|
# 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.lgpl21Plus;
|
|
platforms = platforms.linux;
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
|
};
|
|
}
|