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 220dea0948
)
This commit is contained in:
37
meson.build
37
meson.build
@@ -652,19 +652,34 @@ endif
|
|||||||
|
|
||||||
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
|
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
|
||||||
|
|
||||||
# iptables path
|
# external misc tools paths
|
||||||
config_h.set_quoted('IPTABLES_PATH', find_program(get_option('iptables')).path())
|
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
|
# 0: cmdline option, 1: paths, 2: fallback, 3: config.h option
|
||||||
config_h.set_quoted('DNSMASQ_PATH', find_program(get_option('dnsmasq')).path())
|
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
|
foreach prog : progs
|
||||||
dnssec_trigger_script = find_program(get_option('dnssec_trigger'), required: false)
|
path = get_option(prog[0])
|
||||||
if dnssec_trigger_script.found()
|
if path == ''
|
||||||
config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', dnssec_trigger_script.path())
|
search_paths = [ prog[0] ]
|
||||||
else
|
foreach path : prog[1]
|
||||||
config_h.set_quoted('DNSSEC_TRIGGER_SCRIPT', join_paths(nm_libexecdir, 'dnssec-trigger-script'))
|
search_paths += (path + '/' + prog[0])
|
||||||
endif
|
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 certificates path
|
||||||
system_ca_path = get_option('system_ca_path')
|
system_ca_path = get_option('system_ca_path')
|
||||||
|
@@ -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('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('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('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('iptables', type: 'string', value: '', description: 'path to iptables')
|
||||||
option('dnsmasq', type: 'array', value: ['dnsmasq', '/sbin/dnsmasq', '/usr/sbin/dnsmasq'], description: 'path to dnsmasq')
|
option('dnsmasq', type: 'string', value: '', 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('dnssec_trigger', type: 'string', value: '', description: 'path to unbound dnssec-trigger-script')
|
||||||
|
|
||||||
# platform
|
# platform
|
||||||
option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string')
|
option('dist_version', type: 'string', value: '', description: 'Define the NM\'s distribution version string')
|
||||||
|
Reference in New Issue
Block a user