Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 1 | project('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 Jeffery | db92808 | 2023-06-07 09:45:11 +0930 | [diff] [blame] | 9 | version: '1.1.0', |
Patrick Williams | bae933a | 2023-10-24 03:15:52 -0500 | [diff] [blame] | 10 | meson_version: '>=1.1.0', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 11 | ) |
| 12 | |
Andrew Jeffery | 19c74d5 | 2023-04-19 11:43:23 +0930 | [diff] [blame] | 13 | add_project_arguments('-D_GNU_SOURCE', language: 'c') |
| 14 | |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 15 | systemdsystemunitdir = dependency('systemd').get_variable('systemdsystemunitdir') |
| 16 | install_data('conf/obmc-console@.service.in', |
| 17 | 'conf/obmc-console@.socket.in', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 18 | rename: [ |
| 19 | 'obmc-console@.service', |
| 20 | 'obmc-console@.socket', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 21 | ], |
| 22 | install_dir: systemdsystemunitdir, |
| 23 | ) |
Willy Tu | a2a026d | 2023-09-26 12:59:51 -0700 | [diff] [blame] | 24 | if 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 | ) |
| 31 | endif |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 32 | |
| 33 | if get_option('concurrent-servers') |
| 34 | install_data('conf/client.2200.conf.in', |
| 35 | rename: [ 'client.2200.conf' ], |
| 36 | install_dir: systemdsystemunitdir) |
| 37 | else |
Willy Tu | 2a5ffac | 2023-08-31 13:53:31 -0700 | [diff] [blame] | 38 | if get_option('ssh').allowed() |
Willy Tu | 2a5ffac | 2023-08-31 13:53:31 -0700 | [diff] [blame] | 39 | 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 Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 46 | endif |
| 47 | |
| 48 | udev = dependency('udev', required: get_option('udev')) |
| 49 | if 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') |
| 53 | endif |
| 54 | |
Alexander Hansen | 1e04f44 | 2024-06-12 16:35:58 +0200 | [diff] [blame] | 55 | iniparser_dep = dependency('iniparser') |
| 56 | |
Andrew Jeffery | 29a8f98 | 2024-07-31 10:47:08 +0930 | [diff] [blame] | 57 | server = executable('obmc-console-server', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 58 | 'config.c', |
Ninad Palsule | e258e51 | 2023-04-26 22:17:57 -0500 | [diff] [blame] | 59 | 'console-dbus.c', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 60 | 'console-server.c', |
| 61 | 'console-socket.c', |
Alexander Hansen | a6b2910 | 2024-07-10 15:33:37 +0200 | [diff] [blame] | 62 | 'console-mux.c', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 63 | 'log-handler.c', |
| 64 | 'ringbuffer.c', |
| 65 | 'socket-handler.c', |
| 66 | 'tty-handler.c', |
| 67 | 'util.c', |
| 68 | c_args: [ |
| 69 | '-DLOCALSTATEDIR="@0@"'.format(get_option('localstatedir')), |
| 70 | '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')) |
| 71 | ], |
| 72 | dependencies: [ |
| 73 | dependency('libsystemd'), |
Alexander Hansen | 1e04f44 | 2024-06-12 16:35:58 +0200 | [diff] [blame] | 74 | iniparser_dep, |
Alexander Hansen | a6b2910 | 2024-07-10 15:33:37 +0200 | [diff] [blame] | 75 | dependency('libgpiod'), |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 76 | meson.get_compiler('c').find_library('rt') |
| 77 | ], |
Andrew Jeffery | 86e3fd7 | 2023-04-21 16:14:17 +0930 | [diff] [blame] | 78 | install_dir: get_option('sbindir'), |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 79 | install: true) |
| 80 | |
Andrew Jeffery | 29a8f98 | 2024-07-31 10:47:08 +0930 | [diff] [blame] | 81 | client = executable('obmc-console-client', |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 82 | 'config.c', |
| 83 | 'console-client.c', |
| 84 | 'console-socket.c', |
| 85 | 'util.c', |
| 86 | c_args: [ |
| 87 | '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir')) |
| 88 | ], |
Alexander Hansen | 1e04f44 | 2024-06-12 16:35:58 +0200 | [diff] [blame] | 89 | dependencies: [ |
| 90 | iniparser_dep, |
| 91 | ], |
Andrew Jeffery | d0a8556 | 2023-04-18 06:22:39 +0930 | [diff] [blame] | 92 | install: true) |
| 93 | |
Andrew Jeffery | ace05dc | 2024-07-10 11:19:11 +0930 | [diff] [blame] | 94 | if get_option('tests') |
| 95 | subdir('test') |
| 96 | endif |