1{
2 lib,
3 stdenv,
4 fetchgit,
5 gitUpdater,
6 autoreconfHook,
7 autoconf-archive,
8 pkg-config,
9 enable-tools ? true,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "libgpiod";
14 version = "2.2.2";
15
16 src = fetchgit {
17 url = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git";
18 tag = "v${version}";
19 hash = "sha256-MePv6LsK+8zCxG8l4vyiiZPSVqv9F4H4KQB0gHjm0YM=";
20 };
21
22 nativeBuildInputs = [
23 autoconf-archive
24 pkg-config
25 autoreconfHook
26 ];
27
28 configureFlags = [
29 "--enable-tools=${if enable-tools then "yes" else "no"}"
30 "--enable-bindings-cxx"
31 ];
32
33 passthru.updateScript = gitUpdater {
34 rev-prefix = "v";
35 allowedVersions = "^[0-9\\.]+$";
36 };
37
38 meta = with lib; {
39 description = "C library and tools for interacting with the linux GPIO character device";
40 longDescription = ''
41 Since linux 4.8 the GPIO sysfs interface is deprecated. User space should use
42 the character device instead. This library encapsulates the ioctl calls and
43 data structures behind a straightforward API.
44 '';
45 homepage = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/about/";
46 license =
47 with licenses;
48 [
49 lgpl21Plus # libgpiod
50 lgpl3Plus # C++ bindings
51 ]
52 ++ lib.optional enable-tools gpl2Plus;
53 maintainers = [ ];
54 platforms = platforms.linux;
55 };
56}