summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-05-30 15:16:01 +0200
committerThomas Haller <thaller@redhat.com>2018-05-31 15:59:38 +0200
commitf445128af4255cc1c195530bd888f2024a4f71f3 (patch)
treeebb49b490d1f7003df8b757935a8ed92596777b0
parentb8b6100c78a039c9ae02013860b1e1a93ac1783a (diff)
build/meson: fix meson build for shared files
The files in shared/nm-utils are not compiled as one static library, instead each subproject that needs (parts of) them, re-compiles the files individually. The major reason for that is, because we might have different compile flags, depending on whether we build libnm-core or libnm-util/libnm-glib. Actually, I think that is not really the case, and maybe this should be refactored, to indeed build them all as a static library first. Anyway, libnm-util, libnm-glib, clients' common lib, they all need a different set of shared files that they should compile. Refactor "shared/meson.build" to account for that and handle it like autotools does. Another change is, that "shared_c_siphash_dep" no longer advertises "include_directories: include_directories('c-siphash/src')". We don't put c-siphash.h into the include search path. Users who need it, should include it via "#include <c-siphash/src/c-siphash.h>". The only exception is when building shared_n_acd library, which is not under our control.
-rw-r--r--clients/common/meson.build23
-rw-r--r--libnm-core/meson.build8
-rw-r--r--libnm-glib/meson.build26
-rw-r--r--libnm-glib/tests/meson.build2
-rw-r--r--libnm-util/meson.build3
-rw-r--r--libnm/tests/meson.build27
-rw-r--r--shared/meson.build82
7 files changed, 94 insertions, 77 deletions
diff --git a/clients/common/meson.build b/clients/common/meson.build
index ea26bccfb..f0c816008 100644
--- a/clients/common/meson.build
+++ b/clients/common/meson.build
@@ -11,15 +11,13 @@ cflags = clients_cflags + [
'-DG_LOG_DOMAIN="libnmc"',
]
-sources = shared_utils + files(
- 'nm-client-utils.c',
- 'nm-secret-agent-simple.c',
- 'nm-vpn-helpers.c'
-)
-
libnmc_base = static_library(
'nmc-base',
- sources: sources,
+ sources: shared_files_clients_common + files(
+ 'nm-client-utils.c',
+ 'nm-secret-agent-simple.c',
+ 'nm-vpn-helpers.c',
+ ),
dependencies: deps,
c_args: cflags
)
@@ -29,11 +27,6 @@ libnmc_base_dep = declare_dependency(
link_with: libnmc_base
)
-sources = shared_meta_setting + files(
- 'nm-meta-setting-access.c',
- 'nm-meta-setting-desc.c'
-)
-
settings_docs = 'settings-docs.h'
if enable_introspection
@@ -60,11 +53,13 @@ else
configuration: configuration_data()
)
endif
-sources += settings_docs_source
libnmc = static_library(
'nmc',
- sources: sources,
+ sources: files(
+ 'nm-meta-setting-access.c',
+ 'nm-meta-setting-desc.c'
+ ) + shared_nm_utils_nm_meta_setting_c + [settings_docs_source],
dependencies: deps,
c_args: cflags,
link_with: libnmc_base,
diff --git a/libnm-core/meson.build b/libnm-core/meson.build
index 533e59063..7b1437065 100644
--- a/libnm-core/meson.build
+++ b/libnm-core/meson.build
@@ -151,9 +151,15 @@ if enable_json_validation
deps += jansson_dep
endif
+libnm_core_sources_all = libnm_core_sources
+libnm_core_sources_all += libnm_core_enum
+libnm_core_sources_all += shared_nm_utils_nm_meta_setting_c
+libnm_core_sources_all += shared_files_libnm_core
+libnm_core_sources_all += [version_header]
+
libnm_core = static_library(
'nm-core',
- sources: libnm_core_sources + libnm_core_enum + shared_sources + [version_header],
+ sources: libnm_core_sources_all,
dependencies: deps,
c_args: cflags
)
diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build
index aa1b7aaab..fabd88187 100644
--- a/libnm-glib/meson.build
+++ b/libnm-glib/meson.build
@@ -79,13 +79,6 @@ sources = files(
glue = 'nm-vpn-plugin-glue.h'
-sources += custom_target(
- glue,
- input: ifaces_vpn_plugin_xml,
- output: glue,
- command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@']
-)
-
enum_types = 'nm-vpn-enum-types'
libnm_glib_vpn_enum = gnome.mkenums(
@@ -104,7 +97,18 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')
libnm_glib_vpn = shared_library(
'nm-glib-vpn',
- sources: sources + libnm_glib_vpn_enum,
+ sources: files(
+ 'nm-vpn-plugin.c',
+ 'nm-vpn-plugin-ui-interface.c',
+ 'nm-vpn-plugin-utils.c',
+ ) + [
+ custom_target(
+ glue,
+ input: ifaces_vpn_plugin_xml,
+ output: glue,
+ command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'],
+ ),
+ ] + libnm_glib_vpn_enum,
version: libnm_glib_vpn_version,
dependencies: deps,
c_args: cflags,
@@ -131,7 +135,7 @@ pkg.generate(
variables: 'exec_prefix=${prefix}'
)
-sources = shared_udev_utils + files(
+libnm_glib_sources = shared_files_libnm_glib + files(
'nm-access-point.c',
'nm-active-connection.c',
'nm-client.c',
@@ -194,7 +198,7 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
libnm_glib = shared_library(
'nm-glib',
- sources: sources + libnm_glib_enum + [nm_secret_agent_glue],
+ sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue],
version: libnm_glib_version,
dependencies: deps,
c_args: cflags,
@@ -223,7 +227,7 @@ pkg.generate(
)
if enable_introspection
- gir_sources = sources + headers + libnm_glib_enum
+ gir_sources = libnm_glib_sources + headers + libnm_glib_enum
deps = [
dbus_glib_dep,
diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build
index fbabb9a9c..347790181 100644
--- a/libnm-glib/tests/meson.build
+++ b/libnm-glib/tests/meson.build
@@ -14,7 +14,7 @@ test_units = [
foreach test_unit: test_units
exe = executable(
test_unit,
- [test_unit + '.c'] + shared_test_utils,
+ [test_unit + '.c'] + shared_nm_test_utils_impl_c,
dependencies: deps,
c_args:
common_cflags + [
diff --git a/libnm-util/meson.build b/libnm-util/meson.build
index 5d17a4dda..55df55017 100644
--- a/libnm-util/meson.build
+++ b/libnm-util/meson.build
@@ -55,7 +55,7 @@ libnm_utils_enum = gnome.mkenums(
install_dir: nm_pkgincludedir
)
-sources = shared_utils + files(
+sources = files(
'crypto.c',
'crypto_' + crypto + '.c',
'nm-connection.c',
@@ -90,6 +90,7 @@ sources = shared_utils + files(
'nm-utils.c',
'nm-value-transforms.c'
)
+sources += shared_files_libnm_util
deps = [
crypto_dep,
diff --git a/libnm/tests/meson.build b/libnm/tests/meson.build
index 54a1bf328..e2b882733 100644
--- a/libnm/tests/meson.build
+++ b/libnm/tests/meson.build
@@ -1,13 +1,8 @@
test_units = [
- ['test-general', shared_utils, [libnm_utils]],
- ['test-nm-client', shared_test_utils, []],
- ['test-remote-settings-client', shared_test_utils, []],
- ['test-secret-agent', shared_test_utils, []]
-]
-
-deps = [
- libnm_dep,
- nm_core_dep
+ ['test-general', [libnm_utils, libnm_core]],
+ ['test-nm-client', []],
+ ['test-remote-settings-client', []],
+ ['test-secret-agent', []],
]
cflags = [
@@ -18,10 +13,16 @@ cflags = [
foreach test_unit: test_units
exe = executable(
'libnm-' + test_unit[0],
- [test_unit[0] + '.c'] + test_unit[1],
- dependencies: deps,
+ [
+ test_unit[0] + '.c',
+ shared_nm_test_utils_impl_c,
+ ],
+ dependencies: [
+ libnm_dep,
+ nm_core_dep,
+ ],
c_args: cflags,
- link_with: test_unit[2]
+ link_with: test_unit[1]
)
test(
@@ -34,7 +35,7 @@ endforeach
# just test, that we can build "nm-vpn-plugin-utils.c"
libnm_vpn_plugin_utils_test = static_library(
'nm-vpn-plugin-utils-test',
- sources: shared_vpn_plugin_utils + [libnm_enum[1]],
+ sources: shared_nm_utils_nm_vpn_plugin_utils_c + [libnm_enum[1]],
include_directories: libnm_inc,
dependencies: nm_core_dep,
c_args: cflags
diff --git a/shared/meson.build b/shared/meson.build
index e83dec3b7..db6b8a40d 100644
--- a/shared/meson.build
+++ b/shared/meson.build
@@ -1,68 +1,78 @@
-shared_c_list_dep = declare_dependency(
- include_directories: include_directories('c-list/src')
-)
+shared_inc = include_directories('.')
shared_c_siphash = static_library(
'c-siphash',
- sources: ['c-siphash/src/c-siphash.c']
+ sources: 'c-siphash/src/c-siphash.c',
)
shared_c_siphash_dep = declare_dependency(
- include_directories: include_directories('c-siphash/src'),
- link_with: shared_c_siphash
+ include_directories: shared_inc,
+ link_with: shared_c_siphash,
)
shared_n_acd = static_library(
'n-acd',
- sources: ['n-acd/src/n-acd.c'],
- dependencies: [ shared_c_siphash_dep, shared_c_list_dep ]
+ sources: 'n-acd/src/n-acd.c',
+ include_directories: [
+ include_directories('c-siphash/src'),
+ include_directories('c-list/src'),
+ ],
+ dependencies: shared_c_siphash_dep,
)
shared_n_acd_dep = declare_dependency(
- include_directories: include_directories('.'),
+ include_directories: shared_inc,
link_with: shared_n_acd,
)
-shared_inc = include_directories('.')
-
version_conf = configuration_data()
version_conf.set('NM_MAJOR_VERSION', nm_major_version)
version_conf.set('NM_MINOR_VERSION', nm_minor_version)
version_conf.set('NM_MICRO_VERSION', nm_micro_version)
-version = 'nm-version-macros.h'
-
version_header = configure_file(
- input: version + '.in',
- output: version,
- configuration: version_conf
+ input: 'nm-version-macros.h.in',
+ output: 'nm-version-macros.h',
+ configuration: version_conf,
)
-shared_meta_setting = files('nm-meta-setting.c')
+shared_nm_utils_nm_meta_setting_c = files('nm-meta-setting.c')
-shared_test_utils = files('nm-test-utils-impl.c')
+shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c')
-shared_udev_utils = files('nm-utils/nm-udev-utils.c')
+shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c')
-shared_utils = files(
- 'c-siphash/src/c-siphash.c',
- 'nm-utils/nm-enum-utils.c',
- 'nm-utils/nm-hash-utils.c',
- 'nm-utils/nm-random-utils.c',
- 'nm-utils/nm-shared-utils.c'
-)
+shared_files_libnm_core = files('''
+ c-siphash/src/c-siphash.c
+ nm-utils/c-list-util.c
+ nm-utils/nm-dedup-multi.c
+ nm-utils/nm-enum-utils.c
+ nm-utils/nm-hash-utils.c
+ nm-utils/nm-random-utils.c
+ nm-utils/nm-shared-utils.c
+ nm-utils/nm-udev-utils.c
+'''.split())
-shared_vpn_plugin_utils = files('nm-utils/nm-vpn-plugin-utils.c')
+shared_files_clients_common = files('''
+ c-siphash/src/c-siphash.c
+ nm-utils/nm-enum-utils.c
+ nm-utils/nm-hash-utils.c
+ nm-utils/nm-random-utils.c
+ nm-utils/nm-shared-utils.c
+'''.split())
-shared_sources = shared_utils + shared_meta_setting + shared_udev_utils + files(
- 'nm-utils/c-list-util.c',
- 'nm-utils/nm-dedup-multi.c'
-)
+shared_files_libnm_util = files('''
+ nm-utils/nm-shared-utils.c
+'''.split())
+
+shared_files_libnm_glib = files('''
+ nm-utils/nm-udev-utils.c
+'''.split())
shared_dep = declare_dependency(
- include_directories: [
- top_inc,
- shared_inc,
- ],
- dependencies: glib_dep
+ include_directories: [
+ top_inc,
+ shared_inc,
+ ],
+ dependencies: glib_dep,
)