meson.build 7.51 KB
Newer Older
1 2 3 4
src_inc = include_directories('.')

install_data(
  'org.freedesktop.NetworkManager.conf',
5
  install_dir: dbus_conf_dir,
6 7 8 9
)

subdir('systemd')

10
core_plugins = []
11

12
nm_cflags = ['-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DAEMON']
13

14 15
nm_dep = declare_dependency(
  include_directories: src_inc,
16
  dependencies: libnm_core_dep,
17
  compile_args: nm_cflags,
18
)
19

20
cflags = nm_cflags
21

22 23 24
sources = files(
  'dhcp/nm-dhcp-client.c',
  'dhcp/nm-dhcp-manager.c',
25
  'dhcp/nm-dhcp-nettools.c',
26 27
  'dhcp/nm-dhcp-systemd.c',
  'dhcp/nm-dhcp-utils.c',
28
  'dhcp/nm-dhcp-options.c',
29 30
  'ndisc/nm-lndp-ndisc.c',
  'ndisc/nm-ndisc.c',
31
  'platform/nm-netlink.c',
32 33
  'platform/wifi/nm-wifi-utils-nl80211.c',
  'platform/wifi/nm-wifi-utils.c',
Lubomir Rintel's avatar
Lubomir Rintel committed
34
  'platform/wpan/nm-wpan-utils.c',
35 36 37 38 39
  'platform/nm-linux-platform.c',
  'platform/nm-platform.c',
  'platform/nm-platform-utils.c',
  'platform/nmp-netns.c',
  'platform/nmp-object.c',
40
  'platform/nmp-rules-manager.c',
41 42 43
  'main-utils.c',
  'NetworkManagerUtils.c',
  'nm-core-utils.c',
44 45
  'nm-dbus-object.c',
  'nm-dbus-utils.c',
46 47
  'nm-ip4-config.c',
  'nm-ip6-config.c',
48
  'nm-logging.c',
49 50 51 52
)

deps = [
  libsystemd_dep,
53
  libudev_dep,
54
  libnm_core_dep,
55
  shared_n_dhcp4_dep,
56 57 58
]

if enable_wext
59
  sources += files('platform/wifi/nm-wifi-utils-wext.c')
60 61 62
endif

libnetwork_manager_base = static_library(
63
  nm_name + 'Base',
64 65
  sources: sources,
  dependencies: deps,
66
  c_args: cflags,
67
  link_with: libnm_core,
68 69 70
)

sources = files(
71
  'devices/nm-acd-manager.c',
Lubomir Rintel's avatar
Lubomir Rintel committed
72
  'devices/nm-device-6lowpan.c',
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
  'devices/nm-device-bond.c',
  'devices/nm-device-bridge.c',
  'devices/nm-device.c',
  'devices/nm-device-dummy.c',
  'devices/nm-device-ethernet.c',
  'devices/nm-device-ethernet-utils.c',
  'devices/nm-device-factory.c',
  'devices/nm-device-generic.c',
  'devices/nm-device-infiniband.c',
  'devices/nm-device-ip-tunnel.c',
  'devices/nm-device-macsec.c',
  'devices/nm-device-macvlan.c',
  'devices/nm-device-ppp.c',
  'devices/nm-device-tun.c',
  'devices/nm-device-veth.c',
  'devices/nm-device-vlan.c',
  'devices/nm-device-vxlan.c',
90
  'devices/nm-device-wireguard.c',
Lubomir Rintel's avatar
Lubomir Rintel committed
91
  'devices/nm-device-wpan.c',
92 93 94 95 96 97 98 99 100 101 102 103 104 105
  'devices/nm-lldp-listener.c',
  'dhcp/nm-dhcp-dhclient.c',
  'dhcp/nm-dhcp-dhclient-utils.c',
  'dhcp/nm-dhcp-dhcpcanon.c',
  'dhcp/nm-dhcp-dhcpcd.c',
  'dhcp/nm-dhcp-listener.c',
  'dns/nm-dns-dnsmasq.c',
  'dns/nm-dns-manager.c',
  'dns/nm-dns-plugin.c',
  'dns/nm-dns-systemd-resolved.c',
  'dns/nm-dns-unbound.c',
  'dnsmasq/nm-dnsmasq-manager.c',
  'dnsmasq/nm-dnsmasq-utils.c',
  'ppp/nm-ppp-manager-call.c',
106
  'settings/plugins/keyfile/nms-keyfile-storage.c',
107 108 109 110 111 112 113 114 115
  'settings/plugins/keyfile/nms-keyfile-plugin.c',
  'settings/plugins/keyfile/nms-keyfile-reader.c',
  'settings/plugins/keyfile/nms-keyfile-utils.c',
  'settings/plugins/keyfile/nms-keyfile-writer.c',
  'settings/nm-agent-manager.c',
  'settings/nm-secret-agent.c',
  'settings/nm-settings.c',
  'settings/nm-settings-connection.c',
  'settings/nm-settings-plugin.c',
116 117
  'settings/nm-settings-storage.c',
  'settings/nm-settings-utils.c',
118 119 120 121 122 123 124 125 126 127 128 129
  'supplicant/nm-supplicant-config.c',
  'supplicant/nm-supplicant-interface.c',
  'supplicant/nm-supplicant-manager.c',
  'supplicant/nm-supplicant-settings-verify.c',
  'vpn/nm-vpn-connection.c',
  'vpn/nm-vpn-manager.c',
  'nm-active-connection.c',
  'nm-act-request.c',
  'nm-audit-manager.c',
  'nm-auth-manager.c',
  'nm-auth-subject.c',
  'nm-auth-utils.c',
130
  'nm-dbus-manager.c',
131 132 133 134
  'nm-checkpoint.c',
  'nm-checkpoint-manager.c',
  'nm-config.c',
  'nm-config-data.c',
135
  'nm-connectivity.c',
136 137 138 139 140 141
  'nm-dcb.c',
  'nm-dhcp4-config.c',
  'nm-dhcp6-config.c',
  'nm-dispatcher.c',
  'nm-firewall-manager.c',
  'nm-hostname-manager.c',
142
  'nm-keep-alive.c',
143 144 145 146 147 148 149
  'nm-manager.c',
  'nm-netns.c',
  'nm-pacrunner-manager.c',
  'nm-policy.c',
  'nm-proxy-config.c',
  'nm-rfkill-manager.c',
  'nm-session-monitor.c',
150
  'nm-sleep-monitor.c',
151 152
)

153
nm_deps = [
154 155
  dl_dep,
  libndp_dep,
156
  libudev_dep,
157
  libnm_core_dep,
158 159
  shared_n_acd_dep,
  logind_dep,
160 161 162
]

if enable_concheck
163
  nm_deps += libcurl_dep
164 165 166
endif

if enable_libaudit
167
  nm_deps += libaudit_dep
168 169 170
endif

if enable_libpsl
171
  nm_deps += libpsl_dep
172 173 174
endif

if enable_selinux
175
  nm_deps += selinux_dep
176 177 178
endif

libnetwork_manager = static_library(
179
  nm_name,
180
  sources: sources,
181
  dependencies: nm_deps,
182
  c_args: cflags,
183 184 185 186 187
  link_with: [
    libnetwork_manager_base,
    libnm_systemd_core,
    libnm_systemd_shared,
  ],
188 189 190 191 192
)

deps = [
  dl_dep,
  libndp_dep,
193
  libudev_dep,
194
  libnm_core_dep,
195 196 197 198 199 200 201 202
]

name = 'nm-iface-helper'

executable(
  name,
  name + '.c',
  dependencies: deps,
203
  c_args: cflags,
204 205 206 207 208
  link_with: [
    libnetwork_manager_base,
    libnm_systemd_core,
    libnm_systemd_shared,
  ],
209
  link_args: ldflags_linker_script_binary,
210 211
  link_depends: linker_script_binary,
  install: true,
212
  install_dir: nm_libexecdir,
213 214 215 216 217 218
)

if enable_tests
  sources = files(
    'ndisc/nm-fake-ndisc.c',
    'platform/tests/test-common.c',
219
    'platform/nm-fake-platform.c',
220 221 222
  )

  deps = [
223
    libudev_dep,
224
    libnm_core_dep,
225 226
  ]

227
  test_cflags = ['-DNETWORKMANAGER_COMPILATION_TEST']
228 229 230 231 232
  if require_root_tests
    test_cflags += ['-DREQUIRE_ROOT_TESTS=1']
  endif

  libnetwork_manager_test = static_library(
233
    nm_name + 'Test',
234 235
    sources: sources,
    dependencies: deps,
236
    c_args: cflags + test_cflags,
237
    link_with: libnetwork_manager,
238 239
  )

240 241
  test_nm_dep = declare_dependency(
    dependencies: nm_dep,
242
    compile_args: test_cflags,
243
    link_with: libnetwork_manager_test,
244 245
  )

246 247 248 249 250 251 252 253 254 255
  test_nm_dep_fake = declare_dependency(
    dependencies: test_nm_dep,
    compile_args: ['-DSETUP=nm_fake_platform_setup']
  )

  test_nm_dep_linux = declare_dependency(
    dependencies: test_nm_dep,
    compile_args: ['-DSETUP=nm_linux_platform_setup']
  )

256 257 258 259 260 261 262 263 264 265 266 267 268 269
  subdir('dnsmasq/tests')
  subdir('ndisc/tests')
  subdir('platform/tests')
  subdir('supplicant/tests')
  subdir('tests')
endif

subdir('dhcp')

if enable_ppp
  subdir('ppp')
endif

subdir('devices')
270
subdir('initrd')
271
subdir('settings/plugins')
272 273 274 275 276 277

# NetworkManager binary

create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh')
symbol_map_name = 'NetworkManager.ver'

278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
# libNetworkManager.a, as built by meson doesn't contain all symbols
# from libNetworkManagerBase.a and other static libraries, unless we
# add dependencies with link_whole, only supported in meson >= 0.46.
# Create an executable with full symbols that we use in place of the
# library to enumerate the symbols.
network_manager_sym = executable(
  'nm-full-symbols',
  'main.c',
  c_args: nm_cflags,
  link_args: '-Wl,--no-gc-sections',
  dependencies: nm_deps,
  link_whole: [libnetwork_manager, libnetwork_manager_base, libnm_core],
  install: false,
)

# this uses symbols from nm-full-symbols instead of libNetworkManager.a
294 295 296 297
ver_script = custom_target(
  symbol_map_name,
  input: meson.source_root(),
  output: symbol_map_name,
298
  depends: [ network_manager_sym, core_plugins ],
299
  command: [create_exports_networkmanager, '--called-from-build', '@INPUT@'],
300 301 302 303 304 305 306 307 308 309 310 311 312
)

ldflags = ['-rdynamic', '-Wl,--version-script,@0@'.format(ver_script.full_path())]

network_manager = executable(
  nm_name,
  'main.c',
  dependencies: nm_deps,
  c_args: nm_cflags,
  link_with: libnetwork_manager,
  link_args: ldflags,
  link_depends: ver_script,
  install: true,
313
  install_dir: nm_sbindir,
314
)
315 316 317 318 319 320 321 322 323

if enable_tests
  foreach plugin : core_plugins
    test ('sym/' + plugin.full_path().split('/')[-1],
          network_manager,
          args: '--version',
          env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin.full_path()])
  endforeach
endif
324 325 326 327 328 329

test(
  'check-config-options',
  find_program(join_paths(meson.source_root(), 'tools', 'check-config-options.sh')),
  args: [meson.source_root()]
)