Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, fetchFromGitHub 3, cmake 4, flex 5, bison 6, libxml2 7, python 8, libusb1 9, avahiSupport ? true, avahi 10, libaio 11, runtimeShell 12, lib 13, pkg-config 14, CFNetwork 15, CoreServices 16}: 17 18stdenv.mkDerivation rec { 19 pname = "libiio"; 20 version = "0.24"; 21 22 outputs = [ "out" "lib" "dev" "python" ]; 23 24 src = fetchFromGitHub { 25 owner = "analogdevicesinc"; 26 repo = "libiio"; 27 rev = "v${version}"; 28 sha256 = "sha256-c5HsxCdp1cv5BGTQ/8dc8J893zk9ntbfAudLpqoQ1ow="; 29 }; 30 31 # Revert after https://github.com/NixOS/nixpkgs/issues/125008 is 32 # fixed properly 33 patches = [ ./cmake-fix-libxml2-find-package.patch ]; 34 35 nativeBuildInputs = [ 36 cmake 37 flex 38 bison 39 pkg-config 40 python 41 ] ++ lib.optional python.isPy3k python.pkgs.setuptools; 42 43 buildInputs = [ 44 libxml2 45 libusb1 46 ] ++ lib.optional avahiSupport avahi 47 ++ lib.optional stdenv.isLinux libaio 48 ++ lib.optionals stdenv.isDarwin [ CFNetwork CoreServices ]; 49 50 cmakeFlags = [ 51 "-DUDEV_RULES_INSTALL_DIR=${placeholder "out"}/lib/udev/rules.d" 52 "-DPython_EXECUTABLE=${python.pythonForBuild.interpreter}" 53 "-DPYTHON_BINDINGS=on" 54 # osx framework is disabled, 55 # the linux-like directory structure is used for proper output splitting 56 "-DOSX_PACKAGE=off" 57 "-DOSX_FRAMEWORK=off" 58 ] ++ lib.optionals (!avahiSupport) [ 59 "-DHAVE_DNS_SD=OFF" 60 ]; 61 62 postPatch = '' 63 # Hardcode path to the shared library into the bindings. 64 sed "s#@libiio@#$lib/lib/libiio${stdenv.hostPlatform.extensions.sharedLibrary}#g" ${./hardcode-library-path.patch} | patch -p1 65 66 substituteInPlace libiio.rules.cmakein \ 67 --replace /bin/sh ${runtimeShell} 68 ''; 69 70 postInstall = '' 71 # Move Python bindings into a separate output. 72 moveToOutput ${python.sitePackages} "$python" 73 ''; 74 75 meta = with lib; { 76 description = "API for interfacing with the Linux Industrial I/O Subsystem"; 77 homepage = "https://github.com/analogdevicesinc/libiio"; 78 license = licenses.lgpl21Plus; 79 platforms = platforms.linux ++ platforms.darwin; 80 maintainers = with maintainers; [ thoughtpolice ]; 81 }; 82}