xref: /openbmc/google-misc/ncsid/src/meson.build (revision 253e6463)
1# Copyright 2021 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15ncsid_headers = include_directories('.')
16
17ncsid_deps = [
18  dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
19  dependency('stdplus', fallback: ['stdplus', 'stdplus_dep']),
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  'update_ra_gw.sh',
67  'update_ra_neighbor.sh',
68  'update_static_neighbors.sh',
69  install_mode: 'rwxr-xr-x',
70  install_dir: get_option('libexecdir'))
71
72install_data(
73  'ncsid_lib.sh',
74  install_mode: 'rw-r--r--',
75  install_dir: get_option('libexecdir'))
76
77systemd = dependency('systemd')
78systemunitdir = systemd.get_variable('systemdsystemunitdir')
79
80libexecdir = get_option('prefix') / get_option('libexecdir')
81
82configure_file(
83  configuration: {'BIN': libexecdir / 'ncsid'},
84  input: 'ncsid@.service.in',
85  output: 'ncsid@.service',
86  install_mode: 'rw-r--r--',
87  install_dir: systemunitdir)
88
89configure_file(
90  configuration: {'BIN': libexecdir / 'update_ra_gw.sh'},
91  input: 'update-ra-gw@.service.in',
92  output: 'update-ra-gw@.service',
93  install_mode: 'rw-r--r--',
94  install_dir: systemunitdir)
95
96configure_file(
97  configuration: {'BIN': libexecdir / 'update_ra_neighbor.sh'},
98  input: 'update-ra-neighbor@.service.in',
99  output: 'update-ra-neighbor@.service',
100  install_mode: 'rw-r--r--',
101  install_dir: systemunitdir)
102
103configure_file(
104  configuration: {'BIN': libexecdir / 'update_static_neighbors.sh'},
105  input: 'update-static-neighbors@.service.in',
106  output: 'update-static-neighbors@.service',
107  install_mode: 'rw-r--r--',
108  install_dir: systemunitdir)
109
110configure_file(
111  configuration: {
112    'SCRIPT': libexecdir / 'ncsid_udhcpc4.script'},
113  input: 'dhcp4@.service.in',
114  output: 'dhcp4@.service',
115  install_mode: 'rw-r--r--',
116  install_dir: systemunitdir)
117
118configure_file(
119  configuration: {
120    'SCRIPT': libexecdir / 'ncsid_udhcpc6.script'},
121  input: 'dhcp6@.service.in',
122  output: 'dhcp6@.service',
123  install_mode: 'rw-r--r--',
124  install_dir: systemunitdir)
125
126install_data(
127  'nic-hostful@.target',
128  'nic-hostless@.target',
129  'update-ra-neighbor@.timer',
130  'update-static-neighbors@.timer',
131  install_mode: 'rw-r--r--',
132  install_dir: systemunitdir)
133