xref: /openbmc/google-misc/ncsid/src/meson.build (revision 5f0ae6fa)
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  'update_ra_gw.sh',
65  install_mode: 'rwxr-xr-x',
66  install_dir: get_option('libexecdir'))
67
68install_data(
69  'ncsid_lib.sh',
70  install_mode: 'rw-r--r--',
71  install_dir: get_option('libexecdir'))
72
73systemd = dependency('systemd')
74systemunitdir = systemd.get_variable('systemdsystemunitdir')
75
76libexecdir = get_option('prefix') / get_option('libexecdir')
77
78configure_file(
79  configuration: {'BIN': libexecdir / 'ncsid'},
80  input: 'ncsid@.service.in',
81  output: 'ncsid@.service',
82  install_mode: 'rw-r--r--',
83  install_dir: systemunitdir)
84
85configure_file(
86  configuration: {'BIN': libexecdir / 'update_ra_gw.sh'},
87  input: 'update-ra-gw@.service.in',
88  output: 'update-ra-gw@.service',
89  install_mode: 'rw-r--r--',
90  install_dir: systemunitdir)
91
92install_data(
93  'nic-hostful@.target',
94  'nic-hostless@.target',
95  install_mode: 'rw-r--r--',
96  install_dir: systemunitdir)
97