blob: db987d40b5af3b3c3d87b9d63aaf92d2dbd17593 [file] [log] [blame]
Patrick Williamsa1f911a2025-02-01 08:37:47 -05001project(
2 'obmc-console',
3 'c',
Andrew Jefferyd0a85562023-04-18 06:22:39 +09304 default_options: [
Patrick Williamsa1f911a2025-02-01 08:37:47 -05005 'buildtype=debugoptimized',
6 'warning_level=3',
7 'werror=true',
8 'c_std=gnu17',
9 'tests=' + (meson.is_subproject() ? 'false' : 'true'),
Andrew Jefferyd0a85562023-04-18 06:22:39 +093010 ],
Andrew Jefferydb928082023-06-07 09:45:11 +093011 version: '1.1.0',
Patrick Williamsbae933a2023-10-24 03:15:52 -050012 meson_version: '>=1.1.0',
Andrew Jefferyd0a85562023-04-18 06:22:39 +093013)
14
Andrew Jeffery19c74d52023-04-19 11:43:23 +093015add_project_arguments('-D_GNU_SOURCE', language: 'c')
16
Patrick Williams860a8f82025-07-09 11:41:58 -040017systemdsystemunitdir = dependency('systemd').get_variable(
18 'systemd_system_unit_dir',
19)
Patrick Williamsa1f911a2025-02-01 08:37:47 -050020install_data(
21 'conf/obmc-console@.service.in',
22 'conf/obmc-console@.socket.in',
23 rename: ['obmc-console@.service', 'obmc-console@.socket'],
24 install_dir: systemdsystemunitdir,
25)
Willy Tua2a026d2023-09-26 12:59:51 -070026if get_option('ssh').allowed()
Patrick Williamsa1f911a2025-02-01 08:37:47 -050027 install_data(
28 'conf/obmc-console-ssh@.service.in',
29 rename: ['obmc-console-ssh@.service'],
30 install_dir: systemdsystemunitdir,
31 )
Willy Tua2a026d2023-09-26 12:59:51 -070032endif
Andrew Jefferyd0a85562023-04-18 06:22:39 +093033
34if get_option('concurrent-servers')
Patrick Williamsa1f911a2025-02-01 08:37:47 -050035 install_data(
36 'conf/client.2200.conf.in',
37 rename: ['client.2200.conf'],
38 install_dir: systemdsystemunitdir,
39 )
Andrew Jefferyd0a85562023-04-18 06:22:39 +093040else
Patrick Williamsa1f911a2025-02-01 08:37:47 -050041 if get_option('ssh').allowed()
42 install_data(
43 'conf/obmc-console-ssh.socket.in',
44 rename: ['obmc-console-ssh.socket'],
45 install_dir: systemdsystemunitdir,
46 )
47 install_data(
48 'conf/obmc-console-ssh@.service.d/use-socket.conf.in',
49 rename: ['use-socket.conf'],
50 install_dir: systemdsystemunitdir / 'obmc-console-ssh@.service.d',
51 )
52 endif
Andrew Jefferyd0a85562023-04-18 06:22:39 +093053endif
54
55udev = dependency('udev', required: get_option('udev'))
56if udev.found()
Patrick Williamsa1f911a2025-02-01 08:37:47 -050057 install_data(
58 'conf/80-obmc-console-uart.rules.in',
59 rename: ['80-obmc-console-uart.rules'],
60 install_dir: udev.get_variable('udevdir') / 'rules.d',
61 )
Andrew Jefferyd0a85562023-04-18 06:22:39 +093062endif
63
Alexander Hansen1e04f442024-06-12 16:35:58 +020064iniparser_dep = dependency('iniparser')
65
Patrick Williamsa1f911a2025-02-01 08:37:47 -050066server = executable(
67 'obmc-console-server',
68 'config.c',
69 'console-dbus.c',
70 'console-server.c',
71 'console-socket.c',
72 'console-mux.c',
73 'log-handler.c',
74 'ringbuffer.c',
75 'socket-handler.c',
76 'tty-handler.c',
77 'util.c',
78 c_args: [
79 '-DLOCALSTATEDIR="@0@"'.format(get_option('localstatedir')),
80 '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')),
81 ],
82 dependencies: [
83 dependency('libsystemd'),
84 iniparser_dep,
85 dependency('libgpiod'),
86 meson.get_compiler('c').find_library('rt'),
87 ],
88 install_dir: get_option('sbindir'),
89 install: true,
90)
Andrew Jefferyd0a85562023-04-18 06:22:39 +093091
Patrick Williamsa1f911a2025-02-01 08:37:47 -050092client = executable(
93 'obmc-console-client',
94 'config.c',
95 'console-client.c',
96 'console-socket.c',
97 'util.c',
98 c_args: ['-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))],
99 dependencies: [iniparser_dep],
100 install: true,
101)
Andrew Jefferyd0a85562023-04-18 06:22:39 +0930102
Andrew Jefferyace05dc2024-07-10 11:19:11 +0930103if get_option('tests')
Patrick Williamsa1f911a2025-02-01 08:37:47 -0500104 subdir('test')
Andrew Jefferyace05dc2024-07-10 11:19:11 +0930105endif