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