232 kx project(
232 kx 'accountsservice', 'c',
232 kx version: run_command(['./generate-version.sh'], check: true).stdout().strip(),
232 kx license: 'GPL3+',
232 kx default_options: 'buildtype=debugoptimized',
232 kx meson_version: '>= 0.50.0',
232 kx )
232 kx
232 kx act_name = meson.project_name()
232 kx act_version = meson.project_version()
232 kx
232 kx act_api_version = '1.0'
232 kx act_api_name = '@0@-@1@'.format(act_name, act_api_version)
232 kx
232 kx act_id = 'Act'
232 kx
232 kx act_prefix = get_option('prefix')
232 kx act_datadir = join_paths(act_prefix, get_option('datadir'))
232 kx act_includedir = join_paths(act_prefix, get_option('includedir'))
232 kx act_libexecdir = join_paths(act_prefix, get_option('libexecdir'))
232 kx act_localstatedir = join_paths(act_prefix, get_option('localstatedir'))
232 kx act_sysconfdir = join_paths(act_prefix, get_option('sysconfdir'))
232 kx
232 kx act_pkgincludedir = join_paths(act_includedir, act_api_name)
232 kx
232 kx act_namespace = 'org.freedesktop.Accounts'
232 kx
232 kx act_gettext = 'accounts-service'
232 kx
232 kx soversion = 0
232 kx current = 0
232 kx revision = 0
232 kx libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
232 kx
232 kx act_buildtype = get_option('buildtype')
232 kx
232 kx gnome = import('gnome')
232 kx i18n = import('i18n')
232 kx pkg = import('pkgconfig')
232 kx
232 kx data_dir = join_paths(meson.current_source_dir(), 'data')
232 kx po_dir = join_paths(meson.current_source_dir(), 'po')
232 kx
232 kx top_inc = include_directories('.')
232 kx
232 kx cc = meson.get_compiler('c')
232 kx
232 kx config_h = configuration_data()
232 kx
232 kx # defines
232 kx config_h.set_quoted('VERSION', act_version)
232 kx config_h.set('_DEFAULT_SOURCE', true)
232 kx config_h.set('_GNU_SOURCE', true)
232 kx
232 kx # i18n
232 kx config_h.set_quoted('GETTEXT_PACKAGE', act_gettext)
232 kx
232 kx # headers
232 kx check_headers = [
232 kx 'paths.h',
232 kx 'shadow.h',
232 kx 'utmpx.h',
232 kx ]
232 kx
232 kx foreach header: check_headers
232 kx config_h.set('HAVE_' + header.underscorify().to_upper(), cc.has_header(header))
232 kx endforeach
232 kx
232 kx # functions
232 kx check_functions = [
232 kx 'getusershell',
232 kx 'setutxdb',
232 kx 'fgetpwent',
232 kx ]
232 kx
232 kx foreach func: check_functions
232 kx config_h.set('HAVE_' + func.underscorify().to_upper(), cc.has_function(func))
232 kx endforeach
232 kx
232 kx path_wtmp = '/var/log/wtmp'
232 kx config_h.set('PATH_WTMP', 'WTMPX_FILENAME')
232 kx
232 kx # compiler flags
232 kx common_flags = []
232 kx
232 kx # Only add this when optimizing is enabled
232 kx optimized_src = '''
232 kx #ifdef __OPTIMIZE__
232 kx #error No optimization
232 kx #endif
232 kx '''
232 kx
232 kx act_optimized = act_buildtype.contains('optimized') and cc.compiles(optimized_src)
232 kx message('whether optimization is enabled: ' + act_optimized.to_string())
232 kx if act_optimized
232 kx common_flags += '-Wp,-D_FORTIFY_SOURCE=2'
232 kx endif
232 kx
232 kx if act_buildtype.contains('debug')
232 kx common_flags += cc.get_supported_arguments([
232 kx '-Wcast-align',
232 kx '-Winit-self',
232 kx '-Wmissing-declarations',
232 kx '-Wmissing-prototypes',
232 kx '-Wnested-externs',
232 kx '-Wno-deprecated-declarations',
232 kx '-Wswitch-enum',
232 kx '-Wunsafe-loop-optimizations',
232 kx '-Wwrite-strings',
232 kx ])
232 kx endif
232 kx
232 kx add_project_arguments(common_flags, language: 'c')
232 kx
232 kx # Ensure we have the changes from https://gitlab.gnome.org/GNOME/glib/merge_requests/1286
232 kx # and https://gitlab.gnome.org/GNOME/glib/merge_requests/1342
232 kx glib_min_version = '2.63.5'
232 kx gio_dep = dependency('gio-2.0', version: '>= ' + glib_min_version)
232 kx gio_unix_dep = dependency('gio-unix-2.0')
232 kx glib_dep = dependency('glib-2.0', version: '>= ' + glib_min_version)
232 kx polkit_gobject_dep = dependency('polkit-gobject-1')
232 kx
232 kx # Using libxcrypt >= 4 we can be sure `crypt_gensalt (NULL, 0, NULL, 0)`
232 kx # always returns a setting that is valid to use with `crypt (pw, setting)`.
232 kx #
232 kx # The setting returned will specify (depending on the system's
232 kx # configuration of libxcrypt) in order of preferrence either
232 kx # yescrypt "$y$", (gost-yescrypt "$gy$), bcrypt "$2b$" or sha512crypt "$6$"
232 kx # as hash method, with a sufficient amount of cost or rounds and a random
232 kx # salt drawn from secure system ressources with at least 128 bits.
232 kx # (96 bits for sha512crypt, as more is not supported by this method, since
232 kx # the effectively used maximum is 16 base64-encoded characters)
232 kx crypt_dep = dependency('libxcrypt', required: false, version: '>= 4')
232 kx config_h.set('HAVE_CRYPT_GENSALT', crypt_dep.found())
232 kx if not crypt_dep.found()
232 kx crypt_dep = cc.find_library('crypt')
232 kx endif
232 kx
232 kx dbus_dep = dependency('dbus-1')
232 kx if dbus_dep.version().version_compare('>=1.9.18')
232 kx dbus_conf_dir = join_paths(dbus_dep.get_pkgconfig_variable('datadir', define_variable: ['datadir', act_datadir]), 'dbus-1', 'system.d')
232 kx else
232 kx dbus_conf_dir = join_paths(dbus_dep.get_pkgconfig_variable('sysconfdir', define_variable: ['sysconfdir', act_sysconfdir]), 'dbus-1', 'system.d')
232 kx endif
232 kx dbus_ifaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_dir', define_variable: ['datadir', act_datadir])
232 kx dbus_sys_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', act_datadir])
232 kx
232 kx policy_dir = polkit_gobject_dep.get_pkgconfig_variable('policydir', define_variable: ['prefix', act_prefix])
232 kx
232 kx # FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used
232 kx systemd_system_unit_dir = get_option('systemdsystemunitdir')
232 kx install_systemd_unit_dir = (systemd_system_unit_dir != 'no')
232 kx
232 kx if install_systemd_unit_dir and systemd_system_unit_dir == ''
232 kx systemd_dep = dependency('systemd', required: false)
232 kx assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
232 kx systemd_system_unit_dir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
232 kx endif
232 kx
232 kx # Core configuration
232 kx admin_group = get_option('admin_group')
232 kx if admin_group == ''
232 kx if run_command('test', '-e', '/etc/debian_version', check: false).returncode() == 0
232 kx admin_group = 'sudo'
232 kx # FIXME: this has been left for documentation purposes
232 kx elif run_command('test', '-e', '/etc/sysconfig/network-scripts', check: false).returncode() == 0
232 kx admin_group = 'wheel'
232 kx else
232 kx admin_group = 'wheel'
232 kx endif
232 kx endif
232 kx
232 kx extra_admin_groups = ','.join(get_option('extra_admin_groups'))
232 kx
232 kx config_h.set_quoted('ADMIN_GROUP', admin_group)
232 kx config_h.set_quoted('EXTRA_ADMIN_GROUPS', extra_admin_groups)
232 kx
232 kx config_h.set('MINIMUM_UID', get_option('minimum_uid'))
232 kx
232 kx # GDM
232 kx gdm_conf_file = get_option('gdmconffile')
232 kx config_h.set_quoted('PATH_GDM_CUSTOM', gdm_conf_file)
232 kx
232 kx # LightDM
232 kx lightdm_conf_file = get_option('lightdmconffile')
232 kx config_h.set_quoted('PATH_LIGHTDM_CONF', lightdm_conf_file)
232 kx
232 kx if get_option('elogind')
232 kx logind_dep = dependency('libelogind', version: '>= 229.4')
232 kx else
232 kx logind_dep = dependency('libsystemd', version: '>= 186')
232 kx endif
232 kx
232 kx subdir('data')
232 kx subdir('src')
232 kx subdir('po')
232 kx
232 kx enable_docbook = get_option('docbook')
232 kx if enable_docbook
232 kx subdir('doc/dbus')
232 kx endif
232 kx
232 kx if get_option('gtk_doc')
232 kx subdir('doc/libaccountsservice')
232 kx endif
232 kx
232 kx subdir('tests')
232 kx
232 kx configure_file(
232 kx output: 'config.h',
232 kx configuration: config_h,
232 kx )
232 kx
232 kx meson.add_install_script(
232 kx 'meson_post_install.py',
232 kx act_localstatedir,
232 kx )
232 kx
232 kx output = '\n' + meson.project_name() + ' was configured with the following options:\n'
232 kx output += '** DocBook documentation build: ' + enable_docbook.to_string() + '\n'
232 kx output += '** Administrator group: ' + admin_group + '\n'
232 kx output += '** Extra administrator groups: ' + extra_admin_groups + '\n'
232 kx output += '** GDM configuration: ' + gdm_conf_file + '\n'
232 kx output += '** LightDM configuration: ' + lightdm_conf_file
232 kx message(output)