Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 1 | project( |
| 2 | 'obmc-console', |
| 3 | 'c', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 4 | default_options: [ |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 5 | 'buildtype=debugoptimized', |
| 6 | 'warning_level=3', |
| 7 | 'werror=true', |
| 8 | 'c_std=gnu17', |
| 9 | 'tests=' + (meson.is_subproject() ? 'false' : 'true'), |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 10 | ], |
Andrew Jeffery | db92808 | 2023-06-07 09:45:11 +0930 | [diff] [blame] | 11 | version: '1.1.0', |
Patrick Williams | bae933a | 2023-10-24 03:15:52 -0500 | [diff] [blame] | 12 | meson_version: '>=1.1.0', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 13 | ) |
| 14 | |
Andrew Jeffery | 19c74d5 | 2023-04-19 11:43:23 +0930 | [diff] [blame] | 15 | add_project_arguments('-D_GNU_SOURCE', language: 'c') |
| 16 | |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 17 | systemdsystemunitdir = dependency('systemd').get_variable('systemdsystemunitdir') |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 18 | install_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 Tu | a2a026d | 2023-09-26 12:59:51 -0700 | [diff] [blame] | 24 | if get_option('ssh').allowed() |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 25 | install_data( |
| 26 | 'conf/obmc-console-ssh@.service.in', |
| 27 | rename: ['obmc-console-ssh@.service'], |
| 28 | install_dir: systemdsystemunitdir, |
| 29 | ) |
Willy Tu | a2a026d | 2023-09-26 12:59:51 -0700 | [diff] [blame] | 30 | endif |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 31 | |
| 32 | if get_option('concurrent-servers') |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 33 | install_data( |
| 34 | 'conf/client.2200.conf.in', |
| 35 | rename: ['client.2200.conf'], |
| 36 | install_dir: systemdsystemunitdir, |
| 37 | ) |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 38 | else |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 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 |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 51 | endif |
| 52 | |
| 53 | udev = dependency('udev', required: get_option('udev')) |
| 54 | if udev.found() |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 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 | ) |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 60 | endif |
| 61 | |
Alexander Hansen | 1e04f44 | 2024-06-12 16:35:58 +0200 | [diff] [blame] | 62 | iniparser_dep = dependency('iniparser') |
| 63 | |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 64 | server = 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 Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 89 | |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 90 | client = 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 Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 100 | |
Andrew Jeffery | ace05dc | 2024-07-10 11:19:11 +0930 | [diff] [blame] | 101 | if get_option('tests') |
Patrick Williams | a1f911a | 2025-02-01 08:37:47 -0500 | [diff] [blame] | 102 | subdir('test') |
Andrew Jeffery | ace05dc | 2024-07-10 11:19:11 +0930 | [diff] [blame] | 103 | endif |