From dd247cfb51ceb2d1af15ddcf5729e0fd9c9c01e5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 17 May 2018 15:41:43 +1000 Subject: [PATCH libinput 1/7] Revert "Drop autotools" This reverts commit 302aaa548e70cc2eeea0bf107462e921b577d3ee. --- Makefile.am | 13 +++ autogen.sh | 13 +++ configure.ac | 282 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/Makefile.am | 116 ++++++++++++++++++++++ m4/.gitignore | 5 + src/Makefile.am | 80 ++++++++++++++++ test/Makefile.am | 182 +++++++++++++++++++++++++++++++++++ tools/.gitignore | 1 + tools/Makefile.am | 79 +++++++++++++++ udev/.gitignore | 6 ++ udev/Makefile.am | 51 ++++++++++ 11 files changed, 828 insertions(+) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 doc/Makefile.am create mode 100644 m4/.gitignore create mode 100644 src/Makefile.am create mode 100644 test/Makefile.am create mode 100644 tools/.gitignore create mode 100644 tools/Makefile.am create mode 100644 udev/.gitignore create mode 100644 udev/Makefile.am diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..f897ceec --- /dev/null +++ b/Makefile.am @@ -0,0 +1,13 @@ +SUBDIRS = src doc test tools udev + +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +valgrind: + (cd test; $(MAKE) valgrind) + +AM_DISTCHECK_CONFIGURE_FLAGS = --disable-test-run + +gcov: + (cd test; $(MAKE) gcov) + +EXTRA_DIST = meson.build meson_options.txt diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..8b8a3ab8 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +test -n "$srcdir" || srcdir=`dirname "$0"` +test -n "$srcdir" || srcdir=. +( + cd "$srcdir" && + autoreconf --force -v --install +) || exit + +git config --local --get format.subjectPrefix >/dev/null 2>&1 || + git config --local format.subjectPrefix "PATCH libinput" + +test -n "$NOCONFIGURE" || exec "$srcdir/configure" "$@" diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..eabc9e14 --- /dev/null +++ b/configure.ac @@ -0,0 +1,282 @@ +AC_PREREQ([2.64]) + +m4_define([libinput_major_version], [1]) +m4_define([libinput_minor_version], [8]) +m4_define([libinput_micro_version], [0]) +m4_define([libinput_version], + [libinput_major_version.libinput_minor_version.libinput_micro_version]) + +AC_INIT([libinput], + [libinput_version], + [https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=libinput_version], + [libinput], + [http://www.freedesktop.org/wiki/Software/libinput/]) + +AC_SUBST([LIBINPUT_VERSION_MAJOR], [libinput_major_version]) +AC_SUBST([LIBINPUT_VERSION_MINOR], [libinput_minor_version]) +AC_SUBST([LIBINPUT_VERSION_MICRO], [libinput_micro_version]) +AC_SUBST([LIBINPUT_VERSION], [libinput_version]) + +AC_DEFINE([LIBINPUT_VERSION_MAJOR], [libinput_major_version], "libinput major version number") +AC_DEFINE([LIBINPUT_VERSION_MINOR], [libinput_minor_version], "libinput minor version number") +AC_DEFINE([LIBINPUT_VERSION_MICRO], [libinput_micro_version], "libinput micro version number") + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([.]) + +AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) + +# Before making a release, the LIBINPUT_LT_VERSION string should be +# modified. +# The string is of the form C:R:A. +# a) If binary compatibility has been broken (eg removed or changed interfaces) +# change to C+1:0:0. DO NOT DO THIS! Use symbol versioning instead and +# do b) instead. +# b) If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# c) If the interface is the same as the previous version, change to C:R+1:A +LIBINPUT_LT_VERSION=23:0:13 +AC_SUBST(LIBINPUT_LT_VERSION) + +AM_SILENT_RULES([yes]) +AC_USE_SYSTEM_EXTENSIONS + +# Check for programs +AC_PROG_CC_C99 +AC_PROG_CXX # Only used by build C++ test +AC_PROG_GREP +AC_PROG_SED + +# Only used for testing the hwdb +AM_PATH_PYTHON([3.0],, [:]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) + +# Initialize libtool +LT_PREREQ([2.2]) +LT_INIT + +AC_CHECK_DECL(static_assert, [], + [AC_DEFINE(static_assert(...), [/* */], [noop static_assert() replacement]), + AC_MSG_RESULT([no])], + [[#include ]]) + +PKG_PROG_PKG_CONFIG() +PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0]) +PKG_CHECK_MODULES(LIBUDEV, [libudev]) +PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 1.3]) + +AC_CHECK_LIB([m], [atan2]) +AC_CHECK_LIB([rt], [clock_gettime]) + +if test "x$GCC" = "xyes"; then + GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden" + GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes" +fi +AC_SUBST(GCC_CFLAGS) +AC_SUBST(GCC_CXXFLAGS) + +###################### +# udev configuration # +###################### +udev_dir_default="$libdir/udev" +AC_ARG_WITH(udev-dir, + AS_HELP_STRING([--with-udev-dir=DIR], + [udev base directory [[default=$udev_dir_default]]]), + [], + [with_udev_dir="yes"]) +AS_CASE($with_udev_dir, + [no|""], [AC_MSG_ERROR([You must define a udev base directory])], + [yes], [udevdir="$udev_dir_default"], + [udevdir="$with_udev_dir"]) +UDEV_DIR=${udevdir} +AC_SUBST(UDEV_DIR) + +################################ +# enable/disable documentation # +################################ +AC_ARG_ENABLE([documentation], + [AC_HELP_STRING([--enable-documentation], + [Enable building the documentation (default=yes)])], + [build_documentation="$enableval"], + [build_documentation="yes"]) + +if test "x$build_documentation" = "xyes"; then + AC_PATH_PROG(DOXYGEN, doxygen) + if test "x$DOXYGEN" = "x"; then + AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation]) + fi + + AC_MSG_CHECKING([for compatible doxygen version]) + doxygen_version=`$DOXYGEN --version` + AS_VERSION_COMPARE([$doxygen_version], [1.8.3], + [AC_MSG_RESULT([no]) + DOXYGEN=""], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])]) + if test "x$DOXYGEN" = "x"; then + AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.8.3+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation]) + fi + + AC_PATH_PROG(DOT, dot) + if test "x$DOT" = "x"; then + AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation]) + fi + + AC_MSG_CHECKING([for compatible dot version]) + dot_version=`$DOT -V 2>&1|$GREP -oP '(?<=version\W)@<:@0-9.@:>@*(?=\W(.*))'` + AS_VERSION_COMPARE([$dot_version], [2.26.0], + [AC_MSG_RESULT([no]) + DOT=""], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])]) + if test "x$DOT" = "x"; then + AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation]) + fi +fi + +######################################## +# enable/disable the debug-gui feature # +######################################## +AC_ARG_ENABLE(debug-gui, + AS_HELP_STRING([--enable-debug-gui], [Enable the 'debug-gui' feature in the libinput tool (default=yes)]), + [build_debug_gui="$enableval"], + [build_debug_gui="yes"]) + +if test "x$build_debug_gui" = "xyes"; then + PKG_CHECK_MODULES(CAIRO, [cairo]) + PKG_CHECK_MODULES(GTK, [glib-2.0 gtk+-3.0]) + AC_DEFINE(BUILD_DEBUG_GUI, 1, [Build debug-gui support]) +fi + + +######################## +# enable/disable tests # +######################## +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--enable-tests], [Build the tests (default=yes)]), + [build_tests="$enableval"], + [build_tests="yes"]) + + +if test "x$build_tests" = "xyes"; then + PKG_CHECK_MODULES(CHECK, [check >= 0.9.10]) + + AC_PATH_PROG(VALGRIND, [valgrind]) + + AC_ARG_WITH(libunwind, + AS_HELP_STRING([--without-libunwind],[Do not use libunwind])) + + if test "x$with_libunwind" != "xno"; then + PKG_CHECK_MODULES(LIBUNWIND, [libunwind]) + AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support]) + HAVE_LIBUNWIND="yes" + fi + + AC_PATH_PROG(ADDR2LINE, [addr2line]) + if test "x$ADDR2LINE" != "x"; then + AC_DEFINE_UNQUOTED(HAVE_ADDR2LINE, 1, [addr2line found]) + AC_DEFINE_UNQUOTED(ADDR2LINE, ["$ADDR2LINE"], [Path to addr2line]) + fi +fi + +AC_ARG_ENABLE(test-run, + AS_HELP_STRING([--enable-test-run], [For internal use only]), + [run_tests="$enableval"], + [run_tests="yes"]) + +# Used by the udev rules so we can use callouts during testing without +# installing everything first. Default is the empty string so the installed +# rule will use udev's default path. Override is in udev/Makefile.am +AC_SUBST(UDEV_TEST_PATH, "") +AC_PATH_PROG(SED, [sed]) + +########################### +# enable/disable libwacom # +########################### + +AC_ARG_ENABLE(libwacom, + AS_HELP_STRING([--enable-libwacom], + [Use libwacom for tablet identification (default=enabled)]), + [use_libwacom="$enableval"], + [use_libwacom="yes"]) +if test "x$use_libwacom" = "xyes"; then + PKG_CHECK_MODULES(LIBWACOM, [libwacom >= 0.20], [HAVE_LIBWACOM="yes"]) + AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom]) + + OLD_LIBS=$LIBS + OLD_CFLAGS=$CFLAGS + LIBS="$LIBS $LIBWACOM_LIBS" + CFLAGS="$CFLAGS $LIBWACOM_CFLAGS" + AC_MSG_CHECKING([if libwacom_get_paired_device is available]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[libwacom_get_paired_device(NULL)]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_LIBWACOM_GET_PAIRED_DEVICE, [1], + [libwacom_get_paired_device() is available]) + [libwacom_have_get_paired_device=yes]], + [AC_MSG_RESULT([no]) + [libwacom_have_get_paired_device=no]]) + LIBS=$OLD_LIBS + CFLAGS=$OLD_CFLAGS +fi + +AM_CONDITIONAL(HAVE_LIBWACOM_GET_PAIRED_DEVICE, + [test "x$libwacom_have_get_paired_device" == "xyes"]) + + +####################### +# enable/disable gcov # +####################### + +AC_ARG_ENABLE([gcov], + [AS_HELP_STRING([--enable-gcov], + [Enable to enable coverage testing (default:disabled)])], + [enable_gcov="$enableval"], + [enable_gcov=no]) +if test "x$enable_gcov" != "xno"; then + GCOV_CFLAGS="-fprofile-arcs -ftest-coverage" + GCOV_LDFLAGS="-fprofile-arcs -ftest-coverage" + enable_gcov=yes +fi + +AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" != "xno"]) +AC_SUBST([GCOV_CFLAGS]) +AC_SUBST([GCOV_LDFLAGS]) + +AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"]) +AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"]) +AM_CONDITIONAL(RUN_TESTS, [test "x$run_tests" = "xyes"]) +AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"]) +AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = "xyes"]) +AM_CONDITIONAL(BUILD_DEBUG_GUI, [test "x$build_debug_gui" = "xyes"]) + +AC_CONFIG_FILES([Makefile + doc/Makefile + doc/libinput.doxygen + src/Makefile + src/libinput.pc + src/libinput-uninstalled.pc + src/libinput-version.h + test/Makefile + tools/Makefile + udev/Makefile + udev/80-libinput-device-groups.rules + udev/90-libinput-model-quirks.rules]) +AC_CONFIG_FILES([test/symbols-leak-test], + [chmod +x test/symbols-leak-test]) +AC_OUTPUT + +AC_MSG_RESULT([ + Prefix ${prefix} + udev base dir ${UDEV_DIR} + + libwacom enabled ${use_libwacom} + Build documentation ${build_documentation} + Build tests ${build_tests} + Tests use valgrind ${VALGRIND} + Tests use libunwind ${HAVE_LIBUNWIND} + Build GUI event tool ${build_debug_gui} + Enable gcov profiling ${enable_gcov} + ]) diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 00000000..382f64da --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,116 @@ +EXTRA_DIST = \ + middle-button-emulation.svg \ + touchpad-tap-state-machine.svg \ + touchpad-softbutton-state-machine.svg + +header_files = \ + $(top_srcdir)/src/libinput.h \ + $(top_srcdir)/README.md \ + $(srcdir)/absolute-axes.dox \ + $(srcdir)/absolute-coordinate-ranges.dox \ + $(srcdir)/building.dox \ + $(srcdir)/clickpad-softbuttons.dox \ + $(srcdir)/contributing.dox \ + $(srcdir)/device-configuration-via-udev.dox \ + $(srcdir)/faqs.dox \ + $(srcdir)/gestures.dox \ + $(srcdir)/middle-button-emulation.dox \ + $(srcdir)/normalization-of-relative-motion.dox \ + $(srcdir)/palm-detection.dox \ + $(srcdir)/page-hierarchy.dox \ + $(srcdir)/pointer-acceleration.dox \ + $(srcdir)/reporting-bugs.dox \ + $(srcdir)/scrolling.dox \ + $(srcdir)/seats.dox \ + $(srcdir)/switches.dox \ + $(srcdir)/t440-support.dox \ + $(srcdir)/tablet-support.dox \ + $(srcdir)/tapping.dox \ + $(srcdir)/test-suite.dox \ + $(srcdir)/timestamps.dox \ + $(srcdir)/tools.dox \ + $(srcdir)/touchpad-jumping-cursors.dox \ + $(srcdir)/touchpad-pressure.dox \ + $(srcdir)/touchpads.dox \ + $(srcdir)/what-is-libinput.dox + +diagram_files = \ + $(srcdir)/dot/seats-sketch.gv \ + $(srcdir)/dot/seats-sketch-libinput.gv \ + $(srcdir)/dot/libinput-stack-wayland.gv \ + $(srcdir)/dot/libinput-stack-xorg.gv \ + $(srcdir)/dot/libinput-stack-gnome.gv \ + $(srcdir)/dot/evemu.gv \ + $(srcdir)/svg/button-scrolling.svg \ + $(srcdir)/svg/clickfinger.svg \ + $(srcdir)/svg/clickfinger-distance.svg \ + $(srcdir)/svg/edge-scrolling.svg \ + $(srcdir)/svg/gesture-2fg-ambiguity.svg \ + $(srcdir)/svg/palm-detection.svg \ + $(srcdir)/svg/pinch-gestures.svg \ + $(srcdir)/svg/pinch-gestures-softbuttons.svg \ + $(srcdir)/svg/ptraccel-linear.svg \ + $(srcdir)/svg/ptraccel-low-dpi.svg \ + $(srcdir)/svg/ptraccel-touchpad.svg \ + $(srcdir)/svg/ptraccel-trackpoint.svg \ + $(srcdir)/svg/software-buttons.svg \ + $(srcdir)/svg/swipe-gestures.svg \ + $(srcdir)/svg/tablet-axes.svg \ + $(srcdir)/svg/tablet-cintiq24hd-modes.svg \ + $(srcdir)/svg/tablet-interfaces.svg \ + $(srcdir)/svg/tablet-intuos-modes.svg \ + $(srcdir)/svg/tablet-left-handed.svg \ + $(srcdir)/svg/tablet-out-of-bounds.svg \ + $(srcdir)/svg/tablet.svg \ + $(srcdir)/svg/tap-n-drag.svg \ + $(srcdir)/svg/thumb-detection.svg \ + $(srcdir)/svg/top-software-buttons.svg \ + $(srcdir)/svg/touchscreen-gestures.svg \ + $(srcdir)/svg/twofinger-scrolling.svg + +style_files = \ + style/header.html \ + style/footer.html \ + style/customdoxygen.css \ + style/bootstrap.css \ + style/libinputdoxygen.css + +if BUILD_DOCS + +noinst_DATA = html/index.html + +html/index.html: libinput.doxygen $(header_files) $(diagram_files) $(style_files) + $(AM_V_GEN)(cat $<; \ + echo "INPUT = $(header_files)"; \ + ) | $(DOXYGEN) - + +clean-local: + $(AM_V_at)rm -rf html + +doc_src= $(shell find html -type f -printf "html/%P\n" 2>/dev/null) +EXTRA_DIST += $(builddir)/html/index.html \ + $(doc_src) +endif + +EXTRA_DIST += $(diagram_files) \ + $(header_files) \ + $(style_files) + +local_svg = $(shell find $(srcdir)/svg -type f -printf "$(srcdir)/svg/%P\n" 2>/dev/null) +local_dotfiles = $(shell find $(srcdir)/dot -type f -printf "$(srcdir)/dot/%P\n" 2>/dev/null) + +check: + @files=`echo $(local_svg) $(local_dotfiles) $(diagram_files) | tr ' ' '\n' | sort | uniq -u` && \ + test -z "$$files" || (\ + echo "SVG/dotfiles files present but missing from the Makefile.am:" && \ + echo "$$files" && \ + test) + +# make sure doc was built before running dist +dist-hook: + @test -f $(distdir)/html/index.html || (\ + echo "******************************************************" && \ + echo "Couldn't find documentation files, refusing make dist." && \ + echo "Install doxygen to build documentation for the tarball." && \ + echo "******************************************************" && \ + test ) diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 00000000..38066ddf --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1,5 @@ +libtool.m4 +ltoptions.m4 +ltsugar.m4 +ltversion.m4 +lt~obsolete.m4 diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 00000000..6723d5ae --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,80 @@ +lib_LTLIBRARIES = libinput.la +noinst_LTLIBRARIES = libinput-util.la \ + libfilter.la + +include_HEADERS = \ + libinput.h + +libinput_la_SOURCES = \ + libinput.c \ + libinput.h \ + libinput-private.h \ + evdev.c \ + evdev.h \ + evdev-lid.c \ + evdev-middle-button.c \ + evdev-mt-touchpad.c \ + evdev-mt-touchpad.h \ + evdev-mt-touchpad-tap.c \ + evdev-mt-touchpad-buttons.c \ + evdev-mt-touchpad-edge-scroll.c \ + evdev-mt-touchpad-gestures.c \ + evdev-tablet.c \ + evdev-tablet.h \ + evdev-tablet-pad.c \ + evdev-tablet-pad.h \ + evdev-tablet-pad-leds.c \ + filter.c \ + filter.h \ + filter-private.h \ + path-seat.h \ + path-seat.c \ + udev-seat.c \ + udev-seat.h \ + timer.c \ + timer.h \ + ../include/linux/input.h + +libinput_la_LIBADD = $(MTDEV_LIBS) \ + $(LIBUDEV_LIBS) \ + $(LIBEVDEV_LIBS) \ + $(LIBWACOM_LIBS) \ + libinput-util.la +libinput_la_LDFLAGS = $(GCOV_LDFLAGS) \ + -version-info $(LIBINPUT_LT_VERSION) -shared \ + -Wl,--version-script=$(srcdir)/libinput.sym + +libinput_la_CFLAGS = -I$(top_srcdir)/include \ + $(MTDEV_CFLAGS) \ + $(LIBUDEV_CFLAGS) \ + $(LIBEVDEV_CFLAGS) \ + $(LIBWACOM_CFLAGS) \ + $(GCC_CFLAGS) \ + $(GCOV_CFLAGS) +EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym + +libinput_util_la_SOURCES = \ + libinput-util.c \ + libinput-util.h + +libinput_util_la_LIBADD = +libinput_util_la_LDFLAGS = $(GCOV_LDFLAGS) +libinput_util_la_CFLAGS = -I$(top_srcdir)/include \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) \ + $(GCOV_CFLAGS) + +libfilter_la_SOURCES = \ + filter.c \ + filter.h \ + filter-private.h +libfilter_la_LIBADD = +libfilter_la_CFLAGS = + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libinput.pc + +AM_CFLAGS = $(GCC_CFLAGS) + +DISTCLEANFILES = libinput-version.h +EXTRA_DIST = libinput-version.h.in libinput.sym libinput-restore-selinux-context.sh diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 00000000..5cb89a65 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,182 @@ +if BUILD_TESTS +AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + $(CHECK_CFLAGS) \ + $(LIBEVDEV_CFLAGS) \ + $(LIBUDEV_CFLAGS) \ + -I$(top_builddir)/src # for libinput-version.h + +AM_CFLAGS = $(GCC_CFLAGS) $(GCOV_CFLAGS) +AM_CXXFLAGS = $(GCC_CXXFLAGS) + +TEST_LIBS = liblitest.la $(CHECK_LIBS) $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) $(top_builddir)/src/libinput.la +noinst_LTLIBRARIES = liblitest.la +liblitest_la_SOURCES = \ + litest.h \ + litest-int.h \ + litest-device-acer-hawaii-keyboard.c \ + litest-device-acer-hawaii-touchpad.c \ + litest-device-alps-semi-mt.c \ + litest-device-alps-dualpoint.c \ + litest-device-anker-mouse-kbd.c \ + litest-device-apple-appletouch.c \ + litest-device-apple-internal-keyboard.c \ + litest-device-apple-magicmouse.c \ + litest-device-asus-rog-gladius.c \ + litest-device-atmel-hover.c \ + litest-device-bcm5974.c \ + litest-device-calibrated-touchscreen.c \ + litest-device-cyborg-rat-5.c \ + litest-device-elantech-touchpad.c \ + litest-device-generic-singletouch.c \ + litest-device-huion-pentablet.c \ + litest-device-keyboard.c \ + litest-device-keyboard-all-codes.c \ + litest-device-keyboard-razer-blackwidow.c \ + litest-device-lid-switch.c \ + litest-device-lid-switch-surface3.c \ + litest-device-logitech-trackball.c \ + litest-device-nexus4-touch-screen.c \ + litest-device-magic-trackpad.c \ + litest-device-mouse.c \ + litest-device-mouse-wheel-tilt.c \ + litest-device-mouse-roccat.c \ + litest-device-mouse-low-dpi.c \ + litest-device-mouse-wheel-click-angle.c \ + litest-device-mouse-wheel-click-count.c \ + litest-device-ms-surface-cover.c \ + litest-device-protocol-a-touch-screen.c \ + litest-device-qemu-usb-tablet.c \ + litest-device-synaptics.c \ + litest-device-synaptics-hover.c \ + litest-device-synaptics-i2c.c \ + litest-device-synaptics-rmi4.c \ + litest-device-synaptics-st.c \ + litest-device-synaptics-t440.c \ + litest-device-synaptics-x1-carbon-3rd.c \ + litest-device-trackpoint.c \ + litest-device-touch-screen.c \ + litest-device-touchscreen-fuzz.c \ + litest-device-wacom-bamboo-16fg-pen.c \ + litest-device-wacom-cintiq-12wx-pen.c \ + litest-device-wacom-cintiq-13hdt-finger.c \ + litest-device-wacom-cintiq-13hdt-pad.c \ + litest-device-wacom-cintiq-13hdt-pen.c \ + litest-device-wacom-cintiq-24hd-pen.c \ + litest-device-wacom-cintiq-24hdt-pad.c \ + litest-device-wacom-ekr.c \ + litest-device-wacom-hid4800-pen.c \ + litest-device-wacom-intuos3-pad.c \ + litest-device-wacom-intuos5-finger.c \ + litest-device-wacom-intuos5-pad.c \ + litest-device-wacom-intuos5-pen.c \ + litest-device-wacom-isdv4-e6-pen.c \ + litest-device-wacom-isdv4-e6-finger.c \ + litest-device-waltop-tablet.c \ + litest-device-wheel-only.c \ + litest-device-xen-virtual-pointer.c \ + litest-device-vmware-virtual-usb-mouse.c \ + litest-device-yubikey.c \ + litest.c +liblitest_la_LIBADD = $(top_builddir)/src/libinput-util.la +liblitest_la_CFLAGS = $(AM_CFLAGS) \ + -DLIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE="\"$(abs_top_builddir)/udev/90-libinput-model-quirks-litest.rules\"" \ + -DLIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE="\"$(abs_top_srcdir)/udev/90-libinput-model-quirks.hwdb\"" \ + -DLIBINPUT_TEST_DEVICE_RULES_FILE="\"$(abs_top_srcdir)/udev/80-libinput-test-device.rules\"" \ + -DLIBINPUT_DEVICE_GROUPS_RULES_FILE="\"$(abs_top_srcdir)/udev/80-libinput-device-groups-litest.rules\"" +if HAVE_LIBUNWIND +liblitest_la_LIBADD += $(LIBUNWIND_LIBS) -ldl +liblitest_la_CFLAGS += $(LIBUNWIND_CFLAGS) +endif + +run_tests = \ + test-litest-selftest \ + libinput-test-suite-runner + +build_tests = \ + test-build-cxx \ + test-build-linker \ + test-build-pedantic-c99 \ + test-build-std-gnuc90 + +noinst_PROGRAMS = $(build_tests) $(run_tests) +noinst_SCRIPTS = symbols-leak-test + +if RUN_TESTS +TESTS = $(run_tests) symbols-leak-test +endif + +libinput_test_suite_runner_SOURCES = test-udev.c \ + test-path.c \ + test-pointer.c \ + test-touch.c \ + test-log.c \ + test-tablet.c \ + test-pad.c \ + test-touchpad.c \ + test-touchpad-tap.c \ + test-touchpad-buttons.c \ + test-trackpoint.c \ + test-trackball.c \ + test-misc.c \ + test-keyboard.c \ + test-device.c \ + test-gestures.c \ + test-lid.c + +libinput_test_suite_runner_CFLAGS = $(AM_CFLAGS) -DLIBINPUT_LT_VERSION="\"$(LIBINPUT_LT_VERSION)\"" +libinput_test_suite_runner_LDADD = $(TEST_LIBS) +libinput_test_suite_runner_LDFLAGS = -no-install + +test_litest_selftest_SOURCES = litest-selftest.c litest.c litest-int.h litest.h +test_litest_selftest_CFLAGS = -DLITEST_DISABLE_BACKTRACE_LOGGING -DLITEST_NO_MAIN $(liblitest_la_CFLAGS) +test_litest_selftest_LDADD = $(TEST_LIBS) +test_litest_selftest_LDFLAGS = -no-install +if HAVE_LIBUNWIND +test_litest_selftest_LDADD += $(LIBUNWIND_LIBS) -ldl +test_litest_selftest_CFLAGS += $(LIBUNWIND_CFLAGS) +endif + +# build-test only +test_build_pedantic_c99_SOURCES = build-pedantic.c +test_build_pedantic_c99_CFLAGS = -std=c99 -pedantic -Werror + +test_build_std_gnuc90_SOURCES = build-pedantic.c +test_build_std_gnuc90_CFLAGS = -std=gnu90 -Werror + +# test for linking with the minimal linker flags +test_build_linker_SOURCES = build-pedantic.c +test_build_linker_CFLAGS = -I$(top_srcdir)/src +test_build_linker_LDADD = $(top_builddir)/src/libinput.la $(top_builddir)/src/libinput-util.la + +# test including from C++ +test_build_cxx_SOURCES = build-cxx.cc +test_build_cxx_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(AM_CXXFLAGS) + +if HAVE_VALGRIND +VALGRIND_FLAGS=--leak-check=full \ + --quiet \ + --error-exitcode=3 \ + --suppressions=$(srcdir)/valgrind.suppressions + +valgrind: check-am + $(MAKE) check-TESTS TEST_SUITE_LOG="test-suite-valgrind.log" LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)" CK_FORK=no USING_VALGRIND=yes + +check: valgrind + +DISTCLEANFILES=test-suite-valgrind.log + +endif +endif +EXTRA_DIST=valgrind.suppressions + +if GCOV_ENABLED + +CLEANFILES = gcov-reports/*.gcov gcov-reports/summary.txt *.gcno *.gcda + +gcov: generate-gcov-report.sh check-TESTS + $(AM_V_GEN)$(srcdir)/generate-gcov-report.sh gcov-reports $(top_builddir)/src $(builddir) +else +gcov: + @echo "Run ./configure --enable-gcov to produce gcov reports" && false +endif diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 00000000..efc83c45 --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1 @@ +ptraccel-debug diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 00000000..2c8660bf --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,79 @@ +noinst_PROGRAMS = ptraccel-debug +bin_PROGRAMS = libinput +toolsdir = $(libexecdir)/libinput +tools_PROGRAMS = +bin_SCRIPTS = libinput-list-devices.compat libinput-debug-events.compat +noinst_LTLIBRARIES = libshared.la + +AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_builddir)/src # for libinput-version.h +AM_CFLAGS = $(GCC_CFLAGS) +AM_CXXFLAGS = $(GCC_CXXFLAGS) + +libshared_la_SOURCES = \ + shared.c \ + shared.h +libshared_la_CFLAGS = $(AM_CFLAGS) $(LIBEVDEV_CFLAGS) $(LIBUDEV_CFLAGS) \ + -DLIBINPUT_TOOL_PATH="\"@libexecdir@/libinput\"" +libshared_la_LIBADD = $(LIBEVDEV_LIBS) $(LIBUDEV_LIBS) ../src/libinput.la + +ptraccel_debug_SOURCES = ptraccel-debug.c +ptraccel_debug_LDADD = ../src/libfilter.la ../src/libinput.la +ptraccel_debug_LDFLAGS = -no-install + +libinput_SOURCES = libinput-tool.c +libinput_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +libinput_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) +dist_man1_MANS = libinput.1 + +tools_PROGRAMS += libinput-list-devices +libinput_list_devices_SOURCES = libinput-list-devices.c $(shared_sources) +libinput_list_devices_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +libinput_list_devices_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) +dist_man1_MANS += libinput-list-devices.1 + +tools_PROGRAMS += libinput-debug-events +libinput_debug_events_SOURCES = libinput-debug-events.c $(shared_sources) +libinput_debug_events_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +libinput_debug_events_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) +dist_man1_MANS += libinput-debug-events.1 + +tools_PROGRAMS += libinput-measure +libinput_measure_SOURCES = libinput-measure.c $(shared_sources) +libinput_measure_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +libinput_measure_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) \ + -DLIBINPUT_TOOL_PATH="\"@libexecdir@/libinput\"" +dist_man1_MANS += libinput-measure.1 + +tools_PROGRAMS += libinput-measure-touchpad-tap +libinput_measure_touchpad_tap_SOURCES = \ + libinput-measure-touchpad-tap.c +libinput_measure_touchpad_tap_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +libinput_measure_touchpad_tap_CFLAGS = $(AM_CFLAGS) $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) +dist_man1_MANS += libinput-measure-touchpad-tap.1 + +if BUILD_DEBUG_GUI +tools_PROGRAMS += libinput-debug-gui +libinput_debug_gui_SOURCES = libinput-debug-gui.c +libinput_debug_gui_LDADD = ../src/libinput.la libshared.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBEVDEV_LIBS) $(LIBUDEV_LIBS) +libinput_debug_gui_CFLAGS = $(AM_CFLAGS) $(CAIRO_CFLAGS) $(GTK_CFLAGS) $(LIBEVDEV_CFLAGS) $(LIBUDEV_CFLAGS) +dist_man1_MANS += libinput-debug-gui.1 +endif + +EXTRA_DIST = make-ptraccel-graphs.sh install-compat-scripts.sh $(bin_SCRIPTS) + +install-data-hook: + (cd $(DESTDIR)$(bindir) && mv libinput-list-devices.compat libinput-list-devices) + (cd $(DESTDIR)$(bindir) && mv libinput-debug-events.compat libinput-debug-events) + +uninstall-local: + rm -f $(DESTDIR)$(bindir)/libinput-list-devices + rm -f $(DESTDIR)$(bindir)/libinput-debug-events + +SUFFIXES = .man +.man.1: + $(AM_V_GEN)$(SED) -e 's|\@LIBINPUT_VERSION\@|$(PACKAGE_VERSION)|' < $< > $@ +CLEANFILES = *.1 +EXTRA_DIST += $(dist_man1_MANS:.1=.man) + diff --git a/udev/.gitignore b/udev/.gitignore new file mode 100644 index 00000000..cad377a8 --- /dev/null +++ b/udev/.gitignore @@ -0,0 +1,6 @@ +libinput-device-group +libinput-model-quirks +80-libinput-device-groups-litest.rules +80-libinput-device-groups.rules +90-libinput-model-quirks-litest.rules +90-libinput-model-quirks.rules diff --git a/udev/Makefile.am b/udev/Makefile.am new file mode 100644 index 00000000..2c852a09 --- /dev/null +++ b/udev/Makefile.am @@ -0,0 +1,51 @@ +udevdir=$(UDEV_DIR) +udev_PROGRAMS = libinput-device-group \ + libinput-model-quirks + +litest_rules = 80-libinput-device-groups-litest.rules \ + 90-libinput-model-quirks-litest.rules +noinst_SCRIPTS = $(litest_rules) + +libinput_device_group_SOURCES = libinput-device-group.c +libinput_device_group_CFLAGS = -I$(top_srcdir)/src \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) +libinput_device_group_LDADD = $(LIBUDEV_LIBS) + +if HAVE_LIBWACOM_GET_PAIRED_DEVICE +libinput_device_group_CFLAGS += $(LIBWACOM_CFLAGS) +libinput_device_group_LDADD += $(LIBWACOM_LIBS) +endif + +libinput_model_quirks_SOURCES = libinput-model-quirks.c +libinput_model_quirks_CFLAGS = \ + -I$(top_srcdir)/src \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) +libinput_model_quirks_LDADD = $(LIBUDEV_LIBS) + +udev_rulesdir=$(UDEV_DIR)/rules.d +dist_udev_rules_DATA = \ + 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules + +udev_hwdbdir=$(UDEV_DIR)/hwdb.d +dist_udev_hwdb_DATA = \ + 90-libinput-model-quirks.hwdb + +%-litest.rules: %.rules.in + $(SED) -e "s|\@UDEV_TEST_PATH\@|$(abs_builddir)/|" < $^ > $@ + +CLEANFILES = $(litest_rules) +DISTCLEANFILES = \ + 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules +EXTRA_DIST = 80-libinput-test-device.rules + +TEST_EXTENSIONS = .py + +if HAVE_PYTHON +TESTS = parse_hwdb.py +PY_LOG_COMPILER = $(PYTHON) +endif +EXTRA_DIST += parse_hwdb.py -- 2.14.3