blob: e1fc5f05187926366857adcec87dfaa9a998e346 [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',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093010 meson_version: '>=0.63.0',
11)
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 )
24
25if get_option('concurrent-servers')
26 install_data('conf/client.2200.conf.in',
27 rename: [ 'client.2200.conf' ],
28 install_dir: systemdsystemunitdir)
29else
Willy Tu2a5ffac2023-08-31 13:53:31 -070030 if get_option('ssh').allowed()
31 install_data('conf/obmc-console-ssh@.service.in',
32 rename: [
33 'obmc-console-ssh@.service'
34 ],
35 install_dir: systemdsystemunitdir,
36 )
37
38 install_data('conf/obmc-console-ssh.socket.in',
39 rename: [ 'obmc-console-ssh.socket' ],
40 install_dir: systemdsystemunitdir)
41 install_data('conf/obmc-console-ssh@.service.d/use-socket.conf.in',
42 rename: [ 'use-socket.conf' ],
43 install_dir: systemdsystemunitdir / 'obmc-console-ssh@.service.d')
44 endif
Andrew Jefferyd0a85562023-04-18 06:22:39 +093045endif
46
47udev = dependency('udev', required: get_option('udev'))
48if udev.found()
49 install_data('conf/80-obmc-console-uart.rules.in',
50 rename: [ '80-obmc-console-uart.rules' ],
51 install_dir: udev.get_variable('udevdir') / 'rules.d')
52endif
53
54executable('obmc-console-server',
55 'config.c',
Ninad Palsulee258e512023-04-26 22:17:57 -050056 'console-dbus.c',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093057 'console-server.c',
58 'console-socket.c',
59 'log-handler.c',
60 'ringbuffer.c',
61 'socket-handler.c',
62 'tty-handler.c',
63 'util.c',
64 c_args: [
65 '-DLOCALSTATEDIR="@0@"'.format(get_option('localstatedir')),
66 '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
67 ],
68 dependencies: [
69 dependency('libsystemd'),
70 meson.get_compiler('c').find_library('rt')
71 ],
Andrew Jeffery86e3fd72023-04-21 16:14:17 +093072 install_dir: get_option('sbindir'),
Andrew Jefferyd0a85562023-04-18 06:22:39 +093073 install: true)
74
75executable('obmc-console-client',
76 'config.c',
77 'console-client.c',
78 'console-socket.c',
79 'util.c',
80 c_args: [
81 '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))
82 ],
83 install: true)
84
85subdir('test')