1{ lib, stdenv, fetchFromGitHub
2, meson, ninja, pkg-config, cmake
3, libtirpc, rpcsvc-proto, avahi, libxml2
4}:
5
6stdenv.mkDerivation (finalAttrs: {
7 pname = "liblxi";
8 version = "1.20";
9
10 src = fetchFromGitHub {
11 owner = "lxi-tools";
12 repo = "liblxi";
13 rev = "v${finalAttrs.version}";
14 hash = "sha256-jS0huNkbyKrsJ3NkenrYtjkzLakOsTJpwlgSo98ribE=";
15 };
16
17 postPatch = ''
18 # needed by darwin
19 sed -e 1i'#include <string.h>' \
20 -e 1i'#include <stdlib.h>' \
21 -i src/bonjour.c
22 '';
23
24 nativeBuildInputs = [ meson ninja cmake pkg-config rpcsvc-proto ];
25
26 buildInputs = lib.optionals (!stdenv.isDarwin) [
27 libtirpc
28 avahi
29 ] ++ [
30 libxml2
31 ];
32
33 meta = with lib; {
34 description = "Library for communicating with LXI compatible instruments";
35 longDescription = ''
36 liblxi is an open source software library which offers a simple
37 API for communicating with LXI compatible instruments.
38 The API allows applications to easily discover instruments
39 on networks and communicate SCPI commands.
40 '';
41 homepage = "https://lxi-tools.github.io/";
42 license = licenses.bsd3;
43 platforms = platforms.unix;
44 maintainers = [ maintainers.vq ];
45 };
46})