meson: Shuffle around driver/helper definition

This should make it clearer what supporting features each driver needs.
This commit is contained in:
Benjamin Berg 2020-10-30 16:26:06 +01:00
parent d2c2410a6f
commit 4bf064d873
2 changed files with 136 additions and 152 deletions

View file

@ -80,128 +80,87 @@ nbis_sources = [
'nbis/mindtct/xytreps.c', 'nbis/mindtct/xytreps.c',
] ]
aeslib = false driver_sources = {
aesx660 = false 'upekts' :
aes3k = false [ 'drivers/upekts.c', 'drivers/upek_proto.c' ],
'upektc' :
[ 'drivers/upektc.c' ],
'upeksonly' :
[ 'drivers/upeksonly.c' ],
'uru4000' :
[ 'drivers/uru4000.c' ],
'aes1610' :
[ 'drivers/aes1610.c' ],
'aes1660' :
[ 'drivers/aes1660.c' ],
'aes2501' :
[ 'drivers/aes2501.c' ],
'aes2550' :
[ 'drivers/aes2550.c' ],
'aes2660' :
[ 'drivers/aes2660.c' ],
'aes3500' :
[ 'drivers/aes3500.c' ],
'aes4000' :
[ 'drivers/aes4000.c' ],
'vcom5s' :
[ 'drivers/vcom5s.c' ],
'vfs101' :
[ 'drivers/vfs101.c' ],
'vfs301' :
[ 'drivers/vfs301.c', 'drivers/vfs301_proto.c' ],
'vfs5011' :
[ 'drivers/vfs5011.c' ],
'vfs7552' :
[ 'drivers/vfs7552.c' ],
'upektc_img' :
[ 'drivers/upektc_img.c', 'drivers/upek_proto.c' ],
'etes603' :
[ 'drivers/etes603.c' ],
'vfs0050' :
[ 'drivers/vfs0050.c' ],
'elan' :
[ 'drivers/elan.c' ],
'elanspi' :
[ 'drivers/elanspi.c' ],
'nb1010' :
[ 'drivers/nb1010.c' ],
'virtual_image' :
[ 'drivers/virtual-image.c' ],
'virtual_device' :
[ 'drivers/virtual-device.c' ],
'virtual_device_storage' :
[ 'drivers/virtual-device-storage.c' ],
'synaptics' :
[ 'drivers/synaptics/synaptics.c', 'drivers/synaptics/bmkt_message.c' ],
'goodixmoc' :
[ 'drivers/goodixmoc/goodix.c', 'drivers/goodixmoc/goodix_proto.c' ],
}
helper_sources = {
'aeslib' :
[ 'drivers/aeslib.c' ],
'aesx660' :
[ 'drivers/aesx660.c' ],
'aes3k' :
[ 'drivers/aes3k.c' ],
'nss' :
[ ],
'udev' :
[ ],
'virtual' :
[ 'drivers/virtual-device-listener.c' ],
}
drivers_sources = [] drivers_sources = []
drivers_cflags = [] drivers_cflags = []
foreach driver: drivers foreach driver: drivers
if driver == 'upekts' drivers_sources += driver_sources[driver]
drivers_sources += [ 'drivers/upekts.c', 'drivers/upek_proto.c' ] endforeach
endif foreach helper : driver_helpers
if driver == 'upektc' drivers_sources += helper_sources[helper]
drivers_sources += [ 'drivers/upektc.c' ]
endif
if driver == 'upeksonly'
drivers_sources += [ 'drivers/upeksonly.c' ]
endif
if driver == 'uru4000'
drivers_sources += [ 'drivers/uru4000.c' ]
endif
if driver == 'aes1610'
drivers_sources += [ 'drivers/aes1610.c' ]
aeslib = true
endif
if driver == 'aes1660'
drivers_sources += [ 'drivers/aes1660.c' ]
aeslib = true
aesx660 = true
endif
if driver == 'aes2501'
drivers_sources += [ 'drivers/aes2501.c' ]
aeslib = true
endif
if driver == 'aes2550'
drivers_sources += [ 'drivers/aes2550.c' ]
aeslib = true
endif
if driver == 'aes2660'
drivers_sources += [ 'drivers/aes2660.c' ]
aeslib = true
aesx660 = true
endif
if driver == 'aes3500'
drivers_sources += [ 'drivers/aes3500.c' ]
aeslib = true
aes3k = true
endif
if driver == 'aes4000'
drivers_sources += [ 'drivers/aes4000.c' ]
aeslib = true
aes3k = true
endif
if driver == 'vcom5s'
drivers_sources += [ 'drivers/vcom5s.c' ]
endif
if driver == 'vfs101'
drivers_sources += [ 'drivers/vfs101.c' ]
endif
if driver == 'vfs301'
drivers_sources += [ 'drivers/vfs301.c', 'drivers/vfs301_proto.c' ]
endif
if driver == 'vfs5011'
drivers_sources += [ 'drivers/vfs5011.c' ]
endif
if driver == 'vfs7552'
drivers_sources += [ 'drivers/vfs7552.c' ]
endif
if driver == 'upektc_img'
drivers_sources += [ 'drivers/upektc_img.c', 'drivers/upek_proto.c' ]
endif
if driver == 'etes603'
drivers_sources += [ 'drivers/etes603.c' ]
endif
if driver == 'vfs0050'
drivers_sources += [ 'drivers/vfs0050.c' ]
endif
if driver == 'elan'
drivers_sources += [ 'drivers/elan.c' ]
endif
if driver == 'elanspi'
drivers_sources += [ 'drivers/elanspi.c' ]
endif
if driver == 'virtual_image'
drivers_sources += [ 'drivers/virtual-image.c' ]
endif
if driver == 'virtual_device'
drivers_sources += [ 'drivers/virtual-device.c' ]
endif
if driver == 'virtual_device_storage'
drivers_sources += [ 'drivers/virtual-device-storage.c' ]
endif
if driver.startswith('virtual_')
drivers_sources += [ 'drivers/virtual-device-listener.c' ]
endif
if driver == 'synaptics'
drivers_sources += [
'drivers/synaptics/synaptics.c',
'drivers/synaptics/bmkt_message.c',
]
endif
if driver == 'goodixmoc'
drivers_sources += [
'drivers/goodixmoc/goodix.c',
'drivers/goodixmoc/goodix_proto.c',
]
endif
if driver == 'nb1010'
drivers_sources += [
'drivers/nb1010.c',
]
endif
endforeach endforeach
if aeslib
drivers_sources += [ 'drivers/aeslib.c' ]
endif
if aesx660
drivers_sources += ['drivers/aesx660.c' ]
endif
if aes3k
drivers_sources += ['drivers/aes3k.c' ]
endif
other_sources = []
fp_enums = gnome.mkenums_simple('fp-enums', fp_enums = gnome.mkenums_simple('fp-enums',
sources: libfprint_public_headers, sources: libfprint_public_headers,
@ -256,11 +215,8 @@ deps = [
glib_dep, glib_dep,
gobject_dep, gobject_dep,
gusb_dep, gusb_dep,
gudev_dep,
imaging_dep,
mathlib_dep, mathlib_dep,
nss_dep, ] + optional_deps
]
# These are empty and only exist so that the include directories are created # These are empty and only exist so that the include directories are created
# in the build tree. This silences a build time warning. # in the build tree. This silences a build time warning.
@ -307,7 +263,6 @@ libfprint = shared_library(versioned_libname.split('lib')[1],
sources: [ sources: [
fp_enums, fp_enums,
libfprint_sources, libfprint_sources,
other_sources,
], ],
soversion: soversion, soversion: soversion,
version: libversion, version: libversion,

View file

@ -144,10 +144,32 @@ if drivers == [ 'default' ]
drivers = default_drivers drivers = default_drivers
endif endif
# For detection whether udev is needed driver_helper_mapping = {
udev_drivers = [ 'aes1610' : [ 'aeslib' ],
'elanspi' 'aes1660' : [ 'aeslib', 'aesx660' ],
] 'aes2501' : [ 'aeslib' ],
'aes2550' : [ 'aeslib' ],
'aes2660' : [ 'aeslib', 'aesx660' ],
'aes3500' : [ 'aeslib', 'aes3k' ],
'aes4000' : [ 'aeslib', 'aes3k' ],
'uru4000' : [ 'nss' ],
'elanspi' : [ 'udev' ],
'virtual_image' : [ 'virtual' ],
'virtual_device' : [ 'virtual' ],
'virtual_device_storage' : [ 'virtual' ],
}
driver_helpers = []
foreach driver : drivers
if driver in driver_helper_mapping
foreach helper : driver_helper_mapping[driver]
if helper not in driver_helpers
driver_helpers += helper
endif
endforeach
endif
endforeach
if drivers.length() == 0 or drivers[0] == '' if drivers.length() == 0 or drivers[0] == ''
error('Cannot build libfprint without drivers, please specify a valid value for the drivers option') error('Cannot build libfprint without drivers, please specify a valid value for the drivers option')
@ -165,41 +187,46 @@ else
endforeach endforeach
endif endif
nss_dep = dependency('', required: false)
imaging_dep = dependency('', required: false)
gudev_dep = dependency('', required: false)
libfprint_conf.set10('HAVE_PIXMAN', false)
udev_rules = get_option('udev_rules') udev_rules = get_option('udev_rules')
install_udev_rules = udev_rules.enabled() install_udev_rules = udev_rules.enabled()
foreach driver: drivers optional_deps = []
if driver == 'uru4000'
nss_dep = dependency('nss', required: false) # Resolve extra dependencies
if not nss_dep.found() foreach i : driver_helpers
error('NSS is required for the URU4000/URU4500 driver') foreach d, helpers : driver_helper_mapping
if i in helpers
driver = d
break
endif endif
endif endforeach
if driver == 'aes3500' or driver == 'aes4000' or driver == 'elanspi'
if i == 'aes3k'
imaging_dep = dependency('pixman-1', required: false) imaging_dep = dependency('pixman-1', required: false)
if not imaging_dep.found() if not imaging_dep.found()
error('pixman is required for imaging support') error('pixman is required for @0@ and possibly others'.format(driver))
endif endif
libfprint_conf.set10('HAVE_PIXMAN', true) libfprint_conf.set10('HAVE_PIXMAN', true)
endif optional_deps += imaging_dep
if udev_drivers.contains(driver) elif i == 'nss'
install_udev_rules = true nss_dep = dependency('nss', required: false)
if not nss_dep.found()
gudev_dep = dependency('gudev-1.0', required: false) error('nss is required for @0@ and possibly others'.format(driver))
if not gudev_dep.found()
error('udev is required for SPI support')
endif
libfprint_conf.set10('HAVE_UDEV', true)
endif endif
if not all_drivers.contains(driver)
error('Invalid driver \'' + driver + '\'') optional_deps += nss_dep
elif i == 'udev'
install_udev_rules = true
gudev_dep = dependency('gudev-1.0', required: false)
if not gudev_dep.found()
error('udev is required for SPI support')
endif
libfprint_conf.set10('HAVE_UDEV', true)
optional_deps += gudev_dep
endif endif
endforeach endforeach
@ -263,9 +290,11 @@ if get_option('gtk-examples')
endif endif
endif endif
# Some dependency resolving happens inside here
subdir('libfprint')
configure_file(output: 'config.h', configuration: libfprint_conf) configure_file(output: 'config.h', configuration: libfprint_conf)
subdir('libfprint')
subdir('examples') subdir('examples')
if get_option('doc') if get_option('doc')
gnome = import('gnome') gnome = import('gnome')