From e860a2e09cc1ae078b51ccda60eec24d5406ec1c Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:52:09 +0200 Subject: [PATCH 01/18] build: meson: fix setting iptables/dnsmasq/dnssec-trigger paths Handle the iptables, dnsmasq and dnssec-trigger paths in the same way through common code. The path set by user must be accepted as is, even if does not exist, because this is a requirement for cross-compilation. When user does not specify a path, search a predefined set of paths and fall back to an hardcoded one. (cherry picked from commit 220dea0948a22dfbdddb91ed76a23ae20d2c5810) --- meson.build | 37 ++++++++++++++++++++++++++----------- meson_options.txt | 6 +++--- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/meson.build b/meson.build index 3902dda1d5..7806c53084 100644 --- a/meson.build +++ b/meson.build @@ -652,19 +652,34 @@ endif config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default) -# iptables path -config_h.set_quoted('IPTABLES_PATH', find_program(get_option('iptables')).path()) +# external misc tools paths +default_paths = ['/sbin', '/usr/sbin'] +dnssec_ts_paths = ['/usr/local/libexec', + '/usr/local/lib', + '/usr/local/lib/dnssec-trigger', + '/usr/libexec', + '/usr/lib', + '/usr/lib/dnssec-trigger'] -# dnsmasq path -config_h.set_quoted('DNSMASQ_PATH', find_program(get_option('dnsmasq')).path()) +# 0: cmdline option, 1: paths, 2: fallback, 3: config.h option +progs = [['iptables', default_paths, '/sbin/iptables'], + ['dnsmasq', default_paths, ''], + ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script'), 'DNSSEC_TRIGGER_SCRIPT'], + ] -# dnssec-trigger-script path -dnssec_trigger_script = find_program(get_option('dnssec_trigger'), required: false) -if dnssec_trigger_script.found() - config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', dnssec_trigger_script.path()) -else - config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', join_paths(nm_libexecdir, 'dnssec-trigger-script')) -endif +foreach prog : progs + path = get_option(prog[0]) + if path == '' + search_paths = [ prog[0] ] + foreach path : prog[1] + search_paths += (path + '/' + prog[0]) + endforeach + exe = find_program(search_paths, required : false) + path = exe.found() ? exe.path() : prog[2] + endif + name = prog.length() > 3 ? prog[3] : (prog[0].to_upper() + '_PATH') + config_h.set_quoted(name, path) +endforeach # system CA certificates path system_ca_path = get_option('system_ca_path') diff --git a/meson_options.txt b/meson_options.txt index 25ec7ae4e9..6bd1eec3c9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,9 +7,9 @@ option('dbus_ifaces_dir', type: 'string', value: '', description: 'where D-Bus i option('dbus_sys_dir', type: 'string', value: '', description: 'where D-Bus system service directory is') option('polkit_dir', type: 'string', value: '', description: 'where PolicyKit policy directory is') option('kernel_firmware_dir', type: 'string', value: '/lib/firmware', description: 'where kernel firmware directory is (default is /lib/firmware)') -option('iptables', type: 'array', value: ['iptables', '/sbin/iptables', '/usr/sbin/iptables'], description: 'path to iptables') -option('dnsmasq', type: 'array', value: ['dnsmasq', '/sbin/dnsmasq', '/usr/sbin/dnsmasq'], description: 'path to dnsmasq') -option('dnssec_trigger', type: 'array', value: ['dnssec-trigger-script', '/usr/local/libexec/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger-script', '/usr/local/lib/dnssec-trigger/dnssec-trigger-script', '/usr/libexec/dnssec-trigger-script', '/usr/lib/dnssec-trigger-script', '/usr/lib/dnssec-trigger/dnssec-trigger-script'], description: 'path to unbound dnssec-trigger-script') +option('iptables', type: 'string', value: '', description: 'path to iptables') +option('dnsmasq', type: 'string', value: '', description: 'path to dnsmasq') +option('dnssec_trigger', type: 'string', value: '', description: 'path to unbound dnssec-trigger-script') # platform option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string') From bda3bb931bb3120d77ee546507ebc6983caf5be4 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:52:59 +0200 Subject: [PATCH 02/18] build: meson: fix pppd path Allow specifying a non-existent path. (cherry picked from commit 794e499ab8b8825d9794d7c2e320b10909fc3ba3) --- meson.build | 13 ++++++++----- meson_options.txt | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 7806c53084..40e1b1066b 100644 --- a/meson.build +++ b/meson.build @@ -505,11 +505,14 @@ enable_ppp = get_option('ppp') if enable_ppp assert(cc.has_header('pppd/pppd.h'), 'couldn\'t find pppd.h. pppd development headers are required') - locations = get_option('pppd') - pppd = find_program(locations, 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 = get_option('pppd') + 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() + endif - config_h.set_quoted('PPPD_PATH', pppd.path()) + config_h.set_quoted('PPPD_PATH', pppd_path) pppd_plugin_dir = get_option('pppd_plugin_dir') if pppd_plugin_dir == '' @@ -984,7 +987,7 @@ output += ' wifi: ' + enable_wifi.to_string() + '\n' output += ' iwd: ' + enable_iwd.to_string() + '\n' output += ' pppd: ' + enable_ppp.to_string() if enable_ppp - output += ' ' + pppd.path() + output += ' ' + pppd_path endif output += '\n' output += ' modemmanager-1: ' + enable_modem_manager.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 6bd1eec3c9..82971e5527 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -30,7 +30,7 @@ option('wext', type: 'boolean', value: true, description: 'Enable or disable Lin option('wifi', type: 'boolean', value: true, description: 'enable Wi-Fi support') option('iwd', type: 'boolean', value: false, description: 'enable iwd support (experimental)') option('ppp', type: 'boolean', value: true, description: 'enable PPP/PPPoE support') -option('pppd', type: 'array', value: ['pppd', '/sbin/pppd', '/usr/sbin/pppd'], description: 'path to pppd binary') +option('pppd', type: 'string', value: '', description: 'path to pppd binary') option('pppd_plugin_dir', type: 'string', value: '', description: 'path to the pppd plugins directory') option('modem_manager', type: 'boolean', value: true, description: 'Enable new ModemManager1 interface support') option('ofono', type: 'boolean', value: false, description: 'Enable oFono support (experimental)') From 365482bf5ec536e8b89f645a16de371aee50c6f9 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:53:40 +0200 Subject: [PATCH 03/18] build: remove check on dhclient version dhclient 4.0 was released more than 10 years ago. I think it is reasonable to expect that nobody is using an older version today. https://source.isc.org/cgi-bin/gitweb.cgi?p=dhcp.git;a=shortlog;h=refs/tags/v4_0_0 (cherry picked from commit 9e61ea70402b5d8140de512bdcf84252fcb0d11c) --- configure.ac | 6 +----- meson.build | 5 ----- meson_options.txt | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 67b1ecd6f4..e9d2fa97c9 100644 --- a/configure.ac +++ b/configure.ac @@ -842,7 +842,7 @@ AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes") # DHCP client support AC_ARG_WITH([dhclient], - AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support])) + AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support])) if test "$with_dhclient" != "no"; then with_dhclient_="$with_dhclient" AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin) @@ -851,10 +851,6 @@ if test "$with_dhclient" != "no"; then AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient]) with_dhclient=/usr/sbin/dhclient fi - else - if ! $with_dhclient --version 2>&1 | grep -q "^isc-dhclient-4\."; then - AC_MSG_WARN([Seems version of dhclient $with_dhclient is too old, version 4.x or newer is required.]) - fi fi fi if test "$with_dhclient" != "no"; then diff --git a/meson.build b/meson.build index 40e1b1066b..e750ff013d 100644 --- a/meson.build +++ b/meson.build @@ -560,11 +560,6 @@ if enable_dhclient enable_dhclient = dhclient.found() if enable_dhclient - res = run_command(dhclient, '--version') - # FIXME: dhcp outputs the version string through stderr!? - if not res.stderr().strip().contains('isc-dhclient-4.') - message('Seems version of dhclient ' + dhclient.path() + ' is too old, version 4.x or newer is required') - endif config_h.set_quoted('DHCLIENT_PATH', dhclient.path()) endif endif diff --git a/meson_options.txt b/meson_options.txt index 82971e5527..73e0602c4f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -55,7 +55,7 @@ option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'fil # dhcp clients option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') -option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient 4.x support') +option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient support') option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd 4.x support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') option('dhcpcd_supports_ipv6', type: 'boolean', value: true, description: 'Whether using dhcpcd >= 6.x which has IPv6 support') From b66607af957e5beb8ffa063303bb8ab692a5fd05 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:54:07 +0200 Subject: [PATCH 04/18] build: remove check on dhcpcd version number dhcpcd version 6, the first supporting IPv6, was released more than 5 years ago. Remove all checks on version number and IPv6 support. (cherry picked from commit e0c49d7341a0329e2c40e25fee5d3ce249f5ebe6) --- config.h.meson | 3 --- configure.ac | 32 -------------------------------- meson.build | 19 ------------------- meson_options.txt | 3 +-- src/dhcp/nm-dhcp-dhcpcd.c | 2 -- 5 files changed, 1 insertion(+), 58 deletions(-) diff --git a/config.h.meson b/config.h.meson index ce77952bec..07129b2e00 100644 --- a/config.h.meson +++ b/config.h.meson @@ -10,9 +10,6 @@ /* Define to path of dhcpcd binary */ #mesondefine DHCPCD_PATH -/* Define if dhcpcd supports IPv6 (6.x+) */ -#mesondefine DHCPCD_SUPPORTS_IPV6 - /* Define to path of dnsmasq binary */ #mesondefine DNSMASQ_PATH diff --git a/configure.ac b/configure.ac index e9d2fa97c9..b41def3134 100644 --- a/configure.ac +++ b/configure.ac @@ -862,10 +862,6 @@ fi AC_ARG_WITH([dhcpcd], AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support])) -AC_ARG_WITH([dhcpcd-supports-ipv6], - AS_HELP_STRING([--with-dhcpcd-supports-ipv6=yes|no|auto], - [Whether using dhcpcd >= 6.x which has IPv6 support]), - [with_dhcpcd_supports_ipv6=$withval], [with_dhcpcd_supports_ipv6=auto]) if test "$with_dhcpcd" != "no"; then with_dhcpcd_="$with_dhcpcd" AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin) @@ -873,36 +869,9 @@ if test "$with_dhcpcd" != "no"; then if test "$with_dhcpcd_" == yes; then AC_MSG_WARN([dhcpcd not found, assume path /usr/sbin/dhcpcd]) with_dhcpcd=/usr/sbin/dhcpcd - if test "$with_dhcpcd_supports_ipv6" == auto; then - with_dhcpcd_supports_ipv6=yes - fi - fi - else - if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[456789]]\."; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd is too old, version 4.x or newer is required]) fi fi fi -if test "$with_dhcpcd" != "no"; then - if $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [[6789]]\."; then - if test "$with_dhcpcd_supports_ipv6" == no; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd supports IPv6, but compiling --with-dhcpcd-supports-ipv6=no]) - else - with_dhcpcd_supports_ipv6=yes - fi - else - if test "$with_dhcpcd_supports_ipv6" == yes; then - AC_MSG_WARN([Seems version of dhcpcd $with_dhcpcd does not support IPv6, but compiling --with-dhcpcd-supports-ipv6=yes]) - else - with_dhcpcd_supports_ipv6=no - fi - fi - if test "$with_dhcpcd_supports_ipv6" != no; then - AC_DEFINE(DHCPCD_SUPPORTS_IPV6, 1, [Define if dhcpcd supports IPv6 (6.x+)]) - fi -else - with_dhcpcd_supports_ipv6=no -fi if test "$with_dhcpcd" != "no"; then AC_DEFINE(WITH_DHCPCD, 1, [Define if you have dhcpcd]) AC_SUBST(DHCPCD_PATH, $with_dhcpcd) @@ -1380,7 +1349,6 @@ echo "DHCP clients (default $config_dhcp_default):" echo " dhcpcanon: $with_dhcpcanon" echo " dhclient: $with_dhclient" echo " dhcpcd: $with_dhcpcd" -echo " dhcpcd-supports-ipv6: $with_dhcpcd_supports_ipv6" echo echo "Miscellaneous:" diff --git a/meson.build b/meson.build index e750ff013d..3a99b10ba4 100644 --- a/meson.build +++ b/meson.build @@ -567,29 +567,11 @@ config_h.set10('WITH_DHCLIENT', enable_dhclient) locations = get_option('dhcpcd') enable_dhcpcd = (locations != ['no']) -enable_dhcpcd_supports_ipv6 = false if enable_dhcpcd dhcpcd = find_program(locations, required: false) enable_dhcpcd = dhcpcd.found() if enable_dhcpcd - res = run_command(dhcpcd, '--version').stdout().strip() - dhcpcd_version = res.split(' ')[1] - if not dhcpcd_version.version_compare('> 4') - message('Seems version of dhcpcd ' + dhcpcd.path() + ' is too old, version 4.x or newer is required') - endif - - enable_dhcpcd_supports_ipv6 = get_option('dhcpcd_supports_ipv6') - if dhcpcd_version.version_compare('> 6') - if not enable_dhcpcd_supports_ipv6 - message('Seems version of dhcpcd ' + dhcpcd.path() + ' supports IPv6, but compiling without IPv6 support.') - endif - else - if enable_dhcpcd_supports_ipv6 - message('Seems version of dhcpcd ' + dhcpcd.path() +' does not support IPv6, but compiling with IPv6 support.') - endif - endif - config_h.set('DHCPCD_SUPPORTS_IPV6', enable_dhcpcd_supports_ipv6) config_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) endif endif @@ -1025,7 +1007,6 @@ if enable_dhcpcd output += ' ' + dhcpcd.path() endif output += '\n' -output += ' dhcpcd-supports-ipv6: ' + enable_dhcpcd_supports_ipv6.to_string() + '\n' output += '\nMiscellaneous:\n' output += ' have introspection: ' + enable_introspection.to_string() + '\n' output += ' build documentation and manpages: ' + enable_docs.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 73e0602c4f..294c955a83 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -56,9 +56,8 @@ option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'fil # dhcp clients option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient support') -option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd 4.x support') +option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') -option('dhcpcd_supports_ipv6', type: 'boolean', value: true, description: 'Whether using dhcpcd >= 6.x which has IPv6 support') # miscellaneous option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build') diff --git a/src/dhcp/nm-dhcp-dhcpcd.c b/src/dhcp/nm-dhcp-dhcpcd.c index de04bbda86..98ab5342ce 100644 --- a/src/dhcp/nm-dhcp-dhcpcd.c +++ b/src/dhcp/nm-dhcp-dhcpcd.c @@ -133,13 +133,11 @@ ip4_start (NMDhcpClient *client, g_ptr_array_add (argv, (gpointer) "-c"); /* Set script file */ g_ptr_array_add (argv, (gpointer) nm_dhcp_helper_path); -#ifdef DHCPCD_SUPPORTS_IPV6 /* IPv4-only for now. NetworkManager knows better than dhcpcd when to * run IPv6, and dhcpcd's automatic Router Solicitations cause problems * with devices that don't expect them. */ g_ptr_array_add (argv, (gpointer) "-4"); -#endif hostname = nm_dhcp_client_get_hostname (client); From 4fd662316165bcd603664ab9bc60ad0ee96037f9 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 16:55:54 +0200 Subject: [PATCH 05/18] build: move paths of dhcp clients from config-extra.h to config.h Some path variable like $(bindir), $(datadir), etc. are special for autotools and must be handled separately through config-extra.h. But dhcp path variables are just normal variables defined through the configure script and should go into config.h. (cherry picked from commit 087c367d626a4c5b58dae5bc11670f3ab34b0e44) --- Makefile.am | 3 --- config-extra.h.meson | 3 --- configure.ac | 6 +++--- meson.build | 9 --------- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/Makefile.am b/Makefile.am index c1615108a1..3490aed28e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -120,9 +120,6 @@ config-extra.h: Makefile echo "/* Generated by Makefile.am */" >$@ && \ echo "#define BINDIR \"$(bindir)\"" >>$@ && \ echo "#define DATADIR \"$(datadir)\"" >>$@ && \ - echo "#define DHCLIENT_PATH \"$(DHCLIENT_PATH)\"" >>$@ && \ - echo "#define DHCPCANON_PATH \"$(DHCPCANON_PATH)\"" >>$@ && \ - echo "#define DHCPCD_PATH \"$(DHCPCD_PATH)\"" >>$@ && \ echo "#define LIBEXECDIR \"$(libexecdir)\"" >>$@ && \ echo "#define LOCALSTATEDIR \"$(localstatedir)\"" >>$@ && \ echo "#define NMCONFDIR \"$(nmconfdir)\"" >>$@ && \ diff --git a/config-extra.h.meson b/config-extra.h.meson index dbe077d4fa..34c962fdd5 100644 --- a/config-extra.h.meson +++ b/config-extra.h.meson @@ -1,8 +1,5 @@ #mesondefine BINDIR #mesondefine DATADIR -#mesondefine DHCLIENT_PATH -#mesondefine DHCPCANON_PATH -#mesondefine DHCPCD_PATH #mesondefine LIBEXECDIR #mesondefine LOCALSTATEDIR #mesondefine NMCONFDIR diff --git a/configure.ac b/configure.ac index b41def3134..22d3e2acfe 100644 --- a/configure.ac +++ b/configure.ac @@ -822,7 +822,7 @@ if test "$with_dhcpcanon" != "no"; then fi if test "$with_dhcpcanon" != "no"; then AC_DEFINE(WITH_DHCPCANON, 1, [Define if you have dhcpcanon]) - AC_SUBST(DHCPCANON_PATH, $with_dhcpcanon) + AC_DEFINE_UNQUOTED(DHCPCANON_PATH, "$with_dhcpcanon", [Define path to dhcpcanon]) else AC_DEFINE(WITH_DHCPCANON, 0, [Define if you have dhcpcanon]) fi @@ -855,7 +855,7 @@ if test "$with_dhclient" != "no"; then fi if test "$with_dhclient" != "no"; then AC_DEFINE(WITH_DHCLIENT, 1, [Define if you have dhclient]) - AC_SUBST(DHCLIENT_PATH, $with_dhclient) + AC_DEFINE_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient]) else AC_DEFINE(WITH_DHCLIENT, 0, [Define if you have dhclient]) fi @@ -874,7 +874,7 @@ if test "$with_dhcpcd" != "no"; then fi if test "$with_dhcpcd" != "no"; then AC_DEFINE(WITH_DHCPCD, 1, [Define if you have dhcpcd]) - AC_SUBST(DHCPCD_PATH, $with_dhcpcd) + AC_DEFINE_UNQUOTED(DHCPCD_PATH, "$with_dhcpcd", [Define path to dhcpcd]) else AC_DEFINE(WITH_DHCPCD, 0, [Define if you have dhcpcd]) fi diff --git a/meson.build b/meson.build index 3a99b10ba4..673ba96a39 100644 --- a/meson.build +++ b/meson.build @@ -885,15 +885,6 @@ config_extra_h = configuration_data() config_extra_h.set_quoted('BINDIR', nm_bindir) config_extra_h.set_quoted('DATADIR', nm_datadir) -if enable_dhclient - config_extra_h.set_quoted('DHCLIENT_PATH', dhclient.path()) -endif -if enable_dhcpcanon - config_extra_h.set_quoted('DHCPCANON_PATH', dhcpcanon.path()) -endif -if enable_dhcpcd - config_extra_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) -endif config_extra_h.set_quoted('LIBEXECDIR', nm_libexecdir) config_extra_h.set_quoted('LOCALSTATEDIR', nm_localstatedir) config_extra_h.set_quoted('NMCONFDIR', nm_pkgconfdir) From 73249e2ef7a27ffd2de54db9476aa468837bdd4d Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 17:02:59 +0200 Subject: [PATCH 06/18] build: meson: uniform handling of dhcp client paths Handle all dhcp client paths through the same code. (cherry picked from commit 36b0e46146ec7f67acb365e83e306d781f198d1c) --- meson.build | 95 ++++++++++++++++------------------------------- meson_options.txt | 6 +-- 2 files changed, 34 insertions(+), 67 deletions(-) diff --git a/meson.build b/meson.build index 673ba96a39..2a20cf5a94 100644 --- a/meson.build +++ b/meson.build @@ -539,58 +539,39 @@ config_h.set10('WITH_BLUEZ5_DUN', enable_bluez5_dun) enable_ofono = get_option('ofono') config_h.set10('WITH_OFONO', enable_ofono) -# DHCP client support with dhcpcanon -locations = get_option('dhcpcanon') -enable_dhcpcanon = (locations != ['no']) -if enable_dhcpcanon - dhcpcanon = find_program(locations, required: false) - enable_dhcpcanon = dhcpcanon.found() - - if enable_dhcpcanon - config_h.set_quoted('DHCPCANON_PATH', dhcpcanon.path()) - endif -endif -config_h.set10('WITH_DHCPCANON', enable_dhcpcanon) - # DHCP client support -locations = get_option('dhclient') -enable_dhclient = (locations != ['no']) -if enable_dhclient - dhclient = find_program(locations, required: false) - enable_dhclient = dhclient.found() - - if enable_dhclient - config_h.set_quoted('DHCLIENT_PATH', dhclient.path()) - endif -endif -config_h.set10('WITH_DHCLIENT', enable_dhclient) - -locations = get_option('dhcpcd') -enable_dhcpcd = (locations != ['no']) -if enable_dhcpcd - dhcpcd = find_program(locations, required: false) - enable_dhcpcd = dhcpcd.found() - - if enable_dhcpcd - config_h.set_quoted('DHCPCD_PATH', dhcpcd.path()) - endif -endif -config_h.set10('WITH_DHCPCD', enable_dhcpcd) - config_dhcp_default = get_option('config_dhcp_default') -if config_dhcp_default == 'dhcpcanon' and not enable_dhcpcanon - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - -if config_dhcp_default == 'dhclient' and not enable_dhclient - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - -if config_dhcp_default == 'dhcpcd' and not enable_dhcpcd - error(config_dhcp_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') -endif - config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default) +dhcp_summary = '' +foreach client : [ 'dhclient', 'dhcpcd', 'dhcpcanon' ] + client_path = get_option(client) + client_enable = (client_path != 'no') + if client_enable + if client_path == '' + client_prog = find_program(client, + '/sbin/' + client, + '/usr/sbin/pppd/' + client, + '/usr/local/sbin/' + client, + required : false) + if client_prog.found() + client_path = client_prog.path() + else + client_path = '/usr/sbin/' + client + message('@0@ not found, assume path @1@'.format(client, client_path)) + endif + endif + config_h.set_quoted(client.to_upper() + '_PATH', client_path) + endif + if config_dhcp_default == client and not client_enable + error(client + ' has not been enabled. Please don\'t disable it or use another configuration option for main.dhcp setting') + endif + config_h.set10('WITH_' + client.to_upper(), client_enable) + dhcp_summary += (' ' + client + ': ' + client_enable.to_string()) + if (client_enable) + dhcp_summary += (' ' + client_path) + endif + dhcp_summary += '\n' +endforeach # OpenVSwitch integration enable_ovs = get_option('ovs') @@ -982,21 +963,7 @@ if enable_netconfig endif output += '\n' output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n' -output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' -output += ' dhcpcanon: ' + enable_dhcpcanon.to_string() -if enable_dhcpcanon - output += ' ' + dhcpcanon.path() -endif -output += '\n' -output += ' dhclient: ' + enable_dhclient.to_string() -if enable_dhclient - output += ' ' + dhclient.path() -endif -output += '\n' -output += ' dhcpcd: ' + enable_dhcpcd.to_string() -if enable_dhcpcd - output += ' ' + dhcpcd.path() -endif +output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary output += '\n' output += '\nMiscellaneous:\n' output += ' have introspection: ' + enable_introspection.to_string() + '\n' diff --git a/meson_options.txt b/meson_options.txt index 294c955a83..5e5fd726ac 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -54,9 +54,9 @@ option('netconfig', type: 'array', value: ['netconfig', '/sbin/netconfig', '/usr option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'file', 'netconfig', 'resolvconf'], value: 'symlink', description: 'Configure default value for main.rc-manager setting') # dhcp clients -option('dhcpcanon', type: 'array', value: ['dhcpcanon', '/sbin/dhcpcanon', '/usr/sbin/dhcpcanon', '/usr/local/sbin/dhcpcanon', '/usr/bin/dhcpcanon', '/usr/local/bin/dhcpcanon'], description: 'Enable dhcpcanon support (experimental)') -option('dhclient', type: 'array', value: ['dhclient', '/sbin/dhclient', '/usr/sbin/dhclient', '/usr/local/sbin/dhclient'], description: 'Enable dhclient support') -option('dhcpcd', type: 'array', value: ['dhcpcd', '/sbin/dhcpcd', '/usr/sbin/dhcpcd', '/usr/local/sbin/dhcpcd'], description: 'Enable dhcpcd support') +option('dhclient', type: 'string', value: '', description: 'Enable dhclient support') +option('dhcpcanon', type: 'string', value: '', description: 'Enable dhcpcanon support (experimental)') +option('dhcpcd', type: 'string', value: '', description: 'Enable dhcpcd support') option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', 'dhcpcd', 'internal'], value: 'internal', description: 'Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset') # miscellaneous From 5a0cef2f3632ca980b2df6a8fd2e09dffabc69a2 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 17:12:31 +0200 Subject: [PATCH 07/18] build: meson: uniform handling of rc managers Handle all rc managers paths through the same code. (cherry picked from commit 2fd7559819c2de392d6964cacc0032d2066d0d6e) --- meson.build | 75 +++++++++++++++++++++-------------------------- meson_options.txt | 4 +-- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/meson.build b/meson.build index 2a20cf5a94..3975706e47 100644 --- a/meson.build +++ b/meson.build @@ -579,39 +579,41 @@ if enable_ovs assert(jansson_dep.found(), 'jansson is needed for OpenVSwitch integration. Use -Dovs=false to disable it') endif -# resolvconf and netconfig support -locations = get_option('resolvconf') -enable_resolvconf = (locations != ['no']) -if enable_resolvconf - resolvconf = find_program(locations, required: false) - enable_resolvconf = resolvconf.found() - - if enable_resolvconf - config_h.set_quoted('RESOLVCONF_PATH', resolvconf.path()) - endif -endif - -locations = get_option('netconfig') -enable_netconfig = (locations != ['no']) -if enable_netconfig - netconfig = find_program(locations, required: false) - enable_netconfig = netconfig.found() - - if enable_netconfig - config_h.set_quoted('NETCONFIG_PATH', netconfig.path()) - endif -endif - +# DNS resolv.conf managers config_dns_rc_manager_default = get_option('config_dns_rc_manager_default') -if config_dns_rc_manager_default == 'resolvconf' and not enable_resolvconf - error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') -endif - -if config_dns_rc_manager_default == 'netconfig' and not enable_netconfig - error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') -endif - config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default) +resolv_conf_summary = '' +foreach prog_name : ['resolvconf', 'netconfig'] + prog_path = get_option(prog_name) + prog_enable = (prog_path != 'no') + + if prog_enable + if prog_path == '' + prog = find_program(prog_name, + '/usr/' + prog_name, + '/usr/sbin/' + prog_name, + '/usr/local/sbin' + prog_name, + required : false) + if prog.found() + prog_path = prog.path() + else + prog_enable = false + endif + endif + endif + + if prog_enable + config_h.set_quoted(prog_name.to_upper() + '_PATH', prog_path) + elif config_dns_rc_manager_default == prog_name + error(prog_name + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting') + endif + + resolv_conf_summary += ' ' + prog_name + ': ' + prog_enable.to_string() + if prog_enable + resolv_conf_summary += ' ' + prog_path + endif + resolv_conf_summary += '\n' +endforeach # external misc tools paths default_paths = ['/sbin', '/usr/sbin'] @@ -951,16 +953,7 @@ output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ') output += ' ibft: ' + enable_ibft.to_string() + '\n' output += ' ifcfg-rh: ' + enable_ifcfg_rh.to_string() + '\n' output += ' ifupdown: ' + enable_ifupdown.to_string() + '\n' -output += '\nHandlers for /etc/resolv.conf:\n' -output += ' resolvconf: ' + enable_resolvconf.to_string() -if enable_resolvconf - output += ' ' + resolvconf.path() -endif -output += '\n' -output += ' netconfig: ' + enable_netconfig.to_string() -if enable_netconfig - output += ' ' + netconfig.path() -endif +output += '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary output += '\n' output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n' output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary diff --git a/meson_options.txt b/meson_options.txt index 5e5fd726ac..7f06d53a71 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -49,8 +49,8 @@ option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') # handlers for resolv.conf -option('resolvconf', type: 'array', value: ['resolvconf', '/sbin/resolvconf', '/usr/sbin/resolvconf', '/usr/local/sbin/resolvconf'], description: 'Enable resolvconf support') -option('netconfig', type: 'array', value: ['netconfig', '/sbin/netconfig', '/usr/sbin/netconfig', '/usr/local/sbin/netconfig'], description: 'Enable SUSE netconfig support') +option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support') +option('netconfig', type: 'string', value: '', description: 'Enable SUSE netconfig support') option('config_dns_rc_manager_default', type: 'combo', choices: ['symlink', 'file', 'netconfig', 'resolvconf'], value: 'symlink', description: 'Configure default value for main.rc-manager setting') # dhcp clients From e37e4d0fb68905a13009c28dfda621e85ccd3521 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 7 Sep 2018 17:15:02 +0200 Subject: [PATCH 08/18] build: autotools: remove unused defines Remove AC_DEFINE()s that add unused entries to config.h. (cherry picked from commit 8b313d4c549b33f0cff163f6fc0d951e7e9e480a) --- configure.ac | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/configure.ac b/configure.ac index 22d3e2acfe..6daf5bfd7a 100644 --- a/configure.ac +++ b/configure.ac @@ -603,9 +603,6 @@ if (test "${enable_teamdctl}" = "yes"); then fi # temporary bug workaround LIBTEAMDCTL_CFLAGS=`echo $LIBTEAMDCTL_CFLAGS | sed -e 's:/teamdctl.h::'` - AC_DEFINE(WITH_TEAMDCTL, 1, [Define if you have Teamd control support]) -else - AC_DEFINE(WITH_TEAMDCTL, 0, [Define if you have Teamd control support]) fi AM_CONDITIONAL(WITH_TEAMDCTL, test "${enable_teamdctl}" = "yes") @@ -674,16 +671,6 @@ if test "${have_crypto_nss}" = "yes"; then fi AM_CONDITIONAL(HAVE_CRYPTO_GNUTLS, test "${have_crypto_gnutls}" = 'yes') AM_CONDITIONAL(HAVE_CRYPTO_NSS, test "${have_crypto_nss}" = 'yes') -if test "${have_crypto_gnutls}" = 'yes'; then - AC_DEFINE(HAVE_CRYPTO_GNUTLS, 1, [Define if you have gnutls support]) -else - AC_DEFINE(HAVE_CRYPTO_GNUTLS, 0, [Define if you have gnutls support]) -fi -if test "${have_crypto_nss}" = 'yes'; then - AC_DEFINE(HAVE_CRYPTO_NSS, 1, [Define if you have nss support]) -else - AC_DEFINE(HAVE_CRYPTO_NSS, 0, [Define if you have nss support]) -fi AC_ARG_WITH(crypto, AS_HELP_STRING([--with-crypto=nss|gnutls], @@ -773,12 +760,6 @@ if (test "${with_modem_manager_1}" != "no"); then with_modem_manager_1="yes" fi fi - -if (test "${with_modem_manager_1}" = "yes"); then - AC_DEFINE(WITH_MODEM_MANAGER_1, 1, [Define if you have ModemManager1 support]) -else - AC_DEFINE(WITH_MODEM_MANAGER_1, 0, [Define if you have ModemManager1 support]) -fi AM_CONDITIONAL(WITH_MODEM_MANAGER_1, test "${with_modem_manager_1}" = "yes") # Bluez5 DUN support @@ -834,9 +815,6 @@ if test "${enable_ovs}" != "no"; then if test "$have_jansson" = "no"; then AC_MSG_ERROR(Jansson is required for ovs support) fi - AC_DEFINE(WITH_OPENVSWITCH, 1, [Define if you have OpenVSwitch support]) -else - AC_DEFINE(WITH_OPENVSWITCH, 0, [Define if you have OpenVSwitch support]) fi AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes") From 6220bae2d3aeed2a9f291ed48b3432d024db73c6 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 10 Sep 2018 15:58:49 +0200 Subject: [PATCH 09/18] ifcfg-rh: fix build with meson The shared object was missing some files. (cherry picked from commit bd556c8937d65b7828f6ec42725afc001aefebdb) --- src/settings/plugins/ifcfg-rh/meson.build | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/settings/plugins/ifcfg-rh/meson.build b/src/settings/plugins/ifcfg-rh/meson.build index 5d9689a52c..e4bce09b2a 100644 --- a/src/settings/plugins/ifcfg-rh/meson.build +++ b/src/settings/plugins/ifcfg-rh/meson.build @@ -18,7 +18,7 @@ libnmdbus_ifcfg_rh = static_library( dependencies: glib_dep, ) -sources = files( +core_sources = files( 'nm-inotify-helper.c', 'nms-ifcfg-rh-reader.c', 'nms-ifcfg-rh-utils.c', @@ -32,11 +32,11 @@ deps = [ libnms_ifcfg_rh_core = static_library( 'nms-ifcfg-rh-core', - sources: sources, + sources: core_sources, dependencies: deps, ) -sources = [dbus_sources] + files('nms-ifcfg-rh-connection.c') +sources = [dbus_sources] + core_sources + files('nms-ifcfg-rh-connection.c', 'nms-ifcfg-rh-plugin.c') libnm_settings_plugin_ifcfg_rh = shared_module( 'nm-settings-plugin-ifcfg-rh', From fb0d36a883501dc616cde63ddbc8b9aa757d86d5 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 10 Sep 2018 16:26:57 +0200 Subject: [PATCH 10/18] build: add config-extra.h.meson to EXTRA_DIST Reported-by: Michael Biebl https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/22 (cherry picked from commit 5ebe5efa7adeb42ee4fbf6eb7e5409f12d244f2b) --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 3490aed28e..f525a6d6e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4746,6 +4746,7 @@ EXTRA_DIST += \ meson_options.txt \ meson_post_install.py \ config.h.meson \ + config-extra.h.meson \ docs/meson.build \ \ po/meson.build \ From 10ca2444b953e5bc9f657cda96c67389e0e21568 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 13:48:40 +0200 Subject: [PATCH 11/18] build: support meson builds in create-exports script (cherry picked from commit 9b4bc0824c1d8925f1ecfa4856757d322f030427) --- Makefile.am | 2 +- tools/create-exports-NetworkManager.sh | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index f525a6d6e3..5b0feefa40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1850,7 +1850,7 @@ $(src_libNetworkManagerTest_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums) ############################################################################### src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)" + $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-build "$(srcdir)" CLEANFILES += src/NetworkManager.ver diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh index 3c2494e1dc..7d359005b7 100755 --- a/tools/create-exports-NetworkManager.sh +++ b/tools/create-exports-NetworkManager.sh @@ -35,7 +35,7 @@ call_nm() { } get_symbols_nm () { - call_nm ./src/.libs/libNetworkManager.a | + call_nm ./src/${libs}libNetworkManager.a | sed -n 's/^[tTDGRBS] //p' | _sort } @@ -47,9 +47,9 @@ EOF } get_symbols_missing() { - (for f in $(find ./src/settings/plugins/*/.libs/ \ - ./src/devices/*/.libs/ \ - ./src/ppp/.libs/ -name '*.so'); do + (for f in $(find ./src/settings/plugins/*/${libs} \ + ./src/devices/*/${libs} \ + ./src/ppp/${libs} -name '*.so'); do call_nm "$f" | sed -n 's/^\([U]\) \(\(nm_\|nmp_\|_nm\|NM\|_NM\|c_siphash_\).*\)$/\2/p' done) | @@ -90,16 +90,25 @@ local: EOF } -test -f ./src/.libs/libNetworkManager.a || die "must be called from NetworkManager \$(top_builddir) after building the tree" +if [ -f "build.ninja" ]; then + from_meson=1 + libs= +else + libs=.libs/ +fi + +test -f ./src/${libs}libNetworkManager.a || die "must be called from NetworkManager top build dir after building the tree" case "$1" in rebuild) + [ -n "$from_meson" ] && die "can't do a build when called from meson" do_rebuild ;; build) + [ -n "$from_meson" ] && die "can't do a build when called from meson" do_build ;; - '--called-from-make') + --called-from-build) if test -z "${NM_BUILD_NO_CREATE_EXPORTS+x}"; then do_update else From ec123d3bf49c711c93de7b8e3b61c18fe5eb342f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 14:12:10 +0200 Subject: [PATCH 12/18] build: meson: generate and use a linker script for NM binary Generate the NetworkManager.ver link script to link the NM binary so that unneeded symbol are unexported and can be dropped, reducing the binary size. Reported-by: Michael Biebl https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/33 (cherry picked from commit dfa2a2b40c866bf7a5484b72639464c31b80e7da) --- src/meson.build | 80 ++++++++++++++++++++----------------------------- 1 file changed, 33 insertions(+), 47 deletions(-) diff --git a/src/meson.build b/src/meson.build index 83fc3eacaf..f46366a904 100644 --- a/src/meson.build +++ b/src/meson.build @@ -143,7 +143,7 @@ sources = files( 'nm-sleep-monitor.c' ) -deps = [ +nm_deps = [ dl_dep, libndp_dep, libudev_dep, @@ -153,70 +153,29 @@ deps = [ ] if enable_concheck - deps += libcurl_dep + nm_deps += libcurl_dep endif if enable_libaudit - deps += libaudit_dep + nm_deps += libaudit_dep endif if enable_libpsl - deps += libpsl_dep + nm_deps += libpsl_dep endif if enable_selinux - deps += selinux_dep + nm_deps += selinux_dep endif libnetwork_manager = static_library( nm_name, sources: sources, - dependencies: deps, + dependencies: nm_deps, c_args: cflags, link_with: [libnetwork_manager_base, libsystemd_nm] ) -ldflags = ['-rdynamic'] - -# FIXME: this doesn't work and it depends on libtool -''' -src/NetworkManager.ver: src/libNetworkManager.la $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-make "$(srcdir)" - -src_NetworkManager_LDFLAGS = \ - -rdynamic \ - -Wl,--version-script="src/NetworkManager.ver" - -nm = find_program('gcc-nm', 'nm') -create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') - -symbol_map_name = 'NetworkManager.ver' - -linker_script = custom_target( - symbol_map_name, - input: meson.source_root(), - output: symbol_map_name, - capture: true, - #command: ['NM=' + nm.path(), create_exports_networkmanager, '--called-from-make', '@INPUT@'] - command: [create_exports_networkmanager, '--called-from-make', '@INPUT@'] -) - -ldflags += '-Wl,--version-script,@0@'.format(linker_script) -''' - -network_manager = executable( - nm_name, - 'main.c', - dependencies: deps, - c_args: cflags, - link_with: libnetwork_manager, - link_args: ldflags, - #FIXME - #link_depends: linker_script, - install: true, - install_dir: nm_sbindir -) - deps = [ dl_dep, libndp_dep, @@ -287,3 +246,30 @@ endif subdir('devices') subdir('settings/plugins') + +# NetworkManager binary + +create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') +symbol_map_name = 'NetworkManager.ver' + +ver_script = custom_target( + symbol_map_name, + input: meson.source_root(), + output: symbol_map_name, + depends: [ libnetwork_manager, core_plugins ], + command: [create_exports_networkmanager, '--called-from-build', '@INPUT@'] +) + +ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())] + +network_manager = executable( + nm_name, + 'main.c', + dependencies: nm_deps, + c_args: nm_cflags, + link_with: libnetwork_manager, + link_args: ldflags, + link_depends: ver_script, + install: true, + install_dir: nm_sbindir +) From bb12dfa442279f66511f902c373277cca760b655 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 14:42:21 +0200 Subject: [PATCH 13/18] build: meson: add missing libnm-core header file Reported-by: Michael Biebl Fixes: df30651b8906cfe6a5cb7aef01a220d1f21b80f3 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/31 (cherry picked from commit e2522c8c2d776a72fec5f5961c7224cd0dc82a52) --- libnm-core/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/libnm-core/meson.build b/libnm-core/meson.build index eb6fcce94b..ac13a1be0d 100644 --- a/libnm-core/meson.build +++ b/libnm-core/meson.build @@ -16,6 +16,7 @@ libnm_core_headers = files( 'nm-setting-connection.h', 'nm-setting-dcb.h', 'nm-setting-dummy.h', + 'nm-setting-ethtool.h', 'nm-setting-generic.h', 'nm-setting-gsm.h', 'nm-setting-infiniband.h', From 7ba7c1038d1b3be2c1db343f557c9ab8784fd8c6 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 14:58:56 +0200 Subject: [PATCH 14/18] build: meson: fix NMSTATEDIR path Reported-by: Michael Biebl (cherry picked from commit 8c77ca1a6dc87c70c7c61e442accf7fdd2f5d063) --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3975706e47..289ddd749d 100644 --- a/meson.build +++ b/meson.build @@ -50,7 +50,7 @@ nm_pkgdatadir = join_paths(nm_datadir, nm_name) nm_pkgincludedir = join_paths(nm_includedir, nm_name) nm_pkglibdir = join_paths(nm_prefix, 'lib', nm_name) nm_pkgrundir = join_paths(nm_runstatedir, nm_name) -nm_pkgstatedir = join_paths(nm_localstatedir, nm_name) +nm_pkgstatedir = join_paths(nm_localstatedir, 'lib', nm_name) nm_vpndir = join_paths(nm_libdir, nm_name) nm_plugindir = join_paths(nm_libdir, nm_name, dist_version) From e86b552e0c6408aafbe4ab362433b737230c7d47 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 11 Sep 2018 15:05:03 +0200 Subject: [PATCH 15/18] build: print both pppd path and plugins path in configure summary Reported-by: Michael Biebl https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/25 (cherry picked from commit ff837b2686cf8f88bbdb95b2ddd8efd7fc9f809e) --- configure.ac | 2 +- meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6daf5bfd7a..3abc2716fa 100644 --- a/configure.ac +++ b/configure.ac @@ -1299,7 +1299,7 @@ echo echo "Features:" echo " wext: $ac_with_wext" echo " wifi: $enable_wifi" -echo " ppp: $enable_ppp ${PPPD_PLUGIN_DIR}" +echo " ppp: $enable_ppp ${PPPD_PATH} plugins:${PPPD_PLUGIN_DIR}" echo " modemmanager-1: $with_modem_manager_1" echo " ofono: $with_ofono" echo " concheck: $enable_concheck" diff --git a/meson.build b/meson.build index 289ddd749d..0bd9f20519 100644 --- a/meson.build +++ b/meson.build @@ -938,7 +938,7 @@ output += ' wifi: ' + enable_wifi.to_string() + '\n' output += ' iwd: ' + enable_iwd.to_string() + '\n' output += ' pppd: ' + enable_ppp.to_string() if enable_ppp - output += ' ' + pppd_path + output += ' ' + pppd_path + ' plugins:' + pppd_plugin_dir endif output += '\n' output += ' modemmanager-1: ' + enable_modem_manager.to_string() + '\n' From 7e1443746b560b75ef68e600a0a5e2b389d1905b Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Wed, 12 Sep 2018 15:53:13 +0200 Subject: [PATCH 16/18] build: rename DNSSEC_TRIGGER_SCRIPT to DNSSEC_TRIGGER_PATH Rename the define for consistency, since the configure option is named 'dnssec-trigger'. (cherry picked from commit 8e776955ee53b80536f017d2c5bbfc7c9a7b0f10) --- config.h.meson | 2 +- configure.ac | 8 ++++---- meson.build | 6 +++--- src/dns/nm-dns-unbound.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.h.meson b/config.h.meson index 07129b2e00..e79f9dcb54 100644 --- a/config.h.meson +++ b/config.h.meson @@ -14,7 +14,7 @@ #mesondefine DNSMASQ_PATH /* Define to path of unbound dnssec-trigger-script */ -#mesondefine DNSSEC_TRIGGER_SCRIPT +#mesondefine DNSSEC_TRIGGER_PATH /* Gettext package */ #mesondefine GETTEXT_PACKAGE diff --git a/configure.ac b/configure.ac index 3abc2716fa..5887cd5997 100644 --- a/configure.ac +++ b/configure.ac @@ -941,13 +941,13 @@ AC_SUBST(DNSMASQ_PATH) AC_ARG_WITH(dnssec_trigger, AS_HELP_STRING([--with-dnssec-trigger=/path/to/dnssec-trigger-script], [path to unbound dnssec-trigger-script])) if test "x${with_dnssec_trigger}" = x; then - AC_PATH_PROG(DNSSEC_TRIGGER_SCRIPT, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script, + AC_PATH_PROG(DNSSEC_TRIGGER_PATH, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script, /usr/local/libexec:/usr/local/lib:/usr/local/lib/dnssec-trigger:/usr/libexec:/usr/lib:/usr/lib/dnssec-trigger) else - DNSSEC_TRIGGER_SCRIPT="$with_dnssec_trigger" + DNSSEC_TRIGGER_PATH="$with_dnssec_trigger" fi -AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_SCRIPT, "$DNSSEC_TRIGGER_SCRIPT", [Define to path of unbound dnssec-trigger-script]) -AC_SUBST(DNSSEC_TRIGGER_SCRIPT) +AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_PATH, "$DNSSEC_TRIGGER_PATH", [Define to path of unbound dnssec-trigger-script]) +AC_SUBST(DNSSEC_TRIGGER_PATH) # system CA certificates path AC_ARG_WITH(system-ca-path, diff --git a/meson.build b/meson.build index 0bd9f20519..50d6795a85 100644 --- a/meson.build +++ b/meson.build @@ -624,10 +624,10 @@ dnssec_ts_paths = ['/usr/local/libexec', '/usr/lib', '/usr/lib/dnssec-trigger'] -# 0: cmdline option, 1: paths, 2: fallback, 3: config.h option +# 0: cmdline option, 1: paths, 2: fallback progs = [['iptables', default_paths, '/sbin/iptables'], ['dnsmasq', default_paths, ''], - ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script'), 'DNSSEC_TRIGGER_SCRIPT'], + ['dnssec_trigger', dnssec_ts_paths, join_paths(nm_libexecdir, 'dnssec-trigger-script') ], ] foreach prog : progs @@ -640,7 +640,7 @@ foreach prog : progs exe = find_program(search_paths, required : false) path = exe.found() ? exe.path() : prog[2] endif - name = prog.length() > 3 ? prog[3] : (prog[0].to_upper() + '_PATH') + name = prog[0].to_upper() + '_PATH' config_h.set_quoted(name, path) endforeach diff --git a/src/dns/nm-dns-unbound.c b/src/dns/nm-dns-unbound.c index e06128aa91..b900f29e22 100644 --- a/src/dns/nm-dns-unbound.c +++ b/src/dns/nm-dns-unbound.c @@ -43,7 +43,7 @@ update (NMDnsPlugin *plugin, const CList *ip_config_lst_head, const char *hostname) { - char *argv[] = { DNSSEC_TRIGGER_SCRIPT, "--async", "--update", NULL }; + char *argv[] = { DNSSEC_TRIGGER_PATH, "--async", "--update", NULL }; int status; /* TODO: We currently call a script installed with the dnssec-trigger From 4fc3bdb45c69e84803e7ad6d9cadafc1c908adcf Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Sep 2018 15:33:46 +0200 Subject: [PATCH 17/18] travis: enabling building more optional components during CI with meson After fixing meson build for these components, enable them for build in travis. (cherry picked from commit 0dda7586e4ec3a35031ad2578821d056d99103f1) --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0458b63c53..1bf7e8d515 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,8 +104,9 @@ script: -D ofono=true \ -D teamdctl=false \ \ - -D dhcpcanon=/bin/true \ - -D dhclient=/bin/true \ + -D dhclient=/bin/nowhere/dhclient \ + -D dhcpcanon=/bin/nowhere/dhcpcanon \ + -D dhcpcd=/bin/nowhere/dhcpd \ \ -D netconfig=true \ -D resolvconf=true \ From 51d7ae2ba7fd1f812a2911200b6546d0ed1d5bfd Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 12 Sep 2018 21:01:24 +0200 Subject: [PATCH 18/18] build/autotools: fail configure if netconfig/resolveconf tool is not found If the user explicitly passes --with-netconfig=$PATH or --with-resolvconf=$PATH, the path is accepted as is. We only do autodetection, if the binary was not found. In that case, if the binary cannot be found in the common paths fail compilation. (cherry picked from commit 5b36585a3ddd9bc54419e71aef0c244c8015d6d6) --- .travis.yml | 8 ++++---- configure.ac | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bf7e8d515..de6ff770a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,8 +108,8 @@ script: -D dhcpcanon=/bin/nowhere/dhcpcanon \ -D dhcpcd=/bin/nowhere/dhcpd \ \ - -D netconfig=true \ - -D resolvconf=true \ + -D netconfig=/bin/nowhere/netconfig \ + -D resolvconf=/bin/nowhere/resolvconf \ \ -D ifcfg_rh=false \ -D ibft=true \ @@ -146,8 +146,8 @@ script: --with-dhcpcd=yes \ --with-dhclient=yes \ \ - --with-netconfig=no \ - --with-resolvconf=yes \ + --with-netconfig=/bin/nowhere/netconfig \ + --with-resolvconf=/bin/nowhere/resolvconf \ \ --enable-ifcfg-rh=yes \ --enable-config-plugin-ibft=yes \ diff --git a/configure.ac b/configure.ac index 5887cd5997..b32ce412cc 100644 --- a/configure.ac +++ b/configure.ac @@ -871,13 +871,12 @@ test -z "$config_dhcp_default" && config_dhcp_defaul AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting]) AC_SUBST(NM_CONFIG_DEFAULT_MAIN_DHCP, $config_dhcp_default) -# resolvconf and netconfig support AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support])) AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support])) AC_ARG_WITH(config-dns-rc-manager-default, AS_HELP_STRING([--with-config-dns-rc-manager-default=symlink|file|netconfig|resolvconf], [Configure default value for main.rc-manager setting]), [config_dns_rc_manager_default=$withval]) -if test "$config_dns_rc_manager_default" != symlink -a \ +if test "$config_dns_rc_manager_default" != "" -a \ "$config_dns_rc_manager_default" != file -a \ - "$config_dns_rc_manager_default" != "" -a \ + "$config_dns_rc_manager_default" != symlink -a \ "$config_dns_rc_manager_default" != netconfig -a \ "$config_dns_rc_manager_default" != resolvconf; then AC_MSG_WARN([Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting.]) @@ -888,21 +887,29 @@ AS_IF([test -z "$with_netconfig" -a -f /etc/SuSE-release], with_netconfig=yes) # Otherwise default to "no" AS_IF([test -z "$with_resolvconf"], with_resolvconf=no) AS_IF([test -z "$with_netconfig"], with_netconfig=no) -# Find resolvconf and netconfig + if test "$with_resolvconf" = "yes"; then - AC_PATH_PROGS(with_resolvconf, resolvconf, no, /sbin:/usr/sbin:/usr/local/sbin) + AC_PATH_PROGS(with_resolvconf, resolvconf, 'yes', /sbin:/usr/sbin:/usr/local/sbin) + if test "$with_resolvconf" = "yes"; then + AC_MSG_ERROR(cannot find resolvconf in path. Set the path explicitly via --with-resolvconf=PATH.) + fi fi if test "$with_resolvconf" != "no"; then AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=resolvconf) fi + if test "$with_netconfig" = "yes"; then - AC_PATH_PROGS(with_netconfig, netconfig, no, /sbin:/usr/sbin:/usr/local/sbin) + AC_PATH_PROGS(with_netconfig, netconfig, yes, /sbin:/usr/sbin:/usr/local/sbin) + if test "$with_netconfig" = "yes"; then + AC_MSG_ERROR(cannot find netconfig in path. Set the path explicitly via --with-netconfig=PATH.) + fi fi if test "$with_netconfig" != "no"; then AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=netconfig) fi + AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=symlink) -# Define resolvconf and netconfig paths + if test "$with_resolvconf" != "no"; then AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf]) fi