xref: /openbmc/obmc-console/meson.build (revision ce3688c9)
1project('obmc-console', 'c',
2    default_options: [
3      'buildtype=debugoptimized',
4      'warning_level=3',
5      'werror=true',
6      'c_std=gnu17',
7      'tests=' + (meson.is_subproject() ? 'false' : 'true'),
8    ],
9    version: '1.1.0',
10    meson_version: '>=1.1.0',
11)
12
13add_project_arguments('-D_GNU_SOURCE', language: 'c')
14
15systemdsystemunitdir = dependency('systemd').get_variable('systemdsystemunitdir')
16install_data('conf/obmc-console@.service.in',
17             'conf/obmc-console@.socket.in',
18             rename: [
19               'obmc-console@.service',
20               'obmc-console@.socket',
21             ],
22             install_dir: systemdsystemunitdir,
23           )
24if get_option('ssh').allowed()
25  install_data('conf/obmc-console-ssh@.service.in',
26            rename: [
27              'obmc-console-ssh@.service'
28            ],
29            install_dir: systemdsystemunitdir,
30          )
31endif
32
33if get_option('concurrent-servers')
34  install_data('conf/client.2200.conf.in',
35               rename: [ 'client.2200.conf' ],
36               install_dir: systemdsystemunitdir)
37else
38  if get_option('ssh').allowed()
39    install_data('conf/obmc-console-ssh.socket.in',
40                rename: [ 'obmc-console-ssh.socket' ],
41                install_dir: systemdsystemunitdir)
42    install_data('conf/obmc-console-ssh@.service.d/use-socket.conf.in',
43                rename: [ 'use-socket.conf' ],
44                install_dir: systemdsystemunitdir / 'obmc-console-ssh@.service.d')
45  endif
46endif
47
48udev = dependency('udev', required: get_option('udev'))
49if udev.found()
50  install_data('conf/80-obmc-console-uart.rules.in',
51               rename: [ '80-obmc-console-uart.rules' ],
52               install_dir: udev.get_variable('udevdir') / 'rules.d')
53endif
54
55iniparser_dep = dependency('iniparser')
56
57server = executable('obmc-console-server',
58           'config.c',
59           'console-dbus.c',
60           'console-server.c',
61           'console-socket.c',
62           'console-mux.c',
63           'log-handler.c',
64           'ringbuffer.c',
65           'socket-handler.c',
66           'tty-handler.c',
67           'util.c',
68           c_args: [
69             '-DLOCALSTATEDIR="@0@"'.format(get_option('localstatedir')),
70             '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
71           ],
72           dependencies: [
73             dependency('libsystemd'),
74             iniparser_dep,
75             dependency('libgpiod'),
76             meson.get_compiler('c').find_library('rt')
77           ],
78           install_dir: get_option('sbindir'),
79           install: true)
80
81client = executable('obmc-console-client',
82           'config.c',
83           'console-client.c',
84           'console-socket.c',
85           'util.c',
86           c_args: [
87             '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
88           ],
89           dependencies: [
90             iniparser_dep,
91           ],
92           install: true)
93
94if get_option('tests')
95  subdir('test')
96endif
97