summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2019-08-08 15:54:41 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2019-08-13 10:12:22 +1000
commite1de16aca27cbf7ccc86f93051ebf5bc30cec8d9 (patch)
tree70c4fd54f66493bcd292e9e4af662cd0e49ef4d6
parentc2019dc5815ddf93f39d0cb60f0bbaab8df13de6 (diff)
downloadlibwacom-e1de16aca27cbf7ccc86f93051ebf5bc30cec8d9.tar.gz
Install the udev rules
These rules are required for libinput to correctly handle pad devices as pads. And given that most distributions already install them by hand anyway, let's make the job a bit easier and install it for them. New configure/meson arguments to provide the path to the udev base directory: ./configure --with-udev-dir=/path/to/udev/ meson builddir -Dudev-dir=/path/to/udev/ If left to its defaults, it will install into $prefix/lib/udev/rules.d which is what most would expect. Fixes #144 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--configure.ac13
-rw-r--r--meson.build24
-rw-r--r--meson_options.txt4
-rw-r--r--tools/Makefile.am10
4 files changed, 45 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index c5323c6..0479dac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,19 @@ if test "x$HAVE_GLIB236" != "xyes"; then
AC_DEFINE(NEED_G_TYPE_INIT, 1, [Need g_type_init() call])
fi
+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)
+
AC_CONFIG_FILES([Makefile
data/Makefile
data/layouts/Makefile
diff --git a/meson.build b/meson.build
index f33390d..908811b 100644
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,12 @@ dir_layouts = join_paths(dir_data, 'layouts')
dir_man1 = join_paths(get_option('prefix'), get_option('mandir'), 'man1')
dir_src = join_paths(meson.source_root(), 'libwacom')
dir_test = join_paths(meson.source_root(), 'test')
+dir_sys_udev= join_paths(get_option('prefix'), 'lib', 'udev')
+
+dir_udev = get_option('udev-dir')
+if dir_udev == ''
+ dir_udev = dir_sys_udev
+endif
# Do not modify this, use symbol versioning instead.
libwacom_lt_c=8
@@ -405,12 +411,18 @@ executable('libwacom-list-local-devices',
tools_cflags = ['-DTOPSRCDIR="@0@"'.format(meson.source_root())]
-executable('generate-udev-rules',
- 'tools/generate-udev-rules.c',
- dependencies: [dep_libwacom, dep_glib],
- include_directories: [includes_src],
- c_args: tools_cflags,
- install: false)
+gen_udev_rules = executable('generate-udev-rules',
+ 'tools/generate-udev-rules.c',
+ dependencies: [dep_libwacom, dep_glib],
+ include_directories: [includes_src],
+ c_args: tools_cflags,
+ install: false)
+custom_target('udev-rules',
+ command: gen_udev_rules,
+ capture: true,
+ output: '65-libwacom.rules',
+ install: true,
+ install_dir: join_paths(dir_udev, 'rules.d'))
executable('list-devices',
'tools/list-devices.c',
diff --git a/meson_options.txt b/meson_options.txt
index 8714e44..1d75434 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,7 @@
+option('udev-dir',
+ type: 'string',
+ value: '',
+ description: 'udev base directory [default=$prefix/lib/udev]')
option('tests',
type: 'boolean',
value: true,
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 4055a0d..66dba2f 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -25,3 +25,13 @@ show_svg_image_CFLAGS = $(GTK2_CFLAGS)
endif
dist_man1_MANS = libwacom-list-local-devices.man
+
+rules = 65-libwacom.rules
+udev_rulesdir=$(UDEV_DIR)/rules.d
+dist_udev_rules_DATA = $(rules)
+
+$(rules): generate-udev-rules
+ $(builddir)/$< > $@
+
+CLEANFILES = $(rules)
+EXTRA_DIST = $(rules)