blob: 2e233224235f4661d3f0c7849f6fc20f0bf6db93 [file] [log] [blame]
William A. Kennington III7d6fa422021-02-08 17:04:02 -08001ncsid_headers = include_directories('.')
2
3fmt_dep = dependency('fmt', required: false)
4if not fmt_dep.found()
5 fmt_proj = import('cmake').subproject(
6 'fmt',
7 cmake_options: [
8 '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
9 '-DMASTER_PROJECT=OFF'
10 ],
11 required: false)
12 assert(fmt_proj.found(), 'fmtlib is required')
13 fmt_dep = fmt_proj.dependency('fmt')
14endif
15
16ncsid_deps = [
17 fmt_dep,
18 dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
19 dependency('stdplus', fallback: ['stdplus', 'stdplus']),
20]
21
22ncsid_lib = static_library(
23 'ncsid',
24 [
25 'net_config.cpp',
26 'net_iface.cpp',
27 'net_sockio.cpp',
28 'ncsi_sockio.cpp',
29 'ncsi_state_machine.cpp',
30 'platforms/nemora/portable/ncsi_fsm.c',
31 'platforms/nemora/portable/ncsi_client.c',
32 'platforms/nemora/portable/ncsi_server.c',
33 ],
34 include_directories: ncsid_headers,
35 implicit_include_directories: false,
36 dependencies: ncsid_deps)
37
38ncsid = declare_dependency(
39 dependencies: ncsid_deps,
40 include_directories: ncsid_headers,
41 link_with: ncsid_lib)
42
43executable(
44 'ncsid',
45 'ncsid.cpp',
46 implicit_include_directories: false,
47 dependencies: ncsid,
48 install: true,
49 install_dir: get_option('libexecdir'))
50
51normalize_ip = executable(
52 'normalize_ip',
53 'normalize_ip.c',
54 implicit_include_directories: false,
55 install: true)
56
57normalize_mac = executable(
58 'normalize_mac',
59 'normalize_mac.c',
60 implicit_include_directories: false,
61 install: true)
62
63install_data(
64 'ncsid_udhcpc4.script',
65 'ncsid_udhcpc6.script',
66 install_mode: 'rwxr-xr-x',
67 install_dir: get_option('libexecdir'))
68
69install_data(
70 'ncsid_lib.sh',
71 install_mode: 'rw-r--r--',
72 install_dir: get_option('libexecdir'))
73
74install_data(
75 'update_static_neighbors.sh',
76 install_mode: 'rwxr-xr-x',
77 install_dir: get_option('libexecdir'))
78
79systemd = dependency('systemd')
80systemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
81
82libexecdir = get_option('prefix') / get_option('libexecdir')
83
84configure_file(
85 configuration: {'BIN': libexecdir / 'ncsid'},
86 input: 'ncsid@.service.in',
87 output: 'ncsid@.service',
88 install_mode: 'rw-r--r--',
89 install_dir: systemunitdir)
90
91configure_file(
92 configuration: {'BIN': libexecdir / 'update_static_neighbors.sh'},
93 input: 'update-static-neighbors@.service.in',
94 output: 'update-static-neighbors@.service',
95 install_mode: 'rw-r--r--',
96 install_dir: systemunitdir)
97
98configure_file(
99 configuration: {
100 'SCRIPT': libexecdir / 'ncsid_udhcpc4.script'},
101 input: 'dhcp4@.service.in',
102 output: 'dhcp4@.service',
103 install_mode: 'rw-r--r--',
104 install_dir: systemunitdir)
105
106configure_file(
107 configuration: {
108 'SCRIPT': libexecdir / 'ncsid_udhcpc6.script'},
109 input: 'dhcp6@.service.in',
110 output: 'dhcp6@.service',
111 install_mode: 'rw-r--r--',
112 install_dir: systemunitdir)
113
114install_data(
115 'nic-hostful@.target',
116 'nic-hostless@.target',
117 'update-static-neighbors@.timer',
118 install_mode: 'rw-r--r--',
119 install_dir: systemunitdir)