# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ncsid_headers = include_directories('.')

ncsid_deps = [
  dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
  dependency('stdplus', fallback: ['stdplus', 'stdplus_dep']),
]

ncsid_lib = static_library(
  'ncsid',
  [
    'net_config.cpp',
    'net_iface.cpp',
    'net_sockio.cpp',
    'ncsi_sockio.cpp',
    'ncsi_state_machine.cpp',
    'platforms/nemora/portable/ncsi_fsm.c',
    'platforms/nemora/portable/ncsi_client.c',
    'platforms/nemora/portable/ncsi_server.c',
  ],
  include_directories: ncsid_headers,
  implicit_include_directories: false,
  dependencies: ncsid_deps)

ncsid = declare_dependency(
  dependencies: ncsid_deps,
  include_directories: ncsid_headers,
  link_with: ncsid_lib)

executable(
  'ncsid',
  'ncsid.cpp',
  implicit_include_directories: false,
  dependencies: ncsid,
  install: true,
  install_dir: get_option('libexecdir'))

normalize_ip = executable(
  'normalize_ip',
  'normalize_ip.c',
  implicit_include_directories: false,
  install: true)

normalize_mac = executable(
  'normalize_mac',
  'normalize_mac.c',
  implicit_include_directories: false,
  install: true)

install_data(
  'update_ra_gw.sh',
  install_mode: 'rwxr-xr-x',
  install_dir: get_option('libexecdir'))

install_data(
  'ncsid_lib.sh',
  install_mode: 'rw-r--r--',
  install_dir: get_option('libexecdir'))

systemd = dependency('systemd')
systemunitdir = systemd.get_variable('systemdsystemunitdir')

libexecdir = get_option('prefix') / get_option('libexecdir')

configure_file(
  configuration: {'BIN': libexecdir / 'ncsid'},
  input: 'ncsid@.service.in',
  output: 'ncsid@.service',
  install_mode: 'rw-r--r--',
  install_dir: systemunitdir)

configure_file(
  configuration: {'BIN': libexecdir / 'update_ra_gw.sh'},
  input: 'update-ra-gw@.service.in',
  output: 'update-ra-gw@.service',
  install_mode: 'rw-r--r--',
  install_dir: systemunitdir)

install_data(
  'nic-hostful@.target',
  'nic-hostless@.target',
  install_mode: 'rw-r--r--',
  install_dir: systemunitdir)
