libinput build instructions

Instructions on how to build libinput and its tools and how to build against libinput.

Building libinput

libinput uses automake, a build is usually the following three-step process

$> git clone git://anongit.freedesktop.org/git/wayland/libinput
$> cd libinput
$> ./autogen.sh --prefix=/usr --libdir=/usr/lib64
$> make
$> sudo make install
Note
On Debian-based distributions including Ubuntu and its derivatives skip the --libdir=/usr/lib64 argument.

A successful build requires the Build dependencies to be installed at configure time.

Build dependencies

libinput has a few build-time dependencies that must be installed prior to running configure. In most cases, it is sufficient to install the dependencies that your distribution uses to build the libinput package. These can be installed with one of the following commands:

  • Debian/Ubuntu based distributions: sudo apt-get build-dep libinput
  • Fedora 22 and later: sudo dnf builddep libinput
  • SuSE/RHEL/CentOS/Fedora 21 and earlier: sudo yum-builddep libinput
  • Arch:
    $> abs extra/libinput
    $> cd $(mktemp -d)
    $> cp /var/abs/extra/libinput/PKGBUILD .
    $> makepkg --syncdeps --nobuild
    

If dependencies are missing, a message No package 'foo' found will be shown during the configure stage. See this blog post here. for instructions on how to fix it.

Building without libwacom

libwacom is required by libinput's tablet code to gather additional information about tablets that is not available from the kernel device itself. libwacom is required by default but can be skipped when Building libinput with the --disable-libwacom argument.

$> ./autogen.sh --disable-libwacom --prefix=/usr --libdir=/usr/lib64

Disabling libwacom is safe to do for environments where full tablet support is not required. Note that libinput provides tablet support even without libwacom, but some features may be missing or working differently.

Building the graphical helper tool

Only the commandline Helper tools are installed by distributions. The event-gui graphical helper tools is only available in the source repository.

The graphical helper tool is optional by default and requires extra libraries to build. If these libraries are not detected, the tool will not be built. If you need the tool for debugging purposes, use the --enable-event-gui argument when Building libinput.

$> ./autogen.sh --enable-event-gui --prefix=/usr --libdir=/usr/lib64

As usual, any missing library headers will then trigger an error and can be addressed one-by-one.

Building against libinput

libinput provides a pkg-config file. Software that uses libinput should use pkg-config and the PKG_CHECK_MODULES autoconf macro. Otherwise, the most rudimentary way to compile and link a program against libinput is:

gcc -o myprogram myprogram.c `pkg-config --cflags --libs libinput`

For further information on using pkgconfig see the pkg-config documentation.