meson: Avoid the use of source_root and build_root methods

The way some directory paths are defined has also been changed to
avoid the use of the `source_root` and `build_root` functions
because they are discouraged[0]

[0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
This commit is contained in:
Iñigo Martínez 2019-08-28 11:54:11 +02:00 committed by Thomas Haller
parent 48bb5b68e3
commit 82e79e40a5
6 changed files with 22 additions and 19 deletions

View file

@ -39,8 +39,8 @@ if enable_introspection
test(
'check-settings-docs',
find_program(join_paths(meson.source_root(), 'tools', 'check-settings-docs.sh')),
args: [meson.source_root(), meson.build_root(), 'clients/common/' + settings_docs]
find_program(join_paths(source_root, 'tools', 'check-settings-docs.sh')),
args: [source_root, build_root, 'clients/common/' + settings_docs],
)
else
settings_docs_source = configure_file(

View file

@ -6,6 +6,6 @@ subdir('api')
test(
'check-docs',
find_program(join_paths(meson.source_root(), 'tools', 'check-docs.sh')),
args: [meson.source_root(), meson.build_root()],
find_program(join_paths(source_root, 'tools', 'check-docs.sh')),
args: [source_root, build_root],
)

View file

@ -76,7 +76,7 @@ foreach iface: ifaces
if gio_unix_dep.version().version_compare('>= 2.51.3')
dbus_iface_xml_path = join_paths(meson.current_build_dir(), 'dbus-' + iface_xml)
else
dbus_iface_xml_path = join_paths(meson.build_root(), 'dbus-' + iface_xml)
dbus_iface_xml_path = join_paths(build_root, 'dbus-' + iface_xml)
endif
content_files += dbus_iface_xml_path

View file

@ -293,7 +293,7 @@ shared_nm_libnm_core_aux_dep = declare_dependency(
###############################################################################
enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl')
enums_to_docbook = join_paths(source_root, 'tools', 'enums-to-docbook.pl')
docbooks = [
['nm-dbus-types', 'nm-dbus-interface.h', 'NetworkManager D-Bus API Types'],

View file

@ -69,6 +69,9 @@ gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')
source_root = meson.current_source_dir()
build_root = meson.current_build_dir()
po_dir = join_paths(meson.source_root(), 'po')
intltool_merge = find_program('intltool-merge')
@ -81,7 +84,7 @@ top_inc = include_directories('.')
perl = find_program('perl')
xsltproc = find_program('xsltproc')
check_exports = find_program(join_paths(meson.source_root(), 'tools', 'check-exports.sh'))
check_exports = find_program(join_paths(source_root, 'tools', 'check-exports.sh'))
cc = meson.get_compiler('c')
@ -190,9 +193,9 @@ endif
add_project_arguments(common_flags, language: 'c')
add_project_link_arguments(common_ldflags, language: 'c')
linker_script_binary = join_paths(meson.source_root(), 'linker-script-binary.ver')
linker_script_devices = join_paths(meson.source_root(), 'linker-script-devices.ver')
linker_script_settings = join_paths(meson.source_root(), 'linker-script-settings.ver')
linker_script_binary = join_paths(source_root, 'linker-script-binary.ver')
linker_script_devices = join_paths(source_root, 'linker-script-devices.ver')
linker_script_settings = join_paths(source_root, 'linker-script-settings.ver')
ldflags_linker_script_binary = [ '-Wl,--version-script,@0@'.format(linker_script_binary) ]
ldflags_linker_script_devices = [ '-Wl,--version-script,@0@'.format(linker_script_devices) ]
@ -736,7 +739,7 @@ endif
tests = get_option('tests')
enable_tests = (tests != 'no')
require_root_tests = (tests == 'root')
test_script = find_program(join_paths(meson.source_root(), 'tools', 'run-nm-test.sh'))
test_script = find_program(join_paths(source_root, 'tools', 'run-nm-test.sh'))
# valgrind
locations = get_option('valgrind')
@ -749,13 +752,13 @@ endif
if enable_valgrind
valgrind_suppressions_path = get_option('valgrind_suppressions')
if valgrind_suppressions_path == ''
valgrind_suppressions_path = join_paths(meson.source_root(), 'valgrind.suppressions')
valgrind_suppressions_path = join_paths(source_root, 'valgrind.suppressions')
endif
endif
test_args = [
'--called-from-make',
meson.build_root(),
build_root,
'',
enable_valgrind ? valgrind.path() : '',
enable_valgrind ? valgrind_suppressions_path : '',
@ -866,8 +869,8 @@ config_extra_h.set_quoted('NMPLUGINDIR', nm_plugindir)
config_extra_h.set_quoted('NMRUNDIR', nm_pkgrundir)
config_extra_h.set_quoted('NMSTATEDIR', nm_pkgstatedir)
config_extra_h.set_quoted('NMVPNDIR', nm_vpndir)
config_extra_h.set_quoted('NM_BUILD_BUILDDIR', meson.build_root())
config_extra_h.set_quoted('NM_BUILD_SRCDIR', meson.source_root())
config_extra_h.set_quoted('NM_BUILD_BUILDDIR', build_root)
config_extra_h.set_quoted('NM_BUILD_SRCDIR', source_root)
if enable_ppp
config_extra_h.set_quoted('PPPD_PLUGIN_DIR', pppd_plugin_dir)
endif

View file

@ -272,7 +272,7 @@ subdir('settings/plugins')
# NetworkManager binary
create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh')
create_exports_networkmanager = join_paths(source_root, 'tools', 'create-exports-NetworkManager.sh')
symbol_map_name = 'NetworkManager.ver'
# libNetworkManager.a, as built by meson doesn't contain all symbols
@ -295,7 +295,7 @@ ver_script = custom_target(
symbol_map_name,
output: symbol_map_name,
depends: [ network_manager_sym, core_plugins ],
command: [create_exports_networkmanager, '--called-from-build', meson.source_root()],
command: [create_exports_networkmanager, '--called-from-build', source_root],
)
ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())]
@ -323,6 +323,6 @@ endif
test(
'check-config-options',
find_program(join_paths(meson.source_root(), 'tools', 'check-config-options.sh')),
args: [meson.source_root()]
find_program(join_paths(source_root, 'tools', 'check-config-options.sh')),
args: source_root,
)