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