xref: /openbmc/google-misc/subprojects/ncsid/src/meson.build (revision 24c61c7ee8583830fd0916b7b2c7bf0561569e0f)
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)
38
39ncsid = declare_dependency(
40    dependencies: ncsid_deps,
41    include_directories: ncsid_headers,
42    link_with: ncsid_lib,
43)
44
45executable(
46    'ncsid',
47    'ncsid.cpp',
48    implicit_include_directories: false,
49    dependencies: ncsid,
50    install: true,
51    install_dir: get_option('libexecdir'),
52)
53
54normalize_ip = executable(
55    'normalize_ip',
56    'normalize_ip.c',
57    implicit_include_directories: false,
58    install: true,
59)
60
61normalize_mac = executable(
62    'normalize_mac',
63    'normalize_mac.c',
64    implicit_include_directories: false,
65    install: true,
66)
67
68systemd = dependency('systemd')
69systemunitdir = systemd.get_variable('systemdsystemunitdir')
70
71libexecdir = get_option('prefix') / get_option('libexecdir')
72
73configure_file(
74    configuration: {'BIN': libexecdir / 'ncsid'},
75    input: 'ncsid@.service.in',
76    output: 'ncsid@.service',
77    install_mode: 'rw-r--r--',
78    install_dir: systemunitdir,
79)
80
81install_data(
82    'nic-hostful@.target',
83    'nic-hostless@.target',
84    install_mode: 'rw-r--r--',
85    install_dir: systemunitdir,
86)
87