blob: d4c449906b20f593a504102d612615e36968668f [file] [log] [blame]
Nan Zhou307386e2022-10-12 20:29:34 +00001# Gather the Configuration data
2
3conf_data = configuration_data()
Ed Tanous25b54db2024-04-17 15:40:31 -07004
5feature_options = [
6 'basic-auth',
7 'cookie-auth',
Alexander Hansen6c58a032024-11-21 15:27:04 -08008 'experimental-redfish-dbus-log-subscription',
Ed Tanousf4225d72025-02-20 14:56:15 -08009 'experimental-redfish-multi-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070010 'google-api',
11 'host-serial-socket',
Ed Tanousb2539062024-03-12 16:58:35 -070012 'http-zstd',
Ed Tanous39fe3af2025-02-17 11:34:12 -080013 'http2',
Gunnar Mills68896202024-08-21 11:34:20 -050014 'hypervisor-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070015 'ibm-management-console',
16 'insecure-disable-auth',
17 'insecure-disable-csrf',
18 'insecure-disable-ssl',
19 'insecure-enable-redfish-query',
20 'insecure-ignore-content-type',
21 'insecure-push-style-notification',
Ed Tanous25b54db2024-04-17 15:40:31 -070022 'kvm',
23 'mutual-tls-auth',
Ed Tanousf4225d72025-02-20 14:56:15 -080024 'redfish',
Ed Tanous25b54db2024-04-17 15:40:31 -070025 'redfish-aggregation',
Janet Adkinsf664fd82025-07-23 14:01:43 -050026 'redfish-allow-deprecated-indicatorled',
Ed Tanous25b54db2024-04-17 15:40:31 -070027 'redfish-allow-deprecated-power-thermal',
Ed Tanous6a371402024-12-03 14:01:25 -080028 'redfish-allow-simple-update',
Ed Tanous25b54db2024-04-17 15:40:31 -070029 'redfish-bmc-journal',
30 'redfish-cpu-log',
31 'redfish-dbus-log',
32 'redfish-dump-log',
33 'redfish-host-logger',
34 'redfish-new-powersubsystem-thermalsubsystem',
35 'redfish-oem-manager-fan-data',
36 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070037 'redfish-updateservice-use-dbus',
Ed Tanousf4225d72025-02-20 14:56:15 -080038 'redfish-use-3-digit-messageid',
Ed Tanous25b54db2024-04-17 15:40:31 -070039 'rest',
40 'session-auth',
41 'static-hosting',
42 'tests',
43 'vm-websocket',
44 'xtoken-auth',
45]
46
47string_options = [
48 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070049 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070050 'redfish-manager-uri-name',
51 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070052]
53
rohitpaicf9085a2025-02-24 12:33:59 +053054int_options = ['http-body-limit', 'watchdog-timeout-seconds']
Ed Tanous25b54db2024-04-17 15:40:31 -070055
Ed Tanous7e5e98d2025-03-12 10:34:24 -070056feature_options_string = '\n// Feature options\n'
Ed Tanousfe907df2024-05-07 16:37:09 -070057string_options_string = '\n// String options\n'
58int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070059
Ed Tanous25b54db2024-04-17 15:40:31 -070060
Ed Tanous7e5e98d2025-03-12 10:34:24 -070061foreach feature_type, feature_list : {
62 'Feature': feature_options,
63 'Numeric': int_options,
64 'String': string_options,
65}
66 summary_dict = {}
67 foreach option_key : feature_list
68 option_key_config = 'BMCWEB_' + option_key.to_upper()
69 option_key_config = option_key_config.replace('-', '_')
Ed Tanousfe907df2024-05-07 16:37:09 -070070
Ed Tanous7e5e98d2025-03-12 10:34:24 -070071 opt = get_option(option_key)
72 if feature_type == 'Feature'
73 opt = opt.allowed()
74 feature_options_string += 'constexpr const bool @0@=@1@;\n'.format(
75 option_key_config,
76 opt.to_string(),
77 )
78 endif
79 if feature_type == 'Numeric'
80 int_options_string += 'constexpr const int @0@=@1@;\n'.format(
81 option_key_config,
82 opt.to_string(),
83 )
84 endif
85 if feature_type == 'String'
86 string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format(
87 option_key_config,
88 opt,
89 )
90 endif
91 summary_dict += {option_key: opt}
92 endforeach
93 summary(summary_dict, section: feature_type + ' Options', bool_yn: true)
Ed Tanous25b54db2024-04-17 15:40:31 -070094endforeach
95
Myung Bae662aa6e2023-01-10 14:20:28 -060096# Logging level
97loglvlopt = get_option('bmcweb-logging')
98if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070099 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -0800100 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -0600101endif
Ed Tanouse7245fe2023-07-24 17:01:38 -0700102loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -0700103string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
104
105# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
Ed Tanous7e5e98d2025-03-12 10:34:24 -0700106feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
Ed Tanousfe907df2024-05-07 16:37:09 -0700107
108conf_data.set(
109 'BMCWEB_OPTIONS',
110 string_options_string + int_options_string + feature_options_string,
111)
Myung Bae662aa6e2023-01-10 14:20:28 -0600112
Nan Zhou307386e2022-10-12 20:29:34 +0000113conf_h_dep = declare_dependency(
114 include_directories: include_directories('.'),
115 sources: configure_file(
116 input: 'bmcweb_config.h.in',
117 output: 'bmcweb_config.h',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800118 configuration: conf_data,
119 ),
Nan Zhou307386e2022-10-12 20:29:34 +0000120)
121
122# Configure and install systemd unit files
Ed Tanous796ba932020-08-02 04:29:21 +0000123https_port = get_option('https_port')
124if https_port > 0
125 configure_file(
126 input: 'bmcweb.socket.in',
127 output: 'bmcweb.socket',
128 install_dir: systemd_system_unit_dir,
129 install: true,
130 configuration: configuration_data(
131 {
132 'BMCWEB_PORT': https_port,
133 'HTTP_LEVEL_ALLOWED': 'https',
134 'HTTP_AUTH_LEVEL': 'auth',
135 'HTTP_BIND': '',
136 },
137 ),
138 )
139endif
140
141ports = get_option('additional-ports')
142binds = get_option('additional-bind-to-device')
Janet Adkins58d3aab2025-02-19 14:45:43 -0600143auths = get_option('additional-auth')
Ed Tanous796ba932020-08-02 04:29:21 +0000144foreach index : range(ports.length())
145 port_number = ports[index]
146 bind_to_device = '0.0.0.0'
147 auth = 'auth'
148 if index < binds.length()
Janet Adkins58d3aab2025-02-19 14:45:43 -0600149 bind_to_device = binds[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000150 endif
151
Janet Adkins58d3aab2025-02-19 14:45:43 -0600152 if index < auths.length()
153 auth = auths[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000154 endif
155
Janet Adkins58d3aab2025-02-19 14:45:43 -0600156 filename = 'bmcweb_' + port_number
Ed Tanous796ba932020-08-02 04:29:21 +0000157 configure_file(
158 input: 'bmcweb.socket.in',
159 output: filename,
160 install_dir: systemd_system_unit_dir,
161 install: true,
162 configuration: configuration_data(
163 {
164 'BMCWEB_HTTPS_PORT': port_number,
165 'HTTP_LEVEL_ALLOWED': 'https',
Janet Adkins58d3aab2025-02-19 14:45:43 -0600166 'HTTP_BIND': bind_to_device,
Ed Tanous796ba932020-08-02 04:29:21 +0000167 'HTTP_AUTH_LEVEL': auth,
168 },
169 ),
170 )
171endforeach
Nan Zhou307386e2022-10-12 20:29:34 +0000172
Ed Tanousf2caadc2024-01-02 18:34:36 -0800173configure_file(
174 input: 'bmcweb.service.in',
175 output: 'bmcweb.service',
176 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800177 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700178 configuration: configuration_data(
rohitpaicf9085a2025-02-24 12:33:59 +0530179 {
180 'MESON_INSTALL_PREFIX': get_option('prefix'),
Roger G. Coscojuela38b3b6f2025-04-16 15:58:00 +0200181 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option(
182 'watchdog-timeout-seconds',
183 ),
rohitpaicf9085a2025-02-24 12:33:59 +0530184 },
Ed Tanous92e26be2024-08-21 13:39:14 -0700185 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800186)
Nan Zhou307386e2022-10-12 20:29:34 +0000187
188# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700189install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')