12

Coming mostly from Fedora and Archlinux I used to have the latest libinput available in a reasonable time. Currently, on ubuntu 18.04 I do not see how can I have the latest libinput e.g. 1.12 at the time of writing on my machine. Is there a ppa or has anyone tried to install it from source without messing up the whole system?

I do not mind to compile it but I am not well educated in testing it and making sure it is working in conjunction with other packages properly. Having ThinkPad TrackPoint I kinda feel having the latest libinput is crucial!

Mohamad
  • 231
  • 2
  • 9
  • I was about to write an answer, but figured I don't know how to assemble a package correctly (specifically, which packages your libinput-git would replace, there's more than one), and don't have Ubuntu handy to test (I'm on Archlinux). Hopefully, you can build an answer upon my next comment. – Hi-Angel Sep 12 '18 at 05:16
  • 1
    More-or-less recent packages probably can be gotten from here. Building from source is easy: git clone https://gitlab.freedesktop.org/libinput/libinput.git, and then follow steps from the build() function from here (correct libexecdir to /usr/lib/x86_something). And lastly, you need to assemble a package from it with checkinstall -D make install command. – Hi-Angel Sep 12 '18 at 05:16
  • 1
    To address the making sure it is working in conjunction with other packages properly: the meson build (from the linked build() function) will take care of dependencies (and if not, it's a bug). You only need to take care of writing correct dependencies for package manager; checkinstall command will ask you about them (I didn't look at man for checkinstall, but it's likely you can just write a config, and feed it to checkinstall). Main purpose is to not have same file /foo in two different packages, and hence of 2 different versions (tho hopefully apt will throw an error then). – Hi-Angel Sep 12 '18 at 08:56
  • Thank you very much for the info in here. I never had experience with meson, and to be fair compilation has been fairly straightforward. I was just not sure if I should use the binaries since I didn't want to break anything, but since there is no other solution I will try and report in here about the outcome. thanks. – Mohamad Sep 13 '18 at 11:09
  • @Mohamad any news? Can you post were you able to update it or no? If yes, steps would be great. – Vadym K Jul 16 '19 at 10:54
  • @VadimK Unfortunately no. I have no problem building the packages but for some reason I find the end result is not reliable. The precision of track point is not as good as default Fedora package. – Mohamad Jul 19 '19 at 12:16
  • 2
    I will leave it here. To let users find instructions on how to build libinput. https://wayland.freedesktop.org/libinput/doc/latest/building.html – Vadym K Jul 25 '19 at 14:20
  • Any updates on this? I have an annoying issue where the touchpad jumps a lot which is supposed to be fixed in new versions of libinput. – a06e May 15 '20 at 11:54
  • @VadimK I forgot to check the answers since my question is very old but I actually tried that link and it works very nicely and it has the solution for reinstalling the distro packages in case of a mess up. If you put that as an answer I will select it as the right answer, and others can at least have a solution (kinda). – Mohamad May 16 '20 at 10:58

1 Answers1

2

Hopefully, someday someone will make a PPA with latest libinput. Until then, here are instructions on building such package yourself.

It's easy, instructions are mainly taken from here. I assume you don't need to generate docs, so I don't install dependencies for them and disable them in meson call. It's also important for --prefix to be usr in meson-configuration line, so libraries are installed to standard locations.

Step1: install build depenendencies

$ sudo apt install -y git ninja-build python3-pip
$ sudo apt build-dep libinput
$ sudo pip3 install meson

Note: although Meson is in Ubuntu repo, however in the snippet it is installed with pip. The reason is: due to Ubuntu mostly providing ancient software there's a possibility their Meson version will be too old to be able to build libinput. ATM Ubuntu 18.04 is known to have this problem, but I assume with time it may happen to other releases as well.

Step2: clone and build libinput

$ git clone https://gitlab.freedesktop.org/libinput/libinput
$ cd libinput
$ meson --prefix=/usr -Ddocumentation=false build/
$ ninja -C build/

Step3: create libinput package and install

Though easiest way of installing built libinput is by running ninja -C build install, but I strongly discourage that unless you know what you're doing (you will get untracked files all over your system that may get overwritten on system update, and depending on situation may even break libinput completely).

Instead, use this script I've written to assemble a package.

$ wget https://gist.githubusercontent.com/Hi-Angel/45030ab89a2378b42511612cbe48d247/raw/package-deb-libinput.sh
[…]
$ bash ./package-deb-libinput.sh  build/
[…]
dpkg-deb: building package 'libinput-git' in 'libinput_1.15.3-212-g60edbd2d.deb'.

You can see the name of the new package in the script output, so all that is left is to install it (note: the ./ part in the path is needed for apt to correctly interpret argument as a local file):

$ sudo apt install -y ./build/libinput_1.15.3-212-g60edbd2d.deb

To make use of installed libinput you need to restart graphics session (for example, reboot).


Reverting to older libinput

May you wish to get back the distro-provided libinput, just install libinput10 package (it will replace libinput-git):

$ apt install -y libinput10

Appendix

In case something happens to github gist, here's the current content of the script:

#!/bin/bash
set -e

if [ "$#" -ne 1 ]; then echo "Wrong number of parameters. Usage: $(basename $0) build_dir" exit 1 fi

MESON_BUILD_ROOT=$(readlink -f $1) PACKAGE_VERSION=$(grep -Po 'LIBINPUT_GIT_VERSION.*"\K.+(?=")' "$MESON_BUILD_ROOT"/libinput-git-version.h) PKG_DIR="$MESON_BUILD_ROOT"/deb mkdir -p $PKG_DIR/DEBIAN/ cat > $PKG_DIR/DEBIAN/control <<- END_OF_TEXT PACKAGE: libinput-git Version: $PACKAGE_VERSION Architecture: amd64 Maintainer: Mystique Packager Description: input device management and event handling library Depends: libevdev2, libmtdev1, libudev1, libwacom2 Conflicts: libinput10, libinput-bin, libinput-dev, libinput-tools Provides: libinput10, libinput-bin, libinput-dev, libinput-tools Homepage: https://gitlab.freedesktop.org/libinput/libinput END_OF_TEXT

cd "$MESON_BUILD_ROOT" DESTDIR=$PKG_DIR ninja install fakeroot dpkg-deb --build $PKG_DIR/ libinput_$PACKAGE_VERSION.deb

Hi-Angel
  • 3,702
  • 1
  • 29
  • 36
  • I am trying to follow your instruction but when I do sudo apt build-dep libinput I got an error You must put some 'deb-src' URIs in your sources.list – albertma789 Mar 29 '21 at 06:40
  • 1
    Ok I realized I did not tick the "source code" in my updater. Now it works. – albertma789 Mar 29 '21 at 06:45