diff --git a/x11/libinput/Makefile b/x11/libinput/Makefile index 9b512e7f25d3..910bd21b2f69 100644 --- a/x11/libinput/Makefile +++ b/x11/libinput/Makefile @@ -1,45 +1,64 @@ PORTNAME= libinput DISTVERSION= 1.28.1 CATEGORIES= x11 MAINTAINER= x11@FreeBSD.org COMMENT= Generic input library WWW= https://www.freedesktop.org/wiki/Software/libinput/ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}evdev>0:devel/py-evdev@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pyudev>0:devel/py-pyudev@${PY_FLAVOR} LIB_DEPENDS= libevdev.so:devel/libevdev \ libepoll-shim.so:devel/libepoll-shim \ libudev.so:devel/libudev-devd \ libmtdev.so:devel/libmtdev +TEST_DEPENDS= bash:shells/bash \ + ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} -USES= cpe localbase meson pkgconfig python:run shebangfix +USES= cpe localbase meson pkgconfig python:run,test shebangfix USE_LDCONFIG= yes USE_GITLAB= yes GL_SITE= https://gitlab.freedesktop.org CPE_VENDOR= freedesktop -MESON_ARGS= -Ddocumentation=false -Dtests=false +MESON_ARGS= -Ddocumentation=false -SHEBANG_FILES= tools/*.py +SHEBANG_FILES= tools/*.py \ + test/*.py \ + test/*.sh \ + test/symbols-leak-test -OPTIONS_DEFINE= DEBUG_GUI LIBWACOM +OPTIONS_DEFINE= DEBUG_GUI LIBWACOM TEST OPTIONS_DEFAULT=LIBWACOM OPTIONS_SUB= yes DEBUG_GUI_DESC= Build the GUI event viewer LIBWACOM_DESC= Libwacom support DEBUG_GUI_USES= gnome xorg DEBUG_GUI_USE= GNOME=gtk30,glib20,cairo xorg=x11 DEBUG_GUI_LIB_DEPENDS= libwayland-client.so:graphics/wayland DEBUG_GUI_MESON_TRUE= debug-gui LIBWACOM_LIB_DEPENDS= libwacom.so:x11/libwacom LIBWACOM_MESON_TRUE= libwacom +# If built with WITH_DEBUG=yes running tests require /dev/input/* devices +# In case of poudriere jail run following commands on host: +# devfs -m /usr/local/poudriere/data/.m/-/ref/dev rule apply path 'input' unhide +# devfs -m /usr/local/poudriere/data/.m/-/ref/dev rule apply path 'input/*' unhide +TEST_LIB_DEPENDS= libcheck.so:devel/check +TEST_MESON_TRUE= tests + +TESTING_UNSAFE= Some tests fail until https://github.com/wulf7/libudev-devd/pull/13 + +post-patch: + ${REINPLACE_CMD} -e 's|sed|sed -E|g' ${WRKSRC}/test/symbols-leak-test + +post-install: + ${RM} -r ${STAGEDIR}${PREFIX}/lib/udev .include diff --git a/x11/libinput/files/patch-meson.build b/x11/libinput/files/patch-meson.build deleted file mode 100644 index 71925a531a3e..000000000000 --- a/x11/libinput/files/patch-meson.build +++ /dev/null @@ -1,20 +0,0 @@ ---- meson.build.orig 2020-02-03 05:25:43 UTC -+++ meson.build -@@ -152,6 +152,8 @@ endif - - ############ udev bits ############ - -+if false -+ - executable('libinput-device-group', - 'udev/libinput-device-group.c', - dependencies : [dep_udev, dep_libwacom], -@@ -192,6 +194,8 @@ litest_groups_rules_file = configure_file(input : 'ude - litest_fuzz_override_file = configure_file(input : 'udev/90-libinput-fuzz-override.rules.in', - output : '90-libinput-fuzz-override-litest.rules', - configuration : litest_udev_rules_config) -+ -+endif - - ############ Check for leftover udev rules ######## - diff --git a/x11/libinput/files/patch-src_evdev.c b/x11/libinput/files/patch-src_evdev.c index df8fe4fd434a..e27b64542a36 100644 --- a/x11/libinput/files/patch-src_evdev.c +++ b/x11/libinput/files/patch-src_evdev.c @@ -1,37 +1,37 @@ When a process without full /dev/input access enumerates devices via libudev-devd, the udev_device structs do not get udev properties that mark them as inputs, keyboards, etc, and get rejected as not being input devices. libinput reopens devices just to check path equality. The udev_devices from reopening do have the right properties, so we just use them instead of the original (enumerated) ones. ---- src/evdev.c.orig 2020-07-15 01:54:15 UTC +--- src/evdev.c.orig 2025-04-01 02:46:07 UTC +++ src/evdev.c -@@ -1015,7 +1015,7 @@ evdev_sync_device(struct evdev_device *device) +@@ -1104,7 +1104,7 @@ evdev_sync_device(struct evdev_device *device) evdev_device_dispatch_one(device, &ev); } while (rc == LIBEVDEV_READ_STATUS_SYNC); - return rc == -EAGAIN ? 0 : rc; + return (rc == -EAGAIN || rc == -EINVAL)? 0 : rc; } static inline void -@@ -1083,6 +1083,17 @@ evdev_device_dispatch(void *data) +@@ -1177,6 +1177,17 @@ evdev_device_dispatch(void *data) if (rc != -EAGAIN && rc != -EINTR) { libinput_remove_source(libinput, device->source); + /* + * Dirty hack to allow cuse-based evdev backends to release + * character device file when device has been detached + * but still have it descriptor opened. + * Issuing evdev_device_suspend() here leads to SIGSEGV + */ + int dummy_fd = open("/dev/null", O_RDONLY | O_CLOEXEC); + if (dummy_fd >= 0) { + dup2(dummy_fd, device->fd); + close(dummy_fd); + } device->source = NULL; } } diff --git a/x11/libinput/files/patch-test_litest-runner.c b/x11/libinput/files/patch-test_litest-runner.c new file mode 100644 index 000000000000..9bcc44c072ba --- /dev/null +++ b/x11/libinput/files/patch-test_litest-runner.c @@ -0,0 +1,10 @@ +--- test/litest-runner.c.orig 2025-04-01 02:46:07 UTC ++++ test/litest-runner.c +@@ -26,7 +26,6 @@ + #include + #include + #include +-#include + #include + #ifdef HAVE_PIDFD_OPEN + #include diff --git a/x11/libinput/files/patch-test_litest-runner.h b/x11/libinput/files/patch-test_litest-runner.h new file mode 100644 index 000000000000..fcd70b576d44 --- /dev/null +++ b/x11/libinput/files/patch-test_litest-runner.h @@ -0,0 +1,11 @@ +--- test/litest-runner.h.orig 2025-04-01 02:46:07 UTC ++++ test/litest-runner.h +@@ -180,3 +180,8 @@ void litest_runner_abort(void); + */ + __attribute__((noreturn)) + void litest_runner_abort(void); ++ ++static int get_nprocs(void) ++{ ++ return sysconf (_SC_NPROCESSORS_ONLN); ++} diff --git a/x11/libinput/files/patch-test_litest.c b/x11/libinput/files/patch-test_litest.c new file mode 100644 index 000000000000..81964c72efde --- /dev/null +++ b/x11/libinput/files/patch-test_litest.c @@ -0,0 +1,46 @@ +--- test/litest.c.orig 2025-04-01 02:46:07 UTC ++++ test/litest.c +@@ -44,13 +44,13 @@ + #include + #include + #include +-#include + #include + #if HAVE_LIBSYSTEMD + #include + #endif + #ifdef __FreeBSD__ + #include ++#include + #endif + + #include +@@ -66,8 +66,6 @@ + #include "util-backtrace.h" + #include "util-libinput.h" + +-#include +- + #define evbit(t, c) ((t) << 16U | (c & 0xffff)) + + #define UDEV_RULES_D "/run/udev/rules.d" +@@ -5322,8 +5320,8 @@ check_device_access(void) + return 77; + } + +- if (access("/dev/uinput", F_OK) == -1 && +- access("/dev/input/uinput", F_OK) == -1) { ++ if (access("/dev/uinput_skip_our_libudev_isnt_ready", F_OK) == -1 && ++ access("/dev/input/uinput_skip_our_libudev_isnt_ready", F_OK) == -1) { + fprintf(stderr, + "uinput device is missing, skipping tests.\n"); + return 77; +@@ -5365,7 +5363,7 @@ main(int argc, char **argv) + if (getenv("NO_COLOR")) + use_colors = false; + +- in_debugger = is_debugger_attached(); ++ in_debugger = false; + if (in_debugger) { + jobs = 0; + } else if ((meson_testthreads = getenv("MESON_TESTTHREADS")) == NULL || diff --git a/x11/libinput/pkg-plist b/x11/libinput/pkg-plist index 9bdb7e420024..f97aca9d7d01 100644 --- a/x11/libinput/pkg-plist +++ b/x11/libinput/pkg-plist @@ -1,101 +1,102 @@ bin/libinput include/libinput.h lib/libinput.so lib/libinput.so.10 lib/libinput.so.10.13.0 libdata/pkgconfig/libinput.pc libexec/libinput/libinput-analyze libexec/libinput/libinput-analyze-buttons libexec/libinput/libinput-analyze-per-slot-delta libexec/libinput/libinput-analyze-recording libexec/libinput/libinput-analyze-touch-down-state libexec/libinput/libinput-debug-events %%DEBUG_GUI%%libexec/libinput/libinput-debug-gui libexec/libinput/libinput-debug-tablet libexec/libinput/libinput-list-devices libexec/libinput/libinput-list-kernel-devices libexec/libinput/libinput-measure libexec/libinput/libinput-measure-fuzz libexec/libinput/libinput-measure-touch-size libexec/libinput/libinput-measure-touchpad-pressure libexec/libinput/libinput-measure-touchpad-size libexec/libinput/libinput-measure-touchpad-tap libexec/libinput/libinput-quirks libexec/libinput/libinput-record libexec/libinput/libinput-replay libexec/libinput/libinput-test %%DATADIR%%/10-generic-keyboard.quirks %%DATADIR%%/10-generic-mouse.quirks %%DATADIR%%/10-generic-trackball.quirks %%DATADIR%%/30-vendor-a4tech.quirks %%DATADIR%%/30-vendor-aiptek.quirks %%DATADIR%%/30-vendor-alps.quirks %%DATADIR%%/30-vendor-contour.quirks %%DATADIR%%/30-vendor-cypress.quirks %%DATADIR%%/30-vendor-elantech.quirks %%DATADIR%%/30-vendor-glorious.quirks %%DATADIR%%/30-vendor-huion.quirks %%DATADIR%%/30-vendor-ibm.quirks %%DATADIR%%/30-vendor-ite.quirks %%DATADIR%%/30-vendor-kensington.quirks %%DATADIR%%/30-vendor-logitech.quirks %%DATADIR%%/30-vendor-madcatz.quirks %%DATADIR%%/30-vendor-microsoft.quirks %%DATADIR%%/30-vendor-oracle.quirks %%DATADIR%%/30-vendor-qemu.quirks %%DATADIR%%/30-vendor-razer.quirks %%DATADIR%%/30-vendor-synaptics.quirks %%DATADIR%%/30-vendor-trust.quirks %%DATADIR%%/30-vendor-uniwill.quirks %%DATADIR%%/30-vendor-vmware.quirks %%DATADIR%%/30-vendor-wacom.quirks %%DATADIR%%/50-system-acer.quirks %%DATADIR%%/50-system-apple.quirks %%DATADIR%%/50-system-asus.quirks %%DATADIR%%/50-system-chicony.quirks %%DATADIR%%/50-system-chuwi.quirks %%DATADIR%%/50-system-cyborg.quirks %%DATADIR%%/50-system-dell.quirks %%DATADIR%%/50-system-framework.quirks %%DATADIR%%/50-system-gigabyte.quirks %%DATADIR%%/50-system-google.quirks %%DATADIR%%/50-system-gpd.quirks %%DATADIR%%/50-system-graviton.quirks %%DATADIR%%/50-system-honor.quirks %%DATADIR%%/50-system-hp.quirks %%DATADIR%%/50-system-huawei.quirks %%DATADIR%%/50-system-icl.quirks %%DATADIR%%/50-system-lenovo.quirks %%DATADIR%%/50-system-lg.quirks %%DATADIR%%/50-system-minisforum.quirks %%DATADIR%%/50-system-pine64.quirks %%DATADIR%%/50-system-sony.quirks %%DATADIR%%/50-system-starlabs.quirks %%DATADIR%%/50-system-system76.quirks %%DATADIR%%/50-system-toshiba.quirks %%DATADIR%%/50-system-vaio.quirks share/man/man1/libinput-analyze-buttons.1.gz share/man/man1/libinput-analyze-per-slot-delta.1.gz share/man/man1/libinput-analyze-recording.1.gz share/man/man1/libinput-analyze-touch-down-state.1.gz share/man/man1/libinput-analyze.1.gz share/man/man1/libinput-debug-events.1.gz %%DEBUG_GUI%%share/man/man1/libinput-debug-gui.1.gz share/man/man1/libinput-debug-tablet.1.gz share/man/man1/libinput-list-devices.1.gz share/man/man1/libinput-list-kernel-devices.1.gz share/man/man1/libinput-measure-fuzz.1.gz share/man/man1/libinput-measure-touch-size.1.gz share/man/man1/libinput-measure-touchpad-pressure.1.gz share/man/man1/libinput-measure-touchpad-size.1.gz share/man/man1/libinput-measure-touchpad-tap.1.gz share/man/man1/libinput-measure.1.gz share/man/man1/libinput-quirks-list.1.gz share/man/man1/libinput-quirks-validate.1.gz share/man/man1/libinput-quirks.1.gz share/man/man1/libinput-record.1.gz share/man/man1/libinput-replay.1.gz share/man/man1/libinput-test.1.gz +%%TEST%%share/man/man1/libinput-test-suite.1.gz share/man/man1/libinput.1.gz share/zsh/site-functions/_libinput @dir %%ETCDIR%%