xref: /openbmc/obmc-console/meson.build (revision 533f9702)
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.0.0',
10    meson_version: '>=0.63.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             'conf/obmc-console-ssh@.service.in',
19             rename: [
20               'obmc-console@.service',
21               'obmc-console@.socket',
22               'obmc-console-ssh@.service'
23             ],
24             install_dir: systemdsystemunitdir,
25           )
26
27if get_option('concurrent-servers')
28  install_data('conf/client.2200.conf.in',
29               rename: [ 'client.2200.conf' ],
30               install_dir: systemdsystemunitdir)
31else
32  install_data('conf/obmc-console-ssh.socket.in',
33               rename: [ 'obmc-console-ssh.socket' ],
34               install_dir: systemdsystemunitdir)
35  install_data('conf/obmc-console-ssh@.service.d/use-socket.conf.in',
36               rename: [ 'use-socket.conf' ],
37               install_dir: systemdsystemunitdir / 'obmc-console-ssh@.service.d')
38endif
39
40udev = dependency('udev', required: get_option('udev'))
41if udev.found()
42  install_data('conf/80-obmc-console-uart.rules.in',
43               rename: [ '80-obmc-console-uart.rules' ],
44               install_dir: udev.get_variable('udevdir') / 'rules.d')
45endif
46
47executable('obmc-console-server',
48           'config.c',
49           'console-server.c',
50           'console-socket.c',
51           'log-handler.c',
52           'ringbuffer.c',
53           'socket-handler.c',
54           'tty-handler.c',
55           'util.c',
56           c_args: [
57             '-DLOCALSTATEDIR="@0@"'.format(get_option('localstatedir')),
58             '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
59           ],
60           dependencies: [
61             dependency('libsystemd'),
62             meson.get_compiler('c').find_library('rt')
63           ],
64           install: true)
65
66executable('obmc-console-client',
67           'config.c',
68           'console-client.c',
69           'console-socket.c',
70           'util.c',
71           c_args: [
72             '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
73           ],
74           install: true)
75
76subdir('test')
77