dev-libs: add libinput

The lib is required for support legacy or odd touchpads.

BUG=b:192668524
TEST=setup_board --board=${BOARD}, emerge-${BOARD} libinput

Change-Id: Ia310030c549e499de8dfbd54a4a895774ae50169
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/overlays/portage-stable/+/3143772
Tested-by: Marek Maƛlanka <mm@semihalf.com>
Commit-Queue: Marcin Wojtas <mwojtas@google.com>
Reviewed-by: Nicholas Bishop <nicholasbishop@google.com>
Reviewed-by: Harry Cutts <hcutts@chromium.org>
diff --git a/dev-libs/libinput/Manifest b/dev-libs/libinput/Manifest
new file mode 100644
index 0000000..3406b14
--- /dev/null
+++ b/dev-libs/libinput/Manifest
@@ -0,0 +1 @@
+DIST libinput-1.18.0.tar.xz 616732 BLAKE2B 4f12080b5e3496fdb5ccb1375a073860c26037ba47033a7d2d69a2f817b4ab5791aa89be08b193925cddd566a04144c73399cbb196a4cc9d3e07dcfb806d3eff SHA512 9a834f075d7a1f892416bb6b241eb052f749d3aa883c4b39c0f1c9616c115d6b9a541b587508646fddaf0d3fe57af92fe4629b522d1d51196499e7b523e0aa90
diff --git a/dev-libs/libinput/OWNERS b/dev-libs/libinput/OWNERS
new file mode 100644
index 0000000..45d1e25
--- /dev/null
+++ b/dev-libs/libinput/OWNERS
@@ -0,0 +1,5 @@
+include chromiumos/platform/gestures:/OWNERS
+
+aczubak@google.com
+mmaslanka@google.com
+nicholasbishop@google.com
diff --git a/dev-libs/libinput/libinput-1.18.0.ebuild b/dev-libs/libinput/libinput-1.18.0.ebuild
new file mode 100644
index 0000000..1425fc2
--- /dev/null
+++ b/dev-libs/libinput/libinput-1.18.0.ebuild
@@ -0,0 +1,88 @@
+# Copyright 2014-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+
+inherit meson python-any-r1 udev
+
+DESCRIPTION="Library to handle input devices in Wayland"
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/libinput/ https://gitlab.freedesktop.org/libinput/libinput"
+SRC_URI="https://www.freedesktop.org/software/${PN}/${P}.tar.xz"
+
+LICENSE="MIT"
+SLOT="0/10"
+[[ "$(ver_cut 3)" -gt 900 ]] || \
+KEYWORDS="*"
+IUSE="doc input_devices_wacom test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+	virtual/pkgconfig
+	doc? (
+		$(python_gen_any_dep '
+			dev-python/commonmark[${PYTHON_USEDEP}]
+			dev-python/recommonmark[${PYTHON_USEDEP}]
+			dev-python/sphinx[${PYTHON_USEDEP}]
+			>=dev-python/sphinx_rtd_theme-0.2.4[${PYTHON_USEDEP}]
+		')
+		>=app-doc/doxygen-1.8.3
+		>=media-gfx/graphviz-2.38.0
+	)
+"
+#	test? ( dev-util/valgrind )
+RDEPEND="
+	input_devices_wacom? ( >=dev-libs/libwacom-0.20 )
+	>=dev-libs/libevdev-1.3
+	>=sys-libs/mtdev-1.1
+	virtual/libudev:=
+	virtual/udev
+"
+DEPEND="${RDEPEND}
+	test? ( >=dev-libs/check-0.9.10 )"
+
+python_check_deps() {
+	has_version "dev-python/commonmark[${PYTHON_USEDEP}]" && \
+	has_version "dev-python/recommonmark[${PYTHON_USEDEP}]" && \
+	has_version "dev-python/sphinx[${PYTHON_USEDEP}]" && \
+	has_version ">=dev-python/sphinx_rtd_theme-0.2.4[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+	use doc && python-any-r1_pkg_setup
+}
+
+src_prepare() {
+	default
+	sed "s@, '-Werror'@@" -i meson.build || die #744250
+}
+
+src_configure() {
+	# gui can be built but will not be installed
+	local emesonargs=(
+		-Ddebug-gui=false
+		$(meson_use doc documentation)
+		$(meson_use input_devices_wacom libwacom)
+		$(meson_use test tests)
+		-Dudev-dir="${EPREFIX}$(get_udevdir)"
+	)
+	meson_src_configure
+}
+
+src_install() {
+	meson_src_install
+	if use doc ; then
+		docinto html
+		dodoc -r "${BUILD_DIR}"/Documentation/.
+	fi
+}
+
+pkg_postinst() {
+	pkgname="dev-python/python-libevdev"
+	if [[ -z "${REPLACING_VERSIONS}" ]] && ! has_version "${pkgname}" ; then
+		einfo "${pkgname} must be installed to use the"
+		einfo "libinput measure and libinput replay tools."
+	fi
+
+	udevadm hwdb --update --root="${ROOT}"
+}
diff --git a/dev-libs/libinput/metadata.xml b/dev-libs/libinput/metadata.xml
new file mode 100644
index 0000000..bab037f
--- /dev/null
+++ b/dev-libs/libinput/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+	<email>gnome@gentoo.org</email>
+	<name>Gentoo GNOME Desktop</name>
+</maintainer>
+<maintainer type="project">
+	<email>x11@gentoo.org</email>
+	<name>X11</name>
+</maintainer>
+<maintainer type="person">
+	<email>polynomial-c@gentoo.org</email>
+	<name>Lars Wendler</name>
+</maintainer>
+</pkgmetadata>