2018-05-14 13:15:52 +00:00
|
|
|
project('libfprint', [ 'c', 'cpp' ],
|
2021-06-25 13:27:02 +00:00
|
|
|
version: '1.92.0',
|
2019-11-21 19:37:17 +00:00
|
|
|
license: 'LGPLv2.1+',
|
|
|
|
default_options: [
|
|
|
|
'buildtype=debugoptimized',
|
|
|
|
'warning_level=1',
|
2020-01-30 14:53:40 +00:00
|
|
|
'c_std=gnu99',
|
2019-11-21 19:37:17 +00:00
|
|
|
],
|
2019-12-17 19:44:37 +00:00
|
|
|
meson_version: '>= 0.49.0')
|
2018-05-14 13:15:52 +00:00
|
|
|
|
2019-07-03 21:29:05 +00:00
|
|
|
gnome = import('gnome')
|
|
|
|
|
2018-05-14 13:15:52 +00:00
|
|
|
libfprint_conf = configuration_data()
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
cpp = meson.get_compiler('cpp')
|
|
|
|
host_system = host_machine.system()
|
2019-11-22 12:06:08 +00:00
|
|
|
glib_min_version = '2.56'
|
2018-05-14 13:15:52 +00:00
|
|
|
|
2019-11-22 13:09:51 +00:00
|
|
|
glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
|
|
|
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
2018-05-14 13:15:52 +00:00
|
|
|
common_cflags = cc.get_supported_arguments([
|
|
|
|
'-Wall',
|
2019-12-04 13:27:33 +00:00
|
|
|
'-Wcast-align',
|
|
|
|
'-Wformat-nonliteral',
|
|
|
|
'-Wformat-security',
|
|
|
|
'-Wformat=2',
|
|
|
|
'-Wignored-qualifiers',
|
|
|
|
'-Wlogical-op',
|
|
|
|
'-Wmissing-declarations',
|
|
|
|
'-Wmissing-format-attribute',
|
|
|
|
'-Wmissing-include-dirs',
|
|
|
|
'-Wmissing-noreturn',
|
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wshadow',
|
2021-04-29 12:16:29 +00:00
|
|
|
'-Wswitch-enum',
|
2019-08-06 11:13:15 +00:00
|
|
|
'-Wtype-limits',
|
2018-05-14 13:15:52 +00:00
|
|
|
'-Wundef',
|
|
|
|
'-Wunused',
|
2019-12-04 13:27:33 +00:00
|
|
|
'-Werror=address',
|
|
|
|
'-Werror=array-bounds',
|
|
|
|
'-Werror=empty-body',
|
|
|
|
'-Werror=init-self',
|
|
|
|
'-Werror=int-to-pointer-cast',
|
|
|
|
'-Werror=main',
|
|
|
|
'-Werror=missing-braces',
|
|
|
|
'-Werror=nonnull',
|
|
|
|
'-Werror=redundant-decls',
|
|
|
|
'-Werror=return-type',
|
|
|
|
'-Werror=sequence-point',
|
|
|
|
'-Werror=trigraphs',
|
|
|
|
'-Werror=write-strings',
|
|
|
|
'-fno-strict-aliasing',
|
2019-11-22 13:09:51 +00:00
|
|
|
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
|
|
|
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
2019-12-04 11:32:14 +00:00
|
|
|
'-D_GNU_SOURCE',
|
2020-01-22 20:03:40 +00:00
|
|
|
'-DG_LOG_DOMAIN="@0@"'.format(meson.project_name()),
|
2019-12-04 11:32:14 +00:00
|
|
|
])
|
|
|
|
c_cflags = cc.get_supported_arguments([
|
2019-12-04 13:27:33 +00:00
|
|
|
'-Wimplicit-function-declaration',
|
|
|
|
'-Wmissing-prototypes',
|
|
|
|
'-Wnested-externs',
|
|
|
|
'-Wold-style-definition',
|
|
|
|
'-Wstrict-prototypes',
|
|
|
|
'-Werror=implicit',
|
|
|
|
'-Werror=pointer-to-int-cast',
|
2018-05-14 13:15:52 +00:00
|
|
|
])
|
2019-12-04 11:32:14 +00:00
|
|
|
add_project_arguments(common_cflags + c_cflags, language: 'c')
|
|
|
|
add_project_arguments(common_cflags, language: 'cpp')
|
2018-05-14 13:15:52 +00:00
|
|
|
|
|
|
|
# maintaining compatibility with the previous libtool versioning
|
|
|
|
# current = binary - interface
|
|
|
|
# revision = interface
|
2019-06-13 13:00:25 +00:00
|
|
|
soversion = 2
|
2018-05-14 13:15:52 +00:00
|
|
|
current = 0
|
|
|
|
revision = 0
|
|
|
|
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
|
2020-01-23 16:08:41 +00:00
|
|
|
versioned_libname = meson.project_name() + '-' + soversion.to_string()
|
2018-05-14 13:15:52 +00:00
|
|
|
|
|
|
|
# Dependencies
|
2019-11-22 13:09:51 +00:00
|
|
|
glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
|
|
|
|
gio_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
2020-02-13 17:11:46 +00:00
|
|
|
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_min_version)
|
2020-01-30 14:28:27 +00:00
|
|
|
gusb_dep = dependency('gusb', version: '>= 0.2.0')
|
2018-05-14 13:15:52 +00:00
|
|
|
mathlib_dep = cc.find_library('m', required: false)
|
|
|
|
|
2019-12-09 10:52:05 +00:00
|
|
|
# The following dependencies are only used for tests
|
|
|
|
cairo_dep = dependency('cairo', required: false)
|
|
|
|
|
2021-06-21 15:00:57 +00:00
|
|
|
# introspection scanning and Gio-2.0.gir
|
|
|
|
gobject_introspection = dependency('gobject-introspection-1.0', required: get_option('introspection'))
|
|
|
|
|
2018-05-14 13:15:52 +00:00
|
|
|
# Drivers
|
|
|
|
drivers = get_option('drivers').split(',')
|
2021-01-05 14:59:07 +00:00
|
|
|
virtual_drivers = [
|
|
|
|
'virtual_image',
|
|
|
|
'virtual_device',
|
|
|
|
'virtual_device_storage',
|
2020-05-15 19:06:24 +00:00
|
|
|
'virtual_sdcp',
|
2021-01-05 14:59:07 +00:00
|
|
|
]
|
2019-11-21 19:24:29 +00:00
|
|
|
default_drivers = [
|
|
|
|
'upektc_img',
|
|
|
|
'vfs5011',
|
2020-10-11 16:45:39 +00:00
|
|
|
'vfs7552',
|
2019-11-21 19:24:29 +00:00
|
|
|
'aes3500',
|
|
|
|
'aes4000',
|
|
|
|
'aes1610',
|
|
|
|
'aes1660',
|
|
|
|
'aes2660',
|
|
|
|
'aes2501',
|
|
|
|
'aes2550',
|
|
|
|
'vfs101',
|
|
|
|
'vfs301',
|
|
|
|
'vfs0050',
|
|
|
|
'etes603',
|
|
|
|
'vcom5s',
|
|
|
|
'synaptics',
|
|
|
|
'elan',
|
|
|
|
'uru4000',
|
|
|
|
'upektc',
|
|
|
|
'upeksonly',
|
|
|
|
'upekts',
|
2020-06-08 14:00:29 +00:00
|
|
|
'goodixmoc',
|
2021-06-25 12:46:57 +00:00
|
|
|
'nb1010',
|
|
|
|
|
|
|
|
# SPI
|
|
|
|
'elanspi',
|
2019-11-21 19:24:29 +00:00
|
|
|
]
|
2018-05-14 13:15:52 +00:00
|
|
|
|
2020-12-10 19:22:54 +00:00
|
|
|
# FIXME: All the drivers should be fixed by adjusting the byte order.
|
|
|
|
# See https://gitlab.freedesktop.org/libfprint/libfprint/-/issues/236
|
|
|
|
endian_independent_drivers = virtual_drivers + [
|
|
|
|
'aes3500',
|
|
|
|
'synaptics',
|
|
|
|
]
|
|
|
|
|
2021-06-25 12:46:57 +00:00
|
|
|
all_drivers = default_drivers + virtual_drivers
|
2019-06-13 13:24:51 +00:00
|
|
|
|
2018-05-14 13:15:52 +00:00
|
|
|
if drivers == [ 'all' ]
|
|
|
|
drivers = all_drivers
|
|
|
|
endif
|
|
|
|
|
2019-06-13 13:24:51 +00:00
|
|
|
if drivers == [ 'default' ]
|
|
|
|
drivers = default_drivers
|
|
|
|
endif
|
|
|
|
|
2020-10-30 15:26:06 +00:00
|
|
|
driver_helper_mapping = {
|
|
|
|
'aes1610' : [ 'aeslib' ],
|
|
|
|
'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' ],
|
2020-05-15 19:06:24 +00:00
|
|
|
'virtual_sdcp' : [ 'sdcp' ],
|
2020-10-30 15:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-06-25 12:46:57 +00:00
|
|
|
|
2018-10-11 12:28:04 +00:00
|
|
|
if drivers.length() == 0 or drivers[0] == ''
|
|
|
|
error('Cannot build libfprint without drivers, please specify a valid value for the drivers option')
|
|
|
|
endif
|
|
|
|
|
2021-01-20 19:02:05 +00:00
|
|
|
if drivers == all_drivers or drivers == default_drivers
|
|
|
|
default_drivers_are_enabled = true
|
|
|
|
else
|
|
|
|
default_drivers_are_enabled = true
|
|
|
|
foreach driver: default_drivers
|
|
|
|
if driver not in drivers
|
|
|
|
default_drivers_are_enabled = false
|
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
2021-06-25 07:51:44 +00:00
|
|
|
udev_rules = get_option('udev_rules')
|
|
|
|
install_udev_rules = udev_rules.enabled()
|
2021-06-22 12:51:26 +00:00
|
|
|
|
2020-10-30 15:26:06 +00:00
|
|
|
optional_deps = []
|
|
|
|
|
|
|
|
# Resolve extra dependencies
|
|
|
|
foreach i : driver_helpers
|
|
|
|
foreach d, helpers : driver_helper_mapping
|
|
|
|
if i in helpers
|
|
|
|
driver = d
|
|
|
|
break
|
2018-05-14 13:15:52 +00:00
|
|
|
endif
|
2020-10-30 15:26:06 +00:00
|
|
|
endforeach
|
|
|
|
|
|
|
|
if i == 'aes3k'
|
2018-05-14 13:15:52 +00:00
|
|
|
imaging_dep = dependency('pixman-1', required: false)
|
|
|
|
if not imaging_dep.found()
|
2020-10-30 15:26:06 +00:00
|
|
|
error('pixman is required for @0@ and possibly others'.format(driver))
|
2018-05-14 13:15:52 +00:00
|
|
|
endif
|
2019-07-03 21:29:05 +00:00
|
|
|
|
|
|
|
libfprint_conf.set10('HAVE_PIXMAN', true)
|
2020-10-30 15:26:06 +00:00
|
|
|
optional_deps += imaging_dep
|
|
|
|
elif i == 'nss'
|
|
|
|
nss_dep = dependency('nss', required: false)
|
|
|
|
if not nss_dep.found()
|
|
|
|
error('nss is required for @0@ and possibly others'.format(driver))
|
|
|
|
endif
|
2021-06-22 12:51:26 +00:00
|
|
|
|
2020-05-11 14:17:03 +00:00
|
|
|
optional_deps += nss_dep
|
|
|
|
elif i == 'sdcp'
|
|
|
|
nss_dep = dependency('nss', version: '>=3.55', required: false)
|
|
|
|
if not nss_dep.found()
|
|
|
|
error('nss >=3.55 is required for SDCP support (@0@ and possibly others)'.format(driver))
|
|
|
|
endif
|
|
|
|
|
2020-10-30 15:26:06 +00:00
|
|
|
optional_deps += nss_dep
|
|
|
|
elif i == 'udev'
|
|
|
|
install_udev_rules = true
|
2021-06-22 12:19:53 +00:00
|
|
|
|
2020-10-30 15:26:06 +00:00
|
|
|
gudev_dep = dependency('gudev-1.0', required: false)
|
|
|
|
if not gudev_dep.found()
|
|
|
|
error('udev is required for SPI support')
|
2021-06-22 12:19:53 +00:00
|
|
|
endif
|
2020-10-30 15:26:06 +00:00
|
|
|
|
|
|
|
libfprint_conf.set10('HAVE_UDEV', true)
|
|
|
|
|
|
|
|
optional_deps += gudev_dep
|
2018-05-14 13:15:52 +00:00
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-06-25 07:51:44 +00:00
|
|
|
if udev_rules.disabled()
|
|
|
|
install_udev_rules = false
|
|
|
|
endif
|
|
|
|
|
|
|
|
if install_udev_rules
|
2021-06-22 12:51:26 +00:00
|
|
|
udev_rules_dir = get_option('udev_rules_dir')
|
|
|
|
if udev_rules_dir == 'auto'
|
|
|
|
udev_dep = dependency('udev')
|
2021-06-30 09:14:33 +00:00
|
|
|
udev_rules_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/rules.d'
|
2021-06-22 12:51:26 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-12-10 19:22:54 +00:00
|
|
|
supported_drivers = []
|
|
|
|
foreach driver: drivers
|
|
|
|
if build_machine.endian() == 'little' or driver in endian_independent_drivers
|
|
|
|
supported_drivers += driver
|
|
|
|
else
|
|
|
|
warning('Driver @0@ is not supported by big endian cpu @1@. Please, fix it!'.format(
|
|
|
|
driver, build_machine.cpu()))
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-01-21 14:34:36 +00:00
|
|
|
if default_drivers_are_enabled and supported_drivers != drivers
|
|
|
|
default_drivers_are_enabled = false
|
|
|
|
endif
|
|
|
|
|
2018-05-14 13:15:52 +00:00
|
|
|
root_inc = include_directories('.')
|
|
|
|
|
2021-01-21 18:55:26 +00:00
|
|
|
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)
|
2021-01-19 13:13:03 +00:00
|
|
|
udev_hwdb_dir = get_option('udev_hwdb_dir')
|
2021-01-21 18:55:26 +00:00
|
|
|
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
|
2018-05-14 13:15:52 +00:00
|
|
|
|
2021-01-19 13:13:03 +00:00
|
|
|
if udev_hwdb_dir == 'auto'
|
2018-05-14 13:15:52 +00:00
|
|
|
udev_dep = dependency('udev')
|
2021-01-19 13:13:03 +00:00
|
|
|
udev_hwdb_dir = udev_dep.get_pkgconfig_variable('udevdir') + '/hwdb.d'
|
2018-05-14 13:15:52 +00:00
|
|
|
endif
|
2021-01-19 13:19:10 +00:00
|
|
|
else
|
2021-01-21 18:55:26 +00:00
|
|
|
udev_hwdb_dir = ''
|
2018-05-14 13:15:52 +00:00
|
|
|
endif
|
|
|
|
|
2018-10-08 14:33:04 +00:00
|
|
|
if get_option('gtk-examples')
|
|
|
|
gnome = import('gnome')
|
|
|
|
|
|
|
|
gtk_dep = dependency('gtk+-3.0', required: false)
|
|
|
|
if not gtk_dep.found()
|
|
|
|
error('GTK+ 3.x is required for GTK+ examples')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-10-30 15:26:06 +00:00
|
|
|
# Some dependency resolving happens inside here
|
|
|
|
subdir('libfprint')
|
|
|
|
|
2018-05-14 13:15:52 +00:00
|
|
|
configure_file(output: 'config.h', configuration: libfprint_conf)
|
|
|
|
|
|
|
|
subdir('examples')
|
2018-05-17 00:58:59 +00:00
|
|
|
if get_option('doc')
|
|
|
|
gnome = import('gnome')
|
|
|
|
subdir('doc')
|
|
|
|
endif
|
2018-10-08 14:33:04 +00:00
|
|
|
if get_option('gtk-examples')
|
|
|
|
subdir('demo')
|
|
|
|
endif
|
2018-05-14 13:15:52 +00:00
|
|
|
|
2021-01-20 23:57:43 +00:00
|
|
|
subdir('data')
|
2019-12-05 13:38:41 +00:00
|
|
|
subdir('tests')
|
2019-07-03 21:39:08 +00:00
|
|
|
|
2018-05-14 13:15:52 +00:00
|
|
|
pkgconfig = import('pkgconfig')
|
|
|
|
pkgconfig.generate(
|
2020-01-23 16:08:41 +00:00
|
|
|
name: versioned_libname,
|
2019-11-21 19:37:17 +00:00
|
|
|
description: 'Generic C API for fingerprint reader access',
|
|
|
|
version: meson.project_version(),
|
|
|
|
libraries: libfprint,
|
2020-02-13 17:11:46 +00:00
|
|
|
requires: [gio_dep, gobject_dep],
|
2020-01-23 16:08:41 +00:00
|
|
|
subdirs: versioned_libname,
|
|
|
|
filebase: versioned_libname,
|
2019-12-16 17:52:46 +00:00
|
|
|
)
|