<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;

  <!ENTITY libinput-version "1.19.2">

  <!ENTITY libinput-download-http "https://www.freedesktop.org/software/libinput/libinput-&libinput-version;.tar.xz">
  <!ENTITY libinput-download-ftp  " ">
  <!ENTITY libinput-md5sum        "2c7f2aa4032bacb562a535b74829c56d">
  <!ENTITY libinput-size          "640 KB">
  <!ENTITY libinput-buildsize     "12 MB (add 17 MB for documentation)">
  <!ENTITY libinput-time          "0.1 SBU (add 0.1 SBU for documentation)">
]>

  <sect2 id="libinput" xreflabel="libinput-&libinput-version;">
    <?dbhtml filename="libinput.html"?>

    <sect2info>
      <date>$Date$</date>
    </sect2info>

    <title>libinput-&libinput-version;</title>

    <indexterm zone="libinput">
      <primary sortas="a-libinput">libinput</primary>
    </indexterm>

    <sect3 role="package">
      <title>Introduction to libinput</title>

      <para>
        <application>libinput</application> is a library that handles
        input devices for display servers and other applications that
        need to directly deal with input devices.
      </para>

      &lfs110a_checked;

      <bridgehead renderas="sect4">Package Information</bridgehead>
      <itemizedlist spacing="compact">
        <listitem>
          <para>
            Download (HTTP): <ulink url="&libinput-download-http;"/>
          </para>
        </listitem>
        <listitem>
          <para>
            Download (FTP): <ulink url="&libinput-download-ftp;"/>
          </para>
        </listitem>
        <listitem>
          <para>
            Download MD5 sum: &libinput-md5sum;
          </para>
        </listitem>
        <listitem>
          <para>
            Download size: &libinput-size;
          </para>
        </listitem>
        <listitem>
          <para>
            Estimated disk space required: &libinput-buildsize;
          </para>
        </listitem>
        <listitem>
          <para>
            Estimated build time: &libinput-time;
          </para>
        </listitem>
      </itemizedlist>

      <bridgehead renderas="sect4">libinput Dependencies</bridgehead>

      <bridgehead renderas="sect5">Required</bridgehead>
      <para role="required">
        <xref linkend="libevdev"/> and
        <xref linkend="mtdev"/>
      </para>

      <bridgehead renderas="sect5">Optional</bridgehead>
      <para role="optional">
        <xref linkend="valgrind"/> (to run the tests),
        <ulink url="http://sphinx-doc.org/">Sphinx</ulink> (required to build documentation),
        <xref linkend="gtk3"/> (to build the GUI event viewer),
        <ulink url="http://www.nongnu.org/libunwind/">libunwind</ulink> (required for tests),
        <xref linkend="libwacom"/>, and
        <ulink url="https://pypi.org/project/pyparsing/">PyParsing</ulink> (for one non-root test)
      </para>

      <para condition="html" role="usernotes">
        User Notes: <ulink url="&blfs-wiki;/libinput"/>
      </para>
    </sect3>

    <sect3 role="kernel" id="libinput-kernel">
      <title>kernel configuration for running the libinput testsuite</title>

      <para>
        Although libinput works with the same kernel configuration used by <xref
        linkend="libevdev"/>, its extensive testsuite requires the presence of
        <filename>/dev/uinput</filename>  (as well as both <xref linkend="valgrind"/>
        and <ulink url="http://www.nongnu.org/libunwind/">libunwind</ulink>).
      </para>

      <para>
        If you wish to run the full tests, enable the following option in the kernel
        configuration and recompile the kernel if necessary:
      </para>

<screen><literal>Device Drivers ---&gt;
  Input device support ---&gt;
    Miscellaneous Devices ---&gt;
    &lt;*/M&gt;   User level driver support        [CONFIG_INPUT_UINPUT]</literal></screen>

      <para>
        If you build this as a module, it needs to be inserted before the testsuite
        runs.
      </para>

      <para>
        On an Xorg system you will also need to prevent the events generated
        during the testsuite from interfering with your desktop.  Copy the
        file <filename>test/50-litest.conf</filename> into
        <filename class="directory">${XORG_PREFIX}/share/X11/xorg.conf.d</filename>
        and restart X. For further information see
        <ulink url="https://wayland.freedesktop.org/libinput/doc/&libinput-version;/test-suite.html">libinput test suite</ulink>.
      </para>

      <indexterm zone="libinput libinput-kernel">
        <primary sortas="d-libinput">libinput</primary>
      </indexterm>
    </sect3>

    <sect3 role="installation">
      <title>Installation of libinput</title>

      <para>
        Install <application>libinput</application> by running the following
        commands:
      </para>

<screen><userinput>mkdir build &amp;&amp;
cd    build &amp;&amp;

meson --prefix=$XORG_PREFIX \
      --buildtype=release   \
      -Ddebug-gui=false     \
      -Dtests=false         \
      -Dlibwacom=false      \
      ..                    &amp;&amp;
ninja</userinput></screen>

      <note>
        <para>
          If you want to run the full tests, remove -Dtests from the
          <command>meson</command> command above. Please read "kernel
          configuration for running the libinput testsuite" (above).
        </para>

        <para>
          If you have enabled the full tests, you can run the main tests
          <emphasis>as the root user</emphasis> by executing:
          <command>ninja test</command>. A very large number of tests will
          be run, about 20 fail (at least on an Xorg system).
        </para>
      </note>

      <para>
        Now, as the <systemitem class="username">root</systemitem> user:
      </para>

<screen role="root"><userinput>ninja install</userinput></screen>

      <para>
        If you have passed <option>-Ddocumentation=true</option> to
        <command>meson</command>, you can install the generated documentation
        by running the following commands as the <systemitem
        class="username">root</systemitem> user:
      </para>

<!-- seems the api doc is not generated because the directory is not a git
     repository... -->
<screen role="root"
        remap="doc"><userinput>install -v -dm755      /usr/share/doc/libinput-&libinput-version;/html &amp;&amp;
cp -rv Documentation/* /usr/share/doc/libinput-&libinput-version;/html</userinput></screen>

    </sect3>

    <sect3 role="commands">
      <title>Command Explanations</title>

      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
        href="../../xincludes/meson-buildtype-release.xml"/>

      <para>
        <parameter>-Ddebug-gui=false</parameter>: This switch
        disables creation of a visual debug helper for libinput. Remove
        if you want it, and you have <xref linkend="gtk3"/> installed.
      </para>

      <para>
        <parameter>-Dtests=false</parameter>: This switch disables compilation of
        the main tests.  Even with the tests defined as false, you can still run
        the first four minor tests, as a regular user, but one will be skipped if
        <ulink url="https://pypi.org/project/pyparsing">PyParsing</ulink> is not
        installed.
      </para>

      <para>
        <parameter>-Dlibwacom=false</parameter>: Remove this option if you
        have <xref linkend="libwacom"/> installed, or if you are installing
        GNOME.
      </para>

      <para>
        <option>-Ddocumentation=true</option>: This switch enables
        generation of the documentation. Add it if you want to generate
        the documentation. You must have <xref linkend="doxygen"/> and
        <xref linkend="graphviz"/> installed.
      </para>

    </sect3>

    <sect3 role="content">
      <title>Contents</title>

      <segmentedlist>
        <segtitle>Installed Programs</segtitle>
        <segtitle>Installed Libraries</segtitle>
        <segtitle>Installed Directories</segtitle>

        <seglistitem>
          <seg>
            libinput
            <!-- libinput-debug-events, libinput-list-devices, libinput-measure*,
            libinput-record, libinput-replay Library Executables -->
          </seg>
          <seg>
            libinput.so
          </seg>
          <seg>
            $XORG_PREFIX/libexec/libinput,
            /etc/libinput,
            /usr/share/libinput, and (optionally)
            /usr/share/doc/libinput-&libinput-version;
          </seg>
        </seglistitem>
      </segmentedlist>

      <variablelist>
        <bridgehead renderas="sect3">Short Descriptions</bridgehead>
        <?dbfo list-presentation="list"?>
        <?dbhtml list-presentation="table"?>

        <varlistentry id="libinput-prog">
          <term><command>libinput</command></term>
          <listitem>
            <para>
              is a set of tools to interface with the
              <application>libinput</application> library
            </para>
            <indexterm zone="libinput libinput-prog">
              <primary sortas="b-libinput-prog">libinput</primary>
            </indexterm>
          </listitem>
        </varlistentry>
<!--
        <varlistentry id="libinput-debug-events">
          <term><command>libinput-debug-events</command></term>
          <listitem>
            <para>
              is a debug helper for <application>libinput</application>.
            </para>
            <indexterm zone="libinput libinput-debug-events">
              <primary sortas="b-libinput-debug-events">libinput-debug-events</primary>
            </indexterm>
          </listitem>
        </varlistentry>

        <varlistentry id="libinput-list-devices">
          <term><command>libinput-list-devices</command></term>
          <listitem>
            <para>
              lists local devices as recognized by
              <application>libinput</application>.
            </para>
            <indexterm zone="libinput libinput-list-devices">
              <primary sortas="b-libinput-list-devices">libinput-list-devices</primary>
            </indexterm>
          </listitem>
        </varlistentry>

        <varlistentry id="libinput-measure">
          <term><command>libinput-measure</command></term>
          <listitem>
            <para>
              is the entry to a set of debugging programs to measure
              the properties of one or more devices.
            </para>
            <indexterm zone="libinput libinput-measure">
              <primary sortas="b-libinput-measure">libinput-measure</primary>
            </indexterm>
          </listitem>
        </varlistentry>

        <varlistentry id="libinput-record">
          <term><command>libinput-record</command></term>
          <listitem>
            <para>
              records kernel events from a device in a form that can later be
              replayed by libinput-replay.
            </para>
            <indexterm zone="libinput libinput-record">
              <primary sortas="b-libinput-record">libinput-record</primary>
            </indexterm>
          </listitem>
        </varlistentry>

        <varlistentry id="libinput-replay">
          <term><command>libinput-replay</command></term>
          <listitem>
            <para>
              replays kernel events from a recording made by libinput-record.
            </para>
            <indexterm zone="libinput libinput-replay">
              <primary sortas="b-libinput-replay">libinput-replay</primary>
            </indexterm>
          </listitem>
        </varlistentry>
-->
        <varlistentry id="libinput-lib">
          <term><filename class="libraryfile">libinput.so</filename></term>
          <listitem>
            <para>
              contains API functions for handling input devices
            </para>
            <indexterm zone="libinput libinput-lib">
              <primary sortas="c-libinput-lib">libinput.so</primary>
            </indexterm>
          </listitem>
        </varlistentry>

      </variablelist>

    </sect3>

  </sect2>