diff options
author | Thomas Haller <thaller@redhat.com> | 2022-07-22 13:04:52 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-07-25 10:32:10 +0200 |
commit | b38d180bc6e1a244573b7f256d85e4f1ca9b880a (patch) | |
tree | 396649ae442d763c9833d05343330b54be0d8642 | |
parent | 077d6503adc3dd6e949a25ae507e623b4220cca6 (diff) | |
download | NetworkManager-b38d180bc6e1a244573b7f256d85e4f1ca9b880a.tar.gz |
build/meson: fix autodetecting ifcfg_rh/ifupdown plugins
"-Difcfg_rh=false" did not work, we would always fallback to
autodetection. That is wrong, an explicit "false" should be honored.
It's also not what autotools does. Fix this.
While at it, drop "distro" variable. It's not a clear concept
that can be reused and it's unused otherwise.
Also, no longer let the autodetection be based on cross compilation.
When cross-compiling, it seems not entirely unreasonable that you cross
compile to a comparable distro, so let the autodetection be based on
what we detect on the host. In any case, a user can and is encouraged
to explicitly enable/disable the plugins via "-Difcfg_rh=" or
"-Difupdown=".
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1310
-rw-r--r-- | meson.build | 23 | ||||
-rw-r--r-- | meson_options.txt | 6 |
2 files changed, 13 insertions, 16 deletions
diff --git a/meson.build b/meson.build index 5a93a623ef..64f44b4bd1 100644 --- a/meson.build +++ b/meson.build @@ -287,22 +287,19 @@ glib_dep = declare_dependency( ] ) -if meson.is_cross_build() - distro = 'unknown' -elif run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0 - distro = 'redhat' -elif run_command('test', '-e', '/etc/SuSE-release').returncode() == 0 - distro = 'suse' -elif run_command('test', '-e', '/etc/debian_version').returncode() == 0 - distro = 'debian' -elif run_command('test', '-e', '/etc/gentoo-release').returncode() == 0 - distro = 'gentoo' +enable_ifcfg_rh = get_option('ifcfg_rh') +if enable_ifcfg_rh == 'auto' + enable_ifcfg_rh = (run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0) else - distro = 'unknown' + enable_ifcfg_rh = (enable_ifcfg_rh != 'false') endif -enable_ifcfg_rh = get_option('ifcfg_rh') or (distro == 'redhat') -enable_ifupdown = get_option('ifupdown') or (distro == 'debian') +enable_ifupdown = get_option('ifupdown') +if enable_ifupdown == 'auto' + enable_ifupdown = (run_command('test', '-e', '/etc/debian_version').returncode() == 0) +else + enable_ifupdown = (enable_ifupdown != 'false') +endif config_plugins_default = get_option('config_plugins_default') config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_PLUGINS', config_plugins_default) diff --git a/meson_options.txt b/meson_options.txt index cec0664186..8b1d32e645 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -40,12 +40,12 @@ option('nmcli', type: 'boolean', value: true, description: 'Build nmcli') option('nmtui', type: 'boolean', value: true, description: 'Build nmtui') option('nm_cloud_setup', type: 'boolean', value: false, description: 'Build nm-cloud-setup, a tool for automatically configure networking in cloud (EXPERIMENTAL!)') option('bluez5_dun', type: 'boolean', value: false, description: 'enable Bluez5 DUN support') -option('ebpf', type: 'combo', choices : ['auto', 'true', 'false'], description: 'Enable eBPF support') +option('ebpf', type: 'combo', choices: ['auto', 'true', 'false'], description: 'Enable eBPF support') # configuration plugins option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset') -option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)') -option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') +option('ifcfg_rh', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)') +option('ifupdown', type: 'combo', choices:['auto', 'true', 'false'], value: 'auto', description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') # handlers for resolv.conf option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support') |