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