diff options
Diffstat (limited to 'meson.build')
| -rw-r--r-- | meson.build | 113 |
1 files changed, 72 insertions, 41 deletions
diff --git a/meson.build b/meson.build index 1cc11d0d..980c6f46 100644 --- a/meson.build +++ b/meson.build @@ -6,13 +6,14 @@ project( # - add corresponding NM_VERSION_x_y_z macros in # "src/libnm-core-public/nm-version-macros.h.in" # - update number in configure.ac - version: '1.46.0', + version: '1.47.90', license: 'GPL2+', default_options: [ 'buildtype=debugoptimized', 'c_std=gnu11', + 'warning_level=2' # value "2" will add "-Wall" and "-Wextra" to the compiler flags ], - meson_version: '>= 0.47.2', + meson_version: '>= 0.51.0', ) nm_name = meson.project_name() @@ -42,10 +43,18 @@ nm_libexecdir = join_paths(nm_prefix, get_option('libexecdir')) nm_localedir = join_paths(nm_prefix, get_option('localedir')) nm_localstatedir = join_paths(nm_prefix, get_option('localstatedir')) nm_mandir = join_paths(nm_prefix, get_option('mandir')) -nm_runstatedir = join_paths(nm_localstatedir, 'run') nm_sbindir = join_paths(nm_prefix, get_option('sbindir')) nm_sysconfdir = join_paths(nm_prefix, get_option('sysconfdir')) +nm_runstatedir = get_option('runtime_dir') +if nm_runstatedir == '' + if get_option('prefix') == '/usr' + nm_runstatedir = '/run' + else + nm_runstatedir = join_paths(nm_localstatedir, 'run') + endif +endif + nm_pkgsbindir = join_paths(nm_sbindir, nm_name) nm_pkgconfdir = join_paths(nm_sysconfdir, nm_name) nm_pkgdatadir = join_paths(nm_datadir, nm_name) @@ -76,7 +85,7 @@ pkg = import('pkgconfig') source_root = meson.current_source_dir() build_root = meson.current_build_dir() -po_dir = join_paths(meson.source_root(), 'po') +po_dir = source_root / 'po' top_inc = include_directories('.') @@ -173,8 +182,6 @@ if enable_lto endif common_flags += cc.get_supported_arguments([ - '-Wall', - '-Wextra', '-Wcast-align=strict', '-Wdeclaration-after-statement', '-Wfloat-equal', @@ -254,8 +261,8 @@ config_h.set10('WITH_JANSSON', jansson_dep.found()) jansson_msg = 'no' if jansson_dep.found() - jansson_libdir = jansson_dep.get_pkgconfig_variable('libdir') - res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so')) + jansson_libdir = jansson_dep.get_variable(pkgconfig: 'libdir') + res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false) jansson_soname = '' foreach line: res.stdout().split('\n') if line.strip().contains('SONAME') @@ -297,7 +304,7 @@ config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_MIGRATE_IFCFG_RH', config_migrate_if enable_ifupdown = get_option('ifupdown') if enable_ifupdown == 'auto' - enable_ifupdown = (run_command('test', '-e', '/etc/debian_version').returncode() == 0) + enable_ifupdown = (run_command('test', '-e', '/etc/debian_version', check: false).returncode() == 0) else enable_ifupdown = (enable_ifupdown != 'false') endif @@ -363,7 +370,7 @@ install_systemdunitdir = (systemd_systemdsystemunitdir != 'no') if install_systemdunitdir and systemd_systemdsystemunitdir == '' assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it') - systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir', define_variable: ['rootprefix', nm_prefix]) + systemd_systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define: ['rootprefix', nm_prefix]) endif enable_systemd_journal = get_option('systemd_journal') @@ -428,10 +435,8 @@ if suspend_resume == 'auto' suspend_resume = 'systemd' elif libelogind_dep.found() suspend_resume = 'elogind' - elif session_tracking_consolekit - suspend_resume = 'consolekit' else - suspend_resume = 'upower' + suspend_resume = 'consolekit' endif endif @@ -450,8 +455,6 @@ elif suspend_resume == 'elogind' config_h.set('SUSPEND_RESUME_ELOGIND', true) elif suspend_resume == 'consolekit' config_h.set('SUSPEND_RESUME_CONSOLEKIT', true) -elif suspend_resume == 'upower' - config_h.set('SUSPEND_RESUME_UPOWER', true) else error('bug') endif @@ -500,7 +503,7 @@ endif enable_polkit = get_option('polkit') if enable_polkit # FIXME: policydir should be relative to `datadir`, not `prefix`. Fixed in https://gitlab.freedesktop.org/polkit/polkit/merge_requests/2 - polkit_gobject_policydir = dependency('polkit-gobject-1').get_pkgconfig_variable('policydir', define_variable: ['prefix', nm_prefix]) + polkit_gobject_policydir = dependency('polkit-gobject-1').get_variable(pkgconfig: 'policydir', pkgconfig_define: ['prefix', nm_prefix]) endif config_auth_polkit_default = get_option('config_auth_polkit_default') @@ -515,7 +518,7 @@ polkit_agent_helper_1_path = get_option('polkit_agent_helper_1') foreach p : [ '/usr/libexec/polkit-agent-helper-1', '/usr/lib/polkit-1/polkit-agent-helper-1', '/usr/lib/policykit-1/polkit-agent-helper-1' ] - if polkit_agent_helper_1_path == '' and run_command('test', '-f', p).returncode() == 0 + if polkit_agent_helper_1_path == '' and run_command('test', '-f', p, check: false).returncode() == 0 polkit_agent_helper_1_path = p endif endforeach @@ -550,23 +553,23 @@ endif dbus_conf_dir = get_option('dbus_conf_dir') if dbus_conf_dir == '' assert(dbus_dep.found(), 'D-Bus required but not found, please provide a valid system bus config dir') - dbus_conf_dir = join_paths(dbus_dep.get_pkgconfig_variable('datarootdir', define_variable: ['prefix', nm_prefix]), 'dbus-1', 'system.d') + dbus_conf_dir = join_paths(dbus_dep.get_variable(pkgconfig: 'datarootdir', pkgconfig_define: ['prefix', nm_prefix]), 'dbus-1', 'system.d') endif -dbus_interfaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_dir', define_variable: ['datadir', nm_datadir]) -dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', nm_datadir]) +dbus_interfaces_dir = dbus_dep.get_variable(pkgconfig: 'interfaces_dir', pkgconfig_define: ['datadir', nm_datadir]) +dbus_system_bus_services_dir = dbus_dep.get_variable(pkgconfig: 'system_bus_services_dir', pkgconfig_define: ['datadir', nm_datadir]) enable_firewalld_zone = get_option('firewalld_zone') config_h.set10('WITH_FIREWALLD_ZONE', enable_firewalld_zone) # pppd enable_ppp = get_option('ppp') -NM_PPP_VERSION_2_5_OR_NEWER = 0 +NM_PPP_VERSION_2_5_OR_NEWER = false if enable_ppp pppd_dep = dependency('pppd', required: false) if (pppd_dep.found()) pppd_version = pppd_dep.version() - NM_PPP_VERSION_2_5_OR_NEWER = 1 + NM_PPP_VERSION_2_5_OR_NEWER = true else assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required') pppd_version = '2.4.9' @@ -576,7 +579,11 @@ if enable_ppp if pppd_path == '' pppd = find_program('pppd', '/sbin/pppd', '/usr/sbin/pppd', required: false) assert(pppd.found(), 'pppd required but not found, please provide a valid pppd path or use -Dppp=false to disable it') - pppd_path = pppd.path() + if meson.version().version_compare('>= 0.55') + pppd_path = pppd.full_path() + else + pppd_path = pppd.path() + endif endif config_h.set_quoted('PPPD_PATH', pppd_path) @@ -596,7 +603,7 @@ if enable_modem_manager mobile_broadband_provider_info_database = get_option('mobile_broadband_provider_info_database') if mobile_broadband_provider_info_database == '' - mobile_broadband_provider_info_database = dependency('mobile-broadband-provider-info').get_pkgconfig_variable('database') + mobile_broadband_provider_info_database = dependency('mobile-broadband-provider-info').get_variable(pkgconfig: 'database') endif config_h.set_quoted('MOBILE_BROADBAND_PROVIDER_INFO_DATABASE', mobile_broadband_provider_info_database) endif @@ -630,7 +637,11 @@ foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ] '/usr/local/sbin/' + client, required : false) if client_prog.found() - client_path = client_prog.path() + if meson.version().version_compare('>= 0.55') + client_path = client_prog.full_path() + else + client_path = client_prog.path() + endif else client_path = '/usr/sbin/' + client message('@0@ not found, assume path @1@'.format(client, client_path)) @@ -672,7 +683,11 @@ foreach prog_name : ['resolvconf', 'netconfig'] '/usr/local/sbin/' + prog_name, required : false) if prog.found() - prog_path = prog.path() + if meson.version().version_compare('>= 0.55') + prog_path = prog.full_path() + else + prog_path = prog.path() + endif else prog_enable = false endif @@ -710,7 +725,11 @@ foreach prog : progs search_paths += (path + '/' + prog[0]) endforeach exe = find_program(search_paths, required : false) - path = exe.found() ? exe.path() : prog[2] + if meson.version().version_compare('>= 0.55') + path = exe.found() ? exe.full_path() : prog[2] + else + path = exe.found() ? exe.path() : prog[2] + endif endif name = prog[0].to_upper() + '_PATH' config_h.set_quoted(name, path) @@ -869,22 +888,32 @@ if enable_valgrind if valgrind_suppressions_path == '' valgrind_suppressions_path = join_paths(source_root, 'valgrind.suppressions') endif + if meson.version().version_compare('>= 0.55') + valgrind_path = valgrind.full_path() + else + valgrind_path = valgrind.path() + endif endif test_args = [ '--called-from-make', build_root, '', - enable_valgrind ? valgrind.path() : '', + enable_valgrind ? valgrind_path : '', enable_valgrind ? valgrind_suppressions_path : '', '--launch-dbus=auto', ] -py3 = import('python3') -python = py3.find_python() +python_mod = import('python') +python = python_mod.find_installation('python3', required: false) if python.found() - config_h.set_quoted('TEST_NM_PYTHON', python.path()) + if meson.version().version_compare('>= 0.55') + python_path = python.full_path() + else + python_path = python.path() + endif + config_h.set_quoted('TEST_NM_PYTHON', python_path) endif data_conf = configuration_data() @@ -966,19 +995,21 @@ test( subdir('examples/C/glib') enable_qt = get_option('qt') -if enable_qt - add_languages('cpp') - - qt_core_dep = dependency('QtCore', version: '>= 4') - qt_dbus_dep = dependency('QtDBus') - qt_network_dep = dependency('QtNetwork') - - subdir('examples/C/qt') +if enable_qt != 'false' + qt_core_dep = dependency('QtCore', version: '>= 4', required: enable_qt == 'yes') + qt_dbus_dep = dependency('QtDBus', required: enable_qt == 'yes') + qt_network_dep = dependency('QtNetwork', required: enable_qt == 'yes') + + # If enable_qt=='yes' we have all the dependencies. If it's 'auto', skip + # building the Qt examples if any dependency is missing. + if qt_core_dep.found() and qt_dbus_dep.found() and qt_network_dep.found() + add_languages('cpp') + subdir('examples/C/qt') + endif endif if enable_docs assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') - assert(meson.version().version_compare('>= 0.49.0'), '-Ddocs requires meson >= 0.49') subdir('man') subdir('docs') meson.add_dist_script( @@ -1115,7 +1146,7 @@ output += ' more-logging: ' + more_logging.to_string() + '\n' output += ' warning-level: ' + get_option('warning_level') + '\n' output += ' valgrind: ' + enable_valgrind.to_string() if enable_valgrind - output += ' ' + valgrind.path() + output += ' ' + valgrind_path endif output += '\n' output += ' code coverage: ' + get_option('b_coverage').to_string() + '\n' |