meson: Permit disabling (and forcing) installation of udev rules

In some cases (e.g. inside the flatpak), it does not make sense to
generate and install udev rules.
This commit is contained in:
Benjamin Berg 2021-06-25 09:51:44 +02:00
parent e2f199bb6a
commit f37e20b8a0
3 changed files with 13 additions and 4 deletions

View file

@ -332,7 +332,7 @@ udev_hwdb_generator = custom_target('udev-hwdb',
install: false, install: false,
) )
if udev_rules if install_udev_rules
udev_rules = executable('fprint-list-udev-rules', udev_rules = executable('fprint-list-udev-rules',
'fprint-list-udev-rules.c', 'fprint-list-udev-rules.c',
dependencies: libfprint_private_dep, dependencies: libfprint_private_dep,

View file

@ -166,7 +166,8 @@ imaging_dep = dependency('', required: false)
gudev_dep = dependency('', required: false) gudev_dep = dependency('', required: false)
libfprint_conf.set10('HAVE_PIXMAN', false) libfprint_conf.set10('HAVE_PIXMAN', false)
udev_rules = false udev_rules = get_option('udev_rules')
install_udev_rules = udev_rules.enabled()
foreach driver: drivers foreach driver: drivers
if driver == 'uru4000' if driver == 'uru4000'
@ -184,7 +185,7 @@ foreach driver: drivers
libfprint_conf.set10('HAVE_PIXMAN', true) libfprint_conf.set10('HAVE_PIXMAN', true)
endif endif
if udev_drivers.contains(driver) if udev_drivers.contains(driver)
udev_rules = true install_udev_rules = true
gudev_dep = dependency('gudev-1.0', required: false) gudev_dep = dependency('gudev-1.0', required: false)
if not gudev_dep.found() if not gudev_dep.found()
@ -198,7 +199,11 @@ foreach driver: drivers
endif endif
endforeach endforeach
if udev_rules if udev_rules.disabled()
install_udev_rules = false
endif
if install_udev_rules
udev_rules_dir = get_option('udev_rules_dir') udev_rules_dir = get_option('udev_rules_dir')
if udev_rules_dir == 'auto' if udev_rules_dir == 'auto'
udev_dep = dependency('udev') udev_dep = dependency('udev')

View file

@ -6,6 +6,10 @@ option('introspection',
description: 'Build GObject Introspection repository', description: 'Build GObject Introspection repository',
type: 'boolean', type: 'boolean',
value: true) value: true)
option('udev_rules',
description: 'Whether to create and install udev rules (auto: turn on when needed by a driver)',
type: 'feature',
value: 'auto')
option('udev_rules_dir', option('udev_rules_dir',
description: 'Installation path for udev rules', description: 'Installation path for udev rules',
type: 'string', type: 'string',