blob: cb028b9e900d30efcfc2dcb485d16d2b04848360 [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
Andrew Jefferyd0a85562023-04-18 06:22:39 +093017systemdsystemunitdir = dependency('systemd').get_variable('systemdsystemunitdir')
Patrick Williamsa1f911a2025-02-01 08:37:47 -050018install_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)
Willy Tua2a026d2023-09-26 12:59:51 -070024if get_option('ssh').allowed()
Patrick Williamsa1f911a2025-02-01 08:37:47 -050025 install_data(
26 'conf/obmc-console-ssh@.service.in',
27 rename: ['obmc-console-ssh@.service'],
28 install_dir: systemdsystemunitdir,
29 )
Willy Tua2a026d2023-09-26 12:59:51 -070030endif
Andrew Jefferyd0a85562023-04-18 06:22:39 +093031
32if get_option('concurrent-servers')
Patrick Williamsa1f911a2025-02-01 08:37:47 -050033 install_data(
34 'conf/client.2200.conf.in',
35 rename: ['client.2200.conf'],
36 install_dir: systemdsystemunitdir,
37 )
Andrew Jefferyd0a85562023-04-18 06:22:39 +093038else
Patrick Williamsa1f911a2025-02-01 08:37:47 -050039 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
Andrew Jefferyd0a85562023-04-18 06:22:39 +093051endif
52
53udev = dependency('udev', required: get_option('udev'))
54if udev.found()
Patrick Williamsa1f911a2025-02-01 08:37:47 -050055 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 )
Andrew Jefferyd0a85562023-04-18 06:22:39 +093060endif
61
Alexander Hansen1e04f442024-06-12 16:35:58 +020062iniparser_dep = dependency('iniparser')
63
Patrick Williamsa1f911a2025-02-01 08:37:47 -050064server = 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)
Andrew Jefferyd0a85562023-04-18 06:22:39 +093089
Patrick Williamsa1f911a2025-02-01 08:37:47 -050090client = 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)
Andrew Jefferyd0a85562023-04-18 06:22:39 +0930100
Andrew Jefferyace05dc2024-07-10 11:19:11 +0930101if get_option('tests')
Patrick Williamsa1f911a2025-02-01 08:37:47 -0500102 subdir('test')
Andrew Jefferyace05dc2024-07-10 11:19:11 +0930103endif