Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 1 | # Gather the Configuration data |
| 2 | |
| 3 | conf_data = configuration_data() |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 4 | |
| 5 | feature_options = [ |
| 6 | 'basic-auth', |
| 7 | 'cookie-auth', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 8 | 'experimental-http2', |
| 9 | 'experimental-redfish-multi-computer-system', |
Alexander Hansen | 6c58a03 | 2024-11-21 15:27:04 -0800 | [diff] [blame] | 10 | 'experimental-redfish-dbus-log-subscription', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 11 | 'google-api', |
| 12 | 'host-serial-socket', |
Gunnar Mills | 6889620 | 2024-08-21 11:34:20 -0500 | [diff] [blame] | 13 | 'hypervisor-computer-system', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 14 | 'ibm-management-console', |
| 15 | 'insecure-disable-auth', |
| 16 | 'insecure-disable-csrf', |
| 17 | 'insecure-disable-ssl', |
| 18 | 'insecure-enable-redfish-query', |
| 19 | 'insecure-ignore-content-type', |
| 20 | 'insecure-push-style-notification', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 21 | 'kvm', |
Ed Tanous | 3ce3688 | 2024-06-09 10:58:16 -0700 | [diff] [blame] | 22 | 'meta-tls-common-name-parsing', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 23 | 'mutual-tls-auth', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 24 | 'redfish-aggregation', |
| 25 | 'redfish-allow-deprecated-power-thermal', |
Ed Tanous | 6a37140 | 2024-12-03 14:01:25 -0800 | [diff] [blame] | 26 | 'redfish-allow-simple-update', |
Ed Tanous | 56b8199 | 2024-12-02 10:36:37 -0800 | [diff] [blame] | 27 | 'redfish-use-3-digit-messageid', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 28 | 'redfish-bmc-journal', |
| 29 | 'redfish-cpu-log', |
| 30 | 'redfish-dbus-log', |
| 31 | 'redfish-dump-log', |
| 32 | 'redfish-host-logger', |
| 33 | 'redfish-new-powersubsystem-thermalsubsystem', |
| 34 | 'redfish-oem-manager-fan-data', |
| 35 | 'redfish-provisioning-feature', |
Jagpal Singh Gill | 5785566 | 2024-04-17 10:44:27 -0700 | [diff] [blame] | 36 | 'redfish-updateservice-use-dbus', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 37 | 'redfish', |
| 38 | 'rest', |
| 39 | 'session-auth', |
| 40 | 'static-hosting', |
| 41 | 'tests', |
| 42 | 'vm-websocket', |
| 43 | 'xtoken-auth', |
| 44 | ] |
| 45 | |
| 46 | string_options = [ |
| 47 | 'dns-resolver', |
Ed Tanous | 3ce3688 | 2024-06-09 10:58:16 -0700 | [diff] [blame] | 48 | 'mutual-tls-common-name-parsing-default', |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 49 | 'redfish-manager-uri-name', |
| 50 | 'redfish-system-uri-name', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 51 | ] |
| 52 | |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 53 | int_options = ['http-body-limit'] |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 54 | |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 55 | feature_options_string = '\n//Feature options\n' |
| 56 | string_options_string = '\n// String options\n' |
| 57 | int_options_string = '\n// Integer options\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 58 | |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 59 | foreach option_key : feature_options + string_options + int_options |
| 60 | option_key_config = 'BMCWEB_' + option_key.to_upper() |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 61 | option_key_config = option_key_config.replace('-', '_') |
| 62 | |
| 63 | message(option_key_config) |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 64 | |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 65 | opt = get_option(option_key) |
| 66 | if string_options.contains(option_key) |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 67 | string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 68 | elif int_options.contains(option_key) |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 69 | int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 70 | else |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 71 | feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 72 | opt = opt.allowed().to_string() |
| 73 | endif |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 74 | summary(option_key, opt, section: 'Features') |
| 75 | endforeach |
| 76 | |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 77 | # Logging level |
| 78 | loglvlopt = get_option('bmcweb-logging') |
| 79 | if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 80 | # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled' |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 81 | loglvlopt = 'debug' |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 82 | endif |
Ed Tanous | e7245fe | 2023-07-24 17:01:38 -0700 | [diff] [blame] | 83 | loglvlopt = loglvlopt.to_upper() |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 84 | string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n' |
| 85 | |
| 86 | # NBD proxy is disabled due to lack of maintenance. See meson_options.txt |
| 87 | feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n' |
| 88 | |
| 89 | conf_data.set( |
| 90 | 'BMCWEB_OPTIONS', |
| 91 | string_options_string + int_options_string + feature_options_string, |
| 92 | ) |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 93 | |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 94 | conf_h_dep = declare_dependency( |
| 95 | include_directories: include_directories('.'), |
| 96 | sources: configure_file( |
| 97 | input: 'bmcweb_config.h.in', |
| 98 | output: 'bmcweb_config.h', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 99 | configuration: conf_data, |
| 100 | ), |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 101 | ) |
| 102 | |
| 103 | # Configure and install systemd unit files |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 104 | configure_file( |
| 105 | input: 'bmcweb.socket.in', |
| 106 | output: 'bmcweb.socket', |
| 107 | install_dir: systemd_system_unit_dir, |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 108 | install: true, |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 109 | configuration: configuration_data( |
| 110 | {'BMCWEB_HTTPS_PORT': get_option('https_port')}, |
| 111 | ), |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 112 | ) |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 113 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 114 | configure_file( |
| 115 | input: 'bmcweb.service.in', |
| 116 | output: 'bmcweb.service', |
| 117 | install_dir: systemd_system_unit_dir, |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 118 | install: true, |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 119 | configuration: configuration_data( |
| 120 | {'MESON_INSTALL_PREFIX': get_option('prefix')}, |
| 121 | ), |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 122 | ) |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 123 | |
| 124 | # Copy pam-webserver to etc/pam.d |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 125 | install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver') |