From 5f47a2d44d8e800f6d61244ea9f4b91ef397fbf7 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 4 Feb 2021 14:16:29 +0100 Subject: [PATCH] build/meson: cleanup clients/***/meson.build --- clients/cli/meson.build | 16 ++++- clients/cloud-setup/meson.build | 30 ++++----- clients/common/meson.build | 84 +++++++++++++---------- clients/common/tests/meson.build | 50 +++++++------- clients/meson.build | 13 ++-- clients/tui/meson.build | 111 +++++++++++++++---------------- clients/tui/newt/meson.build | 61 +++++++++-------- 7 files changed, 189 insertions(+), 176 deletions(-) diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 5d07c7fe9e..f154e52082 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -27,7 +27,10 @@ executable( readline_dep, libnm_libnm_aux_dep, ], - c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format('nmcli')], + c_args: [ + '-DG_LOG_DOMAIN="nmcli"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, @@ -45,7 +48,10 @@ generate_docs_nm_settings_nmcli = executable( libnmc_dep, libnm_libnm_aux_dep, ], - c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format('nmcli')], + c_args: [ + '-DG_LOG_DOMAIN="nmcli"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, ) @@ -61,7 +67,11 @@ if enable_docs test( 'check-local-generate-docs-nm-settings-nmcli', find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')), - args: [source_root, build_root, 'clients/cli/generate-docs-nm-settings-nmcli.xml'], + args: [ + source_root, + build_root, + 'clients/cli/generate-docs-nm-settings-nmcli.xml', + ], ) else settings_docs_source = configure_file( diff --git a/clients/cloud-setup/meson.build b/clients/cloud-setup/meson.build index 70a9d57c34..681c53ea04 100644 --- a/clients/cloud-setup/meson.build +++ b/clients/cloud-setup/meson.build @@ -1,7 +1,5 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -name = 'nm-cloud-setup' - if install_systemdunitdir nm_cloud_setup_service = configure_file( @@ -23,27 +21,27 @@ if install_systemdunitdir endif -sources = files( - 'main.c', - 'nm-cloud-setup-utils.c', - 'nm-http-client.c', - 'nmcs-provider-ec2.c', - 'nmcs-provider-gcp.c', - 'nmcs-provider-azure.c', - 'nmcs-provider.c', -) - executable( - name, - sources, + 'nm-cloud-setup', + files( + 'main.c', + 'nm-cloud-setup-utils.c', + 'nm-http-client.c', + 'nmcs-provider-ec2.c', + 'nmcs-provider-gcp.c', + 'nmcs-provider-azure.c', + 'nmcs-provider.c', + ), dependencies: [ libnmc_base_dep, libnmc_dep, libcurl_dep, libnm_libnm_aux_dep, ], - c_args: clients_c_flags + - ['-DG_LOG_DOMAIN="@0@"'.format(name)], + c_args: [ + '-DG_LOG_DOMAIN="nm-cloud-setup"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_with: libnm_systemd_logging_stub, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/clients/common/meson.build b/clients/common/meson.build index 93c158f1b2..a95a8a0f4c 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -2,72 +2,88 @@ common_inc = include_directories('.') -common_deps = [ - libnm_dep, - libnm_nm_default_dep, -] - -common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="libnmc"'] - -sources = files( - 'nm-client-utils.c', - 'nm-secret-agent-simple.c', - 'nm-vpn-helpers.c', - 'nm-polkit-listener.c', -) - libnmc_base = static_library( 'nmc-base', - sources: sources, - dependencies: common_deps, - c_args: common_c_flags, + sources: files( + 'nm-client-utils.c', + 'nm-secret-agent-simple.c', + 'nm-vpn-helpers.c', + 'nm-polkit-listener.c', + ), + dependencies: [ + libnm_dep, + libnm_nm_default_dep, + ], + c_args: [ + '-DG_LOG_DOMAIN="libnmc"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], ) libnmc_base_dep = declare_dependency( include_directories: common_inc, - dependencies: common_deps, + dependencies: [ + libnm_dep, + libnm_nm_default_dep, + ], link_with: libnmc_base, ) -settings_docs = 'settings-docs.h' - if enable_docs settings_docs_source = custom_target( - settings_docs, + 'settings-docs.h', input: nm_settings_docs_xml_gir, - output: settings_docs, - command: [xsltproc, '--output', '@OUTPUT@', join_paths(meson.current_source_dir(), 'settings-docs.xsl'), '@INPUT@'], + output: 'settings-docs.h', + command: [ + xsltproc, + '--output', + '@OUTPUT@', + join_paths(meson.current_source_dir(), 'settings-docs.xsl'), + '@INPUT@', + ], ) test( 'check-settings-docs', find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')), - args: [source_root, build_root, 'clients/common/' + settings_docs], + args: [ + source_root, + build_root, + 'clients/common/settings-docs.h', + ], ) else settings_docs_source = configure_file( - input: settings_docs + '.in', + input: 'settings-docs.h.in', output: '@BASENAME@', configuration: configuration_data(), ) endif -sources = nm_meta_setting_source + [settings_docs_source] + files( - 'nm-meta-setting-access.c', - 'nm-meta-setting-desc.c', -) - libnmc = static_library( 'nmc', - sources: sources, - dependencies: common_deps + [libnm_libnm_core_aux_dep], - c_args: common_c_flags, + sources: nm_meta_setting_source + [settings_docs_source] + files( + 'nm-meta-setting-access.c', + 'nm-meta-setting-desc.c', + ), + dependencies: [ + libnm_dep, + libnm_nm_default_dep, + libnm_libnm_core_aux_dep, + ], + c_args: [ + '-DG_LOG_DOMAIN="libnmc"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_depends: settings_docs_source, ) libnmc_dep = declare_dependency( include_directories: common_inc, - dependencies: common_deps, + dependencies: [ + libnm_dep, + libnm_nm_default_dep, + ], link_with: libnmc, ) diff --git a/clients/common/tests/meson.build b/clients/common/tests/meson.build index 097f69f4e6..401759d885 100644 --- a/clients/common/tests/meson.build +++ b/clients/common/tests/meson.build @@ -1,45 +1,41 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -common_c_flags = clients_c_flags + ['-DNETWORKMANAGER_COMPILATION_TEST'] - -test_name = 'test-clients-common' - -deps = [ - libnmc_base_dep, - libnmc_dep, -] - exe = executable( - test_name, - test_name + '.c', - dependencies: deps, - c_args: common_c_flags, + 'test-clients-common', + 'test-clients-common.c', + dependencies: [ + libnmc_base_dep, + libnmc_dep, + ], + c_args: [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], ) test( - 'clients/common/tests/' + test_name, + 'clients/common/tests/test-clients-common', test_script, args: test_args + [exe.full_path()], ) -test_name = 'test-libnm-core-aux' - -deps = [ - libnm_dep, - libnm_libnm_core_aux_dep, - libnm_nm_default_dep, -] - exe = executable( - test_name, - test_name + '.c', - dependencies: deps, - c_args: common_c_flags, + 'test-libnm-core-aux', + 'test-libnm-core-aux.c', + dependencies: [ + libnm_dep, + libnm_libnm_core_aux_dep, + libnm_nm_default_dep, + ], + c_args: [ + '-DNETWORKMANAGER_COMPILATION_TEST', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_with: libnm_systemd_logging_stub, ) test( - 'clients/common/tests/' + test_name, + 'clients/common/tests/test-libnm-core-aux', test_script, args: test_args + [exe.full_path()] ) diff --git a/clients/meson.build b/clients/meson.build index 257b9a07ff..3123f84a6d 100644 --- a/clients/meson.build +++ b/clients/meson.build @@ -1,18 +1,17 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -clients_c_flags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT'] - -name = 'nm-online' - executable( - name, - name + '.c', + 'nm-online', + 'nm-online' + '.c', dependencies: [ libnm_dep, libnm_nm_default_dep, libnm_libnm_aux_dep, ], - c_args: clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)], + c_args: [ + '-DG_LOG_DOMAIN="nm-online"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, install: true, diff --git a/clients/tui/meson.build b/clients/tui/meson.build index 468f552dd6..240e73e763 100644 --- a/clients/tui/meson.build +++ b/clients/tui/meson.build @@ -1,66 +1,61 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -name = 'nmtui' - -common_c_flags = clients_c_flags + ['-DG_LOG_DOMAIN="@0@"'.format(name)] - subdir('newt') -sources = files( - 'nm-editor-bindings.c', - 'nm-editor-utils.c', - 'nmt-address-list.c', - 'nmt-connect-connection-list.c', - 'nmt-device-entry.c', - 'nmt-edit-connection-list.c', - 'nmt-editor.c', - 'nmt-editor-grid.c', - 'nmt-editor-page.c', - 'nmt-editor-page-device.c', - 'nmt-editor-section.c', - 'nmt-ip-entry.c', - 'nmt-mac-entry.c', - 'nmt-mtu-entry.c', - 'nmt-page-bond.c', - 'nmt-page-bridge.c', - 'nmt-page-bridge-port.c', - 'nmt-page-dsl.c', - 'nmt-page-ethernet.c', - 'nmt-page-infiniband.c', - 'nmt-page-ip4.c', - 'nmt-page-ip6.c', - 'nmt-page-ip-tunnel.c', - 'nmt-page-ppp.c', - 'nmt-page-team.c', - 'nmt-page-team-port.c', - 'nmt-page-vlan.c', - 'nmt-page-wifi.c', - 'nmt-password-dialog.c', - 'nmt-password-fields.c', - 'nmt-route-editor.c', - 'nmt-route-entry.c', - 'nmt-route-table.c', - 'nmt-slave-list.c', - 'nmtui.c', - 'nmtui-connect.c', - 'nmtui-edit.c', - 'nmtui-hostname.c', - 'nmt-utils.c', - 'nmt-widget-list.c', -) - -deps = [ - libnmc_base_dep, - libnmc_dep, - libnmt_newt_dep, - libnm_libnm_aux_dep, -] - executable( - name, - sources, - dependencies: deps, - c_args: common_c_flags, + 'nmtui', + files( + 'nm-editor-bindings.c', + 'nm-editor-utils.c', + 'nmt-address-list.c', + 'nmt-connect-connection-list.c', + 'nmt-device-entry.c', + 'nmt-edit-connection-list.c', + 'nmt-editor.c', + 'nmt-editor-grid.c', + 'nmt-editor-page.c', + 'nmt-editor-page-device.c', + 'nmt-editor-section.c', + 'nmt-ip-entry.c', + 'nmt-mac-entry.c', + 'nmt-mtu-entry.c', + 'nmt-page-bond.c', + 'nmt-page-bridge.c', + 'nmt-page-bridge-port.c', + 'nmt-page-dsl.c', + 'nmt-page-ethernet.c', + 'nmt-page-infiniband.c', + 'nmt-page-ip4.c', + 'nmt-page-ip6.c', + 'nmt-page-ip-tunnel.c', + 'nmt-page-ppp.c', + 'nmt-page-team.c', + 'nmt-page-team-port.c', + 'nmt-page-vlan.c', + 'nmt-page-wifi.c', + 'nmt-password-dialog.c', + 'nmt-password-fields.c', + 'nmt-route-editor.c', + 'nmt-route-entry.c', + 'nmt-route-table.c', + 'nmt-slave-list.c', + 'nmtui.c', + 'nmtui-connect.c', + 'nmtui-edit.c', + 'nmtui-hostname.c', + 'nmt-utils.c', + 'nmt-widget-list.c', + ), + dependencies: [ + libnmc_base_dep, + libnmc_dep, + libnmt_newt_dep, + libnm_libnm_aux_dep, + ], + c_args: [ + '-DG_LOG_DOMAIN="nmtui"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], link_with: libnm_systemd_logging_stub, link_args: ldflags_linker_script_binary, link_depends: linker_script_binary, diff --git a/clients/tui/newt/meson.build b/clients/tui/newt/meson.build index a18b31c206..415227e1a4 100644 --- a/clients/tui/newt/meson.build +++ b/clients/tui/newt/meson.build @@ -1,38 +1,37 @@ # SPDX-License-Identifier: LGPL-2.1-or-later -sources = files( - 'nmt-newt-button-box.c', - 'nmt-newt-button.c', - 'nmt-newt-checkbox.c', - 'nmt-newt-component.c', - 'nmt-newt-container.c', - 'nmt-newt-entry.c', - 'nmt-newt-entry-numeric.c', - 'nmt-newt-form.c', - 'nmt-newt-grid.c', - 'nmt-newt-hacks.c', - 'nmt-newt-label.c', - 'nmt-newt-listbox.c', - 'nmt-newt-popup.c', - 'nmt-newt-section.c', - 'nmt-newt-separator.c', - 'nmt-newt-stack.c', - 'nmt-newt-textbox.c', - 'nmt-newt-toggle-button.c', - 'nmt-newt-utils.c', - 'nmt-newt-widget.c', -) - -deps = [ - libnm_nm_default_dep, - newt_dep, -] - libnmt_newt = static_library( 'nmt-newt', - sources: sources, - dependencies: deps, - c_args: common_c_flags, + sources: files( + 'nmt-newt-button-box.c', + 'nmt-newt-button.c', + 'nmt-newt-checkbox.c', + 'nmt-newt-component.c', + 'nmt-newt-container.c', + 'nmt-newt-entry.c', + 'nmt-newt-entry-numeric.c', + 'nmt-newt-form.c', + 'nmt-newt-grid.c', + 'nmt-newt-hacks.c', + 'nmt-newt-label.c', + 'nmt-newt-listbox.c', + 'nmt-newt-popup.c', + 'nmt-newt-section.c', + 'nmt-newt-separator.c', + 'nmt-newt-stack.c', + 'nmt-newt-textbox.c', + 'nmt-newt-toggle-button.c', + 'nmt-newt-utils.c', + 'nmt-newt-widget.c', + ), + dependencies: [ + libnm_nm_default_dep, + newt_dep, + ], + c_args: [ + '-DG_LOG_DOMAIN="nmtui"', + '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT', + ], ) libnmt_newt_dep = declare_dependency(