1{ stdenv, fetchurl, pkgconfig, meson, ninja
2, libevdev, mtdev, udev, libwacom
3, documentationSupport ? false, doxygen ? null, graphviz ? null # Documentation
4, eventGUISupport ? false, cairo ? null, glib ? null, gtk3 ? null # GUI event viewer support
5, testsSupport ? false, check ? null, valgrind ? null, python3Packages ? null
6}:
7
8assert documentationSupport -> doxygen != null && graphviz != null;
9assert eventGUISupport -> cairo != null && glib != null && gtk3 != null;
10assert testsSupport -> check != null && valgrind != null && python3Packages != null;
11
12let
13 mkFlag = optSet: flag: "-D${flag}=${stdenv.lib.boolToString optSet}";
14in
15
16with stdenv.lib;
17stdenv.mkDerivation rec {
18 name = "libinput-${version}";
19 version = "1.11.3";
20
21 src = fetchurl {
22 url = "https://www.freedesktop.org/software/libinput/${name}.tar.xz";
23 sha256 = "01nb1shnl871d939wgfd7nc9svclcnfjfhlq64b4yns2dvcr24gk";
24 };
25
26 outputs = [ "out" "dev" ];
27
28 mesonFlags = [
29 (mkFlag documentationSupport "documentation")
30 (mkFlag eventGUISupport "debug-gui")
31 (mkFlag testsSupport "tests")
32 ];
33
34 nativeBuildInputs = [ pkgconfig meson ninja ]
35 ++ optionals documentationSupport [ doxygen graphviz ]
36 ++ optionals testsSupport [ check valgrind python3Packages.pyparsing ];
37
38 buildInputs = [ libevdev mtdev libwacom ]
39 ++ optionals eventGUISupport [ cairo glib gtk3 ];
40
41 propagatedBuildInputs = [ udev ];
42
43 patches = [ ./udev-absolute-path.patch ];
44
45 preBuild = ''
46 # meson setup-hook changes the directory so the files are located one level up
47 patchShebangs ../udev/parse_hwdb.py
48 patchShebangs ../test/symbols-leak-test.in
49 '';
50
51 doCheck = testsSupport;
52
53 meta = {
54 description = "Handles input devices in Wayland compositors and provides a generic X.Org input driver";
55 homepage = http://www.freedesktop.org/wiki/Software/libinput;
56 license = licenses.mit;
57 platforms = platforms.unix;
58 maintainers = with maintainers; [ codyopel wkennington ];
59 };
60}