blob: c0a600db1b76d1551e8013536ef1eaff2d2a4e30 [file] [log] [blame]
Andrew Jefferyd0a85562023-04-18 06:22:39 +09301project('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 ],
Andrew Jefferydb928082023-06-07 09:45:11 +09309 version: '1.1.0',
Patrick Williamsbae933a2023-10-24 03:15:52 -050010 meson_version: '>=1.1.0',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093011)
12
Andrew Jeffery19c74d52023-04-19 11:43:23 +093013add_project_arguments('-D_GNU_SOURCE', language: 'c')
14
Andrew Jefferyd0a85562023-04-18 06:22:39 +093015systemdsystemunitdir = dependency('systemd').get_variable('systemdsystemunitdir')
16install_data('conf/obmc-console@.service.in',
17 'conf/obmc-console@.socket.in',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093018 rename: [
19 'obmc-console@.service',
20 'obmc-console@.socket',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093021 ],
22 install_dir: systemdsystemunitdir,
23 )
Willy Tua2a026d2023-09-26 12:59:51 -070024if 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
Andrew Jefferyd0a85562023-04-18 06:22:39 +093032
33if get_option('concurrent-servers')
34 install_data('conf/client.2200.conf.in',
35 rename: [ 'client.2200.conf' ],
36 install_dir: systemdsystemunitdir)
37else
Willy Tu2a5ffac2023-08-31 13:53:31 -070038 if get_option('ssh').allowed()
Willy Tu2a5ffac2023-08-31 13:53:31 -070039 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
Andrew Jefferyd0a85562023-04-18 06:22:39 +093046endif
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
Alexander Hansen1e04f442024-06-12 16:35:58 +020055iniparser_dep = dependency('iniparser')
56
Andrew Jefferyd0a85562023-04-18 06:22:39 +093057executable('obmc-console-server',
58 'config.c',
Ninad Palsulee258e512023-04-26 22:17:57 -050059 'console-dbus.c',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093060 'console-server.c',
61 'console-socket.c',
62 'log-handler.c',
63 'ringbuffer.c',
64 'socket-handler.c',
65 'tty-handler.c',
66 'util.c',
67 c_args: [
68 '-DLOCALSTATEDIR="@0@"'.format(get_option('localstatedir')),
69 '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
70 ],
71 dependencies: [
72 dependency('libsystemd'),
Alexander Hansen1e04f442024-06-12 16:35:58 +020073 iniparser_dep,
Andrew Jefferyd0a85562023-04-18 06:22:39 +093074 meson.get_compiler('c').find_library('rt')
75 ],
Andrew Jeffery86e3fd72023-04-21 16:14:17 +093076 install_dir: get_option('sbindir'),
Andrew Jefferyd0a85562023-04-18 06:22:39 +093077 install: true)
78
79executable('obmc-console-client',
80 'config.c',
81 'console-client.c',
82 'console-socket.c',
83 'util.c',
84 c_args: [
85 '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
86 ],
Alexander Hansen1e04f442024-06-12 16:35:58 +020087 dependencies: [
88 iniparser_dep,
89 ],
Andrew Jefferyd0a85562023-04-18 06:22:39 +093090 install: true)
91
Andrew Jefferyace05dc2024-07-10 11:19:11 +093092if get_option('tests')
93 subdir('test')
94endif