/** @page building_libinput libinput build instructions @tableofcontents Instructions on how to build libinput and its tools and how to build against libinput. The build instruction on this page detail how to overwrite your system-provided libinput with one from the git repository, see see @ref reverting_install to revert to the previous state. @section building Building libinput libinput uses [meson](https://www.mesonbuild.com) and [ninja](https://www.ninja-build.org). A build is usually the three-step process below. A successful build requires the @ref building_dependencies to be installed before running meson. @code $> git clone git://anongit.freedesktop.org/git/wayland/libinput $> cd libinput $> meson --prefix=/usr builddir/ $> ninja -C builddir/ $> sudo ninja -C builddir/ install $> sudo udevadm hwdb --update @endcode The ```prefix``` option or other options can be changed later with the ```mesonconf``` command. @code $> mesonconf builddir/ -Dprefix=/some/other/prefix $> ninja -C builddir $> sudo ninja -C builddir/ install @endcode @subsection building_autotools Building with automake libinput currently also provides the autotools build system, but this will be removed in future libinput versions. A build with automake is usually the three-step process below. A successful build requires the @ref building_dependencies to be installed at configure time. @code $> git clone git://anongit.freedesktop.org/git/wayland/libinput $> cd libinput $> ./autogen.sh --prefix=/usr --libdir=/usr/lib64 $> make $> sudo make install $> sudo udevadm hwdb --update @endcode @note On Debian-based distributions including Ubuntu and its derivatives skip the ```--libdir=/usr/lib64``` argument. @subsection verifying_install Verifying the install To verify the install worked correctly, check that libinput.so.x.x.x is in the library path and that all symlinks point to the new library.
$> ls -l /usr/lib64/libinput.*
-rwxr-xr-x 1 root root    946 Apr 28  2015 /usr/lib64/libinput.la
lrwxrwxrwx 1 root root     19 Feb  1 15:12 /usr/lib64/libinput.so -> libinput.so.10.11.2
lrwxrwxrwx 1 root root     19 Feb  1 15:12 /usr/lib64/libinput.so.10 -> libinput.so.10.11.2
-rwxr-xr-x 1 root root 204992 Feb  1 15:12 /usr/lib64/libinput.so.10.11.2
The .so installed from git master may have a lower number than the system-provided one. In that case, manually adjust the symlinks to point to the newly installed .so.x.x.x @subsection reverting_install Reverting to the system-provided libinput packge The recommended way to revert to the system install is to use the package manager to reinstall the libinput package. In some cases, this may leave files in the system (e.g. ```/usr/lib/libinput.la```) but these files are usually harmless. To definitely remove all files, run the following command from the libinput source directory: @code $> sudo ninja -C builddir/ uninstall @endcode or when using autotools: @code $> sudo make uninstall # WARNING: Do not restart the computer/X/the Wayland compositor after make # uninstall, reinstall the system package immediately! @endcode The following commands reinstall the current system package for libinput, overwriting manually installed files. @subsection building_selinux SELinux adjustments On systems with SELinux, overwriting the distribution-provided package with a manually built libinput may cause SELinux denials. This usually manifests when gdm does not start because it is denied access to libinput. The journal shows a log message in the form of:
May 25 15:28:42 localhost.localdomain audit[23268]: AVC avc:  denied  { execute } for  pid=23268 comm="gnome-shell" path="/usr/lib64/libinput.so.10.12.2" dev="dm-0" ino=1709093 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0
May 25 15:28:42 localhost.localdomain org.gnome.Shell.desktop[23270]: /usr/bin/gnome-shell: error while loading shared libraries: libinput.so.10: failed to map segment from shared object
The summary of this error message is that gdm's gnome-shell runs in the ```system_u:system_r:xdm_t``` context but libinput is installed with the context ```unconfined_u:object_r:user_home_t```. To avoid this issue, restore the SELinux context for any system files.
$> sudo restorecon /usr/lib*/libinput.so.*
This issue is tracked in https://github.com/mesonbuild/meson/issues/1967. @subsection building_dependencies 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: 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. @subsection building_libwacom 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 @ref building. @code $> meson --prefix=/usr -Dlibwacom=false builddir @endcode or when building with autotools: @code $> ./autogen.sh --disable-libwacom --prefix=/usr --libdir=/usr/lib64 @endcode It is not recommended to disable libwacom unless libinput is used in an environment where tablet support is not required. libinput provides tablet support even without libwacom, but some features may be missing or working differently. @subsection buildling_debug-gui Building without the graphical helper tool The @ref tools provide commandline features as well as graphical debugging features. To keep dependencies in check on some builds, the graphical features of the @ref tools can be disabled. By default, the `debug-gui` feature of the `libinput` tool is enabled and if the required libraries are not available, the build will fail. If the feature is not required, use the ``--disable-debug-gui`` argument when @ref building. @code $> meson --prefix=/usr -Ddebug-gui=false builddir @endcode or when building with autotools: @code $> ./autogen.sh --disable-debug-gui --prefix=/usr --libdir=/usr/lib64 @endcode @section building_against Building against libinput libinput provides a [pkg-config](https://www.freedesktop.org/wiki/Software/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: @code gcc -o myprogram myprogram.c `pkg-config --cflags --libs libinput` @endcode For further information on using pkgconfig see the pkg-config documentation. */