summaryrefslogtreecommitdiff
path: root/shared/meson.build
blob: 780c31fefe543e3ff8422a5c96e54b8f9a261d89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
shared_inc = include_directories('.')

shared_c_siphash = static_library(
    'c-siphash',
    sources: 'c-siphash/src/c-siphash.c',
)

shared_c_siphash_dep = declare_dependency(
    include_directories: shared_inc,
    link_with: shared_c_siphash,
)

shared_c_rbtree = static_library(
    'c-rbtree',
    c_args: '-std=c11',
    sources: files('c-rbtree/src/c-rbtree.c',
                   'c-rbtree/src/c-rbtree.h',
                   'c-rbtree/src/c-rbtree-private.h'),
)

shared_c_rbtree_dep = declare_dependency(
    include_directories: shared_inc,
    link_with: shared_c_rbtree,
)


if get_option('ebpf')
    shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf.c')
else
    shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf-fallback.c')
endif

shared_n_acd = static_library(
    'n-acd',
    sources: files('n-acd/src/n-acd.c',
                   'n-acd/src/n-acd.h',
                   'n-acd/src/n-acd-private.h',
                   'n-acd/src/n-acd-probe.c',
                   'n-acd/src/util/timer.c',
                   'n-acd/src/util/timer.h')
             + shared_n_acd_bpf_files,
    c_args: [
        '-D_GNU_SOURCE',
        '-DSO_ATTACH_BPF=50',
        '-std=c11',
        '-Wno-pointer-arith',
        '-Wno-vla',
    ],
    include_directories: [
        include_directories('c-siphash/src'),
        include_directories('c-list/src'),
        include_directories('c-rbtree/src'),
    ],
    dependencies: [
        shared_c_siphash_dep,
        shared_c_rbtree_dep
    ],
)

shared_n_acd_dep = declare_dependency(
    include_directories: shared_inc,
    link_with: shared_n_acd,
)

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_header = configure_file(
    input: 'nm-version-macros.h.in',
    output: 'nm-version-macros.h',
    configuration: version_conf,
)

shared_nm_ethtool_utils_c = files('nm-ethtool-utils.c')

shared_nm_meta_setting_c = files('nm-meta-setting.c')

shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c')

shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-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-io-utils.c
    nm-utils/nm-random-utils.c
    nm-utils/nm-secret-utils.c
    nm-utils/nm-shared-utils.c
    nm-utils/nm-udev-utils.c
'''.split())

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_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,
)