2020-01-22 13:57:01 +01:00
|
|
|
project('fprintd', 'c',
|
2025-02-20 21:20:36 +01:00
|
|
|
version: '1.94.5',
|
2020-01-22 13:57:01 +01:00
|
|
|
license: 'GPLv2+',
|
|
|
|
|
default_options: [
|
|
|
|
|
'buildtype=debugoptimized',
|
2020-11-30 16:19:57 +01:00
|
|
|
'warning_level=3',
|
2020-01-22 13:57:01 +01:00
|
|
|
'c_std=gnu99',
|
|
|
|
|
],
|
2025-02-20 20:55:17 +01:00
|
|
|
meson_version: '>= 0.58.0')
|
2020-01-22 13:57:01 +01:00
|
|
|
|
|
|
|
|
gnome = import('gnome')
|
|
|
|
|
i18n = import('i18n')
|
|
|
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
2020-11-28 15:33:34 +01:00
|
|
|
common_cflags = cc.get_supported_arguments([
|
|
|
|
|
'-fno-strict-aliasing',
|
|
|
|
|
'-Wcast-align',
|
|
|
|
|
'-Werror=address',
|
|
|
|
|
'-Werror=array-bounds',
|
|
|
|
|
'-Werror=empty-body',
|
|
|
|
|
'-Werror=implicit',
|
|
|
|
|
'-Werror=init-self',
|
|
|
|
|
'-Werror=int-to-pointer-cast',
|
|
|
|
|
'-Werror=main',
|
|
|
|
|
'-Werror=missing-braces',
|
|
|
|
|
'-Werror=nonnull',
|
|
|
|
|
'-Werror=pointer-to-int-cast',
|
|
|
|
|
'-Werror=redundant-decls',
|
|
|
|
|
'-Werror=return-type',
|
|
|
|
|
'-Werror=sequence-point',
|
|
|
|
|
'-Werror=trigraphs',
|
|
|
|
|
'-Werror=write-strings',
|
|
|
|
|
'-Wformat-nonliteral',
|
|
|
|
|
'-Wformat-security',
|
|
|
|
|
'-Wformat=2',
|
|
|
|
|
'-Wignored-qualifiers',
|
|
|
|
|
'-Wimplicit-function-declaration',
|
|
|
|
|
'-Wlogical-op',
|
|
|
|
|
'-Wmissing-declarations',
|
|
|
|
|
'-Wmissing-format-attribute',
|
|
|
|
|
'-Wmissing-include-dirs',
|
|
|
|
|
'-Wmissing-noreturn',
|
|
|
|
|
'-Wmissing-prototypes',
|
|
|
|
|
'-Wnested-externs',
|
|
|
|
|
'-Wold-style-definition',
|
|
|
|
|
'-Wpointer-arith',
|
|
|
|
|
'-Wshadow',
|
|
|
|
|
'-Wstrict-prototypes',
|
|
|
|
|
'-Wtype-limits',
|
|
|
|
|
'-Wundef',
|
|
|
|
|
'-Wunused',
|
|
|
|
|
])
|
|
|
|
|
add_project_arguments(common_cflags, language: 'c')
|
|
|
|
|
|
2020-11-30 16:19:57 +01:00
|
|
|
common_cflags = cc.get_supported_arguments([
|
|
|
|
|
# The stub passes a lot of params that we do not use, maybe a good idea to
|
|
|
|
|
# mark it appropriately, but this works well for now.
|
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
|
# We use g_signal_handlers_disconnect_* which is not compatible with -Wpedantic
|
|
|
|
|
'-Wno-pedantic',
|
|
|
|
|
])
|
|
|
|
|
add_project_arguments(common_cflags, language: 'c')
|
|
|
|
|
|
2020-01-22 13:57:01 +01:00
|
|
|
host_system = host_machine.system()
|
2024-04-08 18:01:22 +01:00
|
|
|
glib_min_version = '2.64'
|
2025-02-20 19:04:10 +01:00
|
|
|
libfprint_min_version = '1.94.9'
|
2020-01-22 13:57:01 +01:00
|
|
|
|
2021-07-30 14:41:04 +02:00
|
|
|
glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
|
|
|
|
|
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
|
|
|
|
|
common_cflags = cc.get_supported_arguments([
|
|
|
|
|
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
|
|
|
|
|
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
|
|
|
|
|
])
|
|
|
|
|
add_project_arguments(common_cflags, language: 'c')
|
|
|
|
|
|
2020-01-22 13:57:01 +01:00
|
|
|
fprintd_installdir = get_option('prefix') / get_option('libexecdir')
|
|
|
|
|
fprintd_plugindir = get_option('prefix') / get_option('libdir') / meson.project_name() / 'modules'
|
|
|
|
|
storage_path = get_option('prefix') / get_option('localstatedir') / 'lib/fprint'
|
|
|
|
|
localedir = get_option('prefix') / get_option('localedir')
|
|
|
|
|
datadir = get_option('prefix') / get_option('datadir')
|
|
|
|
|
sysconfdir = get_option('sysconfdir')
|
|
|
|
|
if get_option('prefix') != '/usr'
|
|
|
|
|
sysconfdir = get_option('prefix') / sysconfdir
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
|
glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
|
|
|
|
|
gio_dep = dependency('gio-2.0', version: '>=' + glib_min_version)
|
fprintd: Use GDBus codegen based implementation
Fprintd is dependent on the deprecated dbus-glib, also this doesn't provide
various features we can take advantage of, like the ones for async
authentication mechanism.
So, remove all the dbus-glib dependencies and simplify the code, but without
any further refactor, and keeping everything as it used to work, while this
will give room for further improvements in subsequent commits.
Internally, we just use dbus-codegen to generate the skeletons, and we
use the generated FprintdDBusManager with composition, while we
implement the device skeleton interface in FprintDevice, so that we
don't have to use it as a proxy, and keep being closer to what it used
to be with dbus-glib.
Fixes: #61
2020-02-03 20:29:56 +01:00
|
|
|
gio_unix_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
2020-01-22 13:57:01 +01:00
|
|
|
gmodule_dep = dependency('gmodule-2.0', version: '>=' + glib_min_version)
|
|
|
|
|
libfprint_dep = dependency('libfprint-2', version: '>=' + libfprint_min_version)
|
2020-11-27 18:18:51 +01:00
|
|
|
polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.91')
|
2020-01-22 13:57:01 +01:00
|
|
|
dbus_dep = dependency('dbus-1', required: false)
|
2024-08-30 13:36:13 +02:00
|
|
|
|
2024-08-30 17:33:44 +02:00
|
|
|
if get_option('pam')
|
|
|
|
|
libsystemd_dep = dependency(get_option('libsystemd'), required: true)
|
|
|
|
|
|
|
|
|
|
has_openpam = false
|
|
|
|
|
pam_dep = cc.find_library('pam',
|
|
|
|
|
required: true,
|
|
|
|
|
has_headers: 'security/pam_modules.h',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Check if the PAM implementation is OpenPAM instead of linux-pam
|
|
|
|
|
if host_machine.system().endswith('bsd') or host_machine.system() == 'dragonfly'
|
|
|
|
|
has_openpam = cc.compiles('''
|
|
|
|
|
#include <security/pam_modules.h>
|
|
|
|
|
#include <security/openpam.h>
|
|
|
|
|
int main(void) { return 0; }
|
|
|
|
|
''',
|
|
|
|
|
dependencies: pam_dep,
|
|
|
|
|
name: 'openpam',
|
|
|
|
|
)
|
|
|
|
|
assert(has_openpam)
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2020-01-22 13:57:01 +01:00
|
|
|
|
2024-07-25 20:48:51 +00:00
|
|
|
if host_machine.system() == 'linux' or host_machine.system() == 'gnu'
|
|
|
|
|
gettext_deps = []
|
2024-08-30 17:33:44 +02:00
|
|
|
elif (host_machine.system() == 'freebsd' or
|
|
|
|
|
host_machine.system() == 'openbsd' or
|
|
|
|
|
host_machine.system() == 'dragonfly')
|
2024-07-25 20:48:51 +00:00
|
|
|
gettext_deps = [cc.find_library('intl', dirs: ['/usr/local/lib'])]
|
|
|
|
|
elif host_machine.system() == 'netbsd'
|
|
|
|
|
gettext_deps = [cc.find_library('intl', dirs: ['/usr/pkg/lib'])]
|
|
|
|
|
else # darwin, cygwin
|
|
|
|
|
gettext_deps = [cc.find_library('intl')]
|
|
|
|
|
endif
|
|
|
|
|
|
2020-01-22 13:57:01 +01:00
|
|
|
pod2man = find_program('pod2man', required: get_option('man'))
|
|
|
|
|
xsltproc = find_program('xsltproc', required: get_option('gtk_doc'))
|
|
|
|
|
|
|
|
|
|
# StateDirectory was introduced in systemd 235
|
2020-12-08 14:34:06 -06:00
|
|
|
systemd_dep = dependency('systemd', version: '>= 235', required: false)
|
2020-01-22 13:57:01 +01:00
|
|
|
systemd_unit_dir = get_option('systemd_system_unit_dir')
|
|
|
|
|
|
2020-12-08 14:34:06 -06:00
|
|
|
if systemd_unit_dir == '' and systemd_dep.found()
|
2025-02-20 20:55:17 +01:00
|
|
|
systemd_unit_dir = systemd_dep.get_variable('systemdsystemunitdir')
|
2020-01-22 13:57:01 +01:00
|
|
|
endif
|
|
|
|
|
|
2020-12-08 14:34:06 -06:00
|
|
|
if get_option('systemd') and systemd_unit_dir == ''
|
|
|
|
|
error('systemd development files or systemd_system_unit_dir is needed for systemd support.')
|
|
|
|
|
endif
|
|
|
|
|
|
2020-01-22 13:57:01 +01:00
|
|
|
dbus_service_dir = get_option('dbus_service_dir')
|
|
|
|
|
dbus_data_dir = datadir
|
|
|
|
|
dbus_interfaces_dir = ''
|
|
|
|
|
|
|
|
|
|
if dbus_dep.found()
|
|
|
|
|
if dbus_service_dir == ''
|
2025-02-20 20:55:17 +01:00
|
|
|
dbus_service_dir = dbus_dep.get_variable('system_bus_services_dir')
|
2020-01-22 13:57:01 +01:00
|
|
|
endif
|
2025-02-20 20:55:17 +01:00
|
|
|
dbus_interfaces_dir = dbus_dep.get_variable('interfaces_dir')
|
|
|
|
|
dbus_data_dir = dbus_dep.get_variable('datadir')
|
2020-01-22 13:57:01 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
dbus_conf_dir = dbus_data_dir / 'dbus-1/system.d'
|
|
|
|
|
|
|
|
|
|
if dbus_service_dir == ''
|
|
|
|
|
dbus_service_dir = datadir / 'dbus-1/system-services'
|
|
|
|
|
endif
|
|
|
|
|
if dbus_interfaces_dir == ''
|
|
|
|
|
dbus_interfaces_dir = datadir / 'dbus-1/interfaces'
|
|
|
|
|
endif
|
|
|
|
|
|
2025-02-20 20:55:17 +01:00
|
|
|
polkit_policy_directory = polkit_gobject_dep.get_variable('policydir')
|
2020-01-22 13:57:01 +01:00
|
|
|
|
|
|
|
|
xmllint = find_program('xmllint', required: false)
|
|
|
|
|
python3 = find_program('python3') # No meson without it!
|
2025-02-22 18:40:40 +01:00
|
|
|
|
|
|
|
|
# Tests dependencies
|
|
|
|
|
if get_option('tests')
|
|
|
|
|
pam_wrapper_dep = dependency('pam_wrapper', required: false)
|
|
|
|
|
if get_option('pam') and not pam_wrapper_dep.found()
|
|
|
|
|
warning('Dependency "pam_wrapper" required by test suite not found')
|
2020-01-22 13:57:01 +01:00
|
|
|
endif
|
2025-02-22 18:40:40 +01:00
|
|
|
|
|
|
|
|
python3_test_modules = {
|
|
|
|
|
'cairo': true,
|
|
|
|
|
'dbus': true,
|
|
|
|
|
'dbusmock': true,
|
|
|
|
|
'gi': true,
|
|
|
|
|
'gi.repository.FPrint': true,
|
|
|
|
|
'pypamtest': get_option('pam'),
|
|
|
|
|
}
|
|
|
|
|
python3_available_modules = []
|
|
|
|
|
|
|
|
|
|
foreach module, required : python3_test_modules
|
|
|
|
|
if required and run_command(python3, '-c', 'import @0@'.format(module), check: false).returncode() != 0
|
|
|
|
|
warning('Python3 module \'' + module + '\' required by test suite not found')
|
|
|
|
|
endif
|
|
|
|
|
endforeach
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
address_sanitizer = get_option('b_sanitize') == 'address'
|
2020-01-22 13:57:01 +01:00
|
|
|
|
|
|
|
|
cdata = configuration_data()
|
|
|
|
|
cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
|
|
|
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
|
|
|
|
cdata.set_quoted('VERSION', meson.project_version())
|
|
|
|
|
cdata.set_quoted('SYSCONFDIR', sysconfdir)
|
2020-11-27 18:21:29 +01:00
|
|
|
cdata.set('POLKIT_HAS_AUTOPOINTERS', polkit_gobject_dep.version().version_compare('>= 0.114'))
|
2020-01-22 13:57:01 +01:00
|
|
|
|
|
|
|
|
config_h = configure_file(
|
2020-02-05 17:07:10 +01:00
|
|
|
input: 'config.h.in',
|
2020-01-22 13:57:01 +01:00
|
|
|
output: 'config.h',
|
|
|
|
|
configuration: cdata
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
subdir('src')
|
|
|
|
|
subdir('data')
|
|
|
|
|
subdir('utils')
|
|
|
|
|
if get_option('pam')
|
|
|
|
|
subdir('pam')
|
|
|
|
|
endif
|
|
|
|
|
if get_option('gtk_doc')
|
|
|
|
|
subdir('doc')
|
|
|
|
|
endif
|
2025-02-22 18:40:40 +01:00
|
|
|
if get_option('tests')
|
|
|
|
|
subdir('tests')
|
|
|
|
|
endif
|
2020-01-22 13:57:01 +01:00
|
|
|
subdir('po')
|
2020-01-24 18:32:41 +01:00
|
|
|
|
|
|
|
|
output = []
|
|
|
|
|
output += 'System paths:'
|
|
|
|
|
output += ' prefix: ' + get_option('prefix')
|
|
|
|
|
output += ' fprintd daemon directory: ' + fprintd_installdir
|
|
|
|
|
output += ' fprintd modules directory: ' + fprintd_plugindir
|
|
|
|
|
output += ' fprintd prints storage directory: ' + storage_path
|
|
|
|
|
output += ' DBus configuration directory: ' + dbus_conf_dir
|
|
|
|
|
output += ' DBus service directory: ' + dbus_service_dir
|
|
|
|
|
output += ' DBus interfaces directory: ' + dbus_interfaces_dir
|
|
|
|
|
output += ' Polkit policy directory: ' + polkit_policy_directory
|
|
|
|
|
output += ' Systemd service directory: ' + systemd_unit_dir
|
|
|
|
|
if get_option('pam')
|
|
|
|
|
output += ' PAM module directory: ' + pam_modules_dir
|
|
|
|
|
endif
|
|
|
|
|
output += '\nOptional features:\n'
|
2024-08-30 17:52:28 +02:00
|
|
|
output += ' PAM module: ' + (get_option('pam') and pam_dep.found()).to_string()
|
2020-01-24 18:32:41 +01:00
|
|
|
output += ' Manuals: ' + get_option('man').to_string()
|
|
|
|
|
output += ' GTK Doc: ' + get_option('gtk_doc').to_string()
|
|
|
|
|
output += ' XML Linter ' + xmllint.found().to_string()
|
2020-02-13 19:16:17 +01:00
|
|
|
output += '\nTest setup:\n'
|
|
|
|
|
output += ' With address sanitizer: ' + address_sanitizer.to_string()
|
2020-01-24 18:32:41 +01:00
|
|
|
|
|
|
|
|
message('\n'+'\n'.join(output)+'\n')
|