From e7eaecedc6757800a9b4c795fea51f255d3a0efe Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Thu, 21 Jan 2021 19:55:26 +0100 Subject: [PATCH] meson: Autodetect whether autosuspend rules are provided by udev Upstream systemd/udev is pulling our autosuspend hwdb, so if udev is new enough, then there is no need to install the file. As such, add auto-detection logic for the scenario. This also changes the name of the option and the type to "feature". --- data/meson.build | 2 +- meson.build | 16 ++++++++++++++-- meson_options.txt | 8 ++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/data/meson.build b/data/meson.build index da8d885..6f57fca 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,4 +1,4 @@ -if get_option('udev_rules') +if udev_hwdb_dir != '' # This file has to be updated using # ninja -C libfprint/sync-udev-hwdb # Note that the unsupported device list needs to be manually synced from diff --git a/meson.build b/meson.build index cbeab4d..22143e5 100644 --- a/meson.build +++ b/meson.build @@ -212,15 +212,27 @@ drivers_type_func += '}' root_inc = include_directories('.') -if get_option('udev_rules') +udev_hwdb = get_option('udev_hwdb') +if not udev_hwdb.disabled() + # systemd v248 includes our autosuspend rules + udev_versioned_dep = dependency('udev', version: '>= 248', required: false) udev_hwdb_dir = get_option('udev_hwdb_dir') + if udev_hwdb.auto() + if udev_versioned_dep.found() + udev_hwdb_dir = '' + endif + else + if udev_versioned_dep.found() + warning('udev hwdb will be installed by both systemd and libfprint') + endif + endif if udev_hwdb_dir == 'auto' udev_dep = dependency('udev') udev_hwdb_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/hwdb.d' endif else - udev_hwdb_dir = false + udev_hwdb_dir = '' endif if get_option('gtk-examples') diff --git a/meson_options.txt b/meson_options.txt index 414695f..f909ba7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,10 +6,10 @@ option('introspection', description: 'Build GObject Introspection repository', type: 'boolean', value: true) -option('udev_rules', - description: 'Whether to create a udev rules file', - type: 'boolean', - value: true) +option('udev_hwdb', + description: 'Whether to create a udev hwdb', + type: 'feature', + value: 'auto') option('udev_hwdb_dir', description: 'Installation path for udev hwdb', type: 'string',