blob: 40bee7f689de528ddc35d151c8d8782f6aa4ed9a [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',
Ed Tanous25b54db2024-04-17 15:40:31 -07008 'experimental-http2',
Alexander Hansen6c58a032024-11-21 15:27:04 -08009 'experimental-redfish-dbus-log-subscription',
Ed Tanousf4225d72025-02-20 14:56:15 -080010 'experimental-redfish-multi-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070011 'google-api',
12 'host-serial-socket',
Gunnar Mills68896202024-08-21 11:34:20 -050013 'hypervisor-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070014 '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 Tanous25b54db2024-04-17 15:40:31 -070021 'kvm',
Ed Tanous3ce36882024-06-09 10:58:16 -070022 'meta-tls-common-name-parsing',
Ed Tanous25b54db2024-04-17 15:40:31 -070023 'mutual-tls-auth',
Ed Tanousf4225d72025-02-20 14:56:15 -080024 'redfish',
Ed Tanous25b54db2024-04-17 15:40:31 -070025 'redfish-aggregation',
26 'redfish-allow-deprecated-power-thermal',
Ed Tanous6a371402024-12-03 14:01:25 -080027 'redfish-allow-simple-update',
Ed Tanous25b54db2024-04-17 15:40:31 -070028 '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 Gill57855662024-04-17 10:44:27 -070036 'redfish-updateservice-use-dbus',
Ed Tanousf4225d72025-02-20 14:56:15 -080037 'redfish-use-3-digit-messageid',
Ed Tanous25b54db2024-04-17 15:40:31 -070038 'rest',
39 'session-auth',
40 'static-hosting',
41 'tests',
42 'vm-websocket',
43 'xtoken-auth',
44]
45
46string_options = [
47 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070048 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070049 'redfish-manager-uri-name',
50 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070051]
52
rohitpaicf9085a2025-02-24 12:33:59 +053053int_options = ['http-body-limit', 'watchdog-timeout-seconds']
Ed Tanous25b54db2024-04-17 15:40:31 -070054
Ed Tanous7e5e98d2025-03-12 10:34:24 -070055feature_options_string = '\n// Feature options\n'
Ed Tanousfe907df2024-05-07 16:37:09 -070056string_options_string = '\n// String options\n'
57int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070058
Ed Tanous25b54db2024-04-17 15:40:31 -070059
Ed Tanous7e5e98d2025-03-12 10:34:24 -070060foreach feature_type, feature_list : {
61 'Feature': feature_options,
62 'Numeric': int_options,
63 'String': string_options,
64}
65 summary_dict = {}
66 foreach option_key : feature_list
67 option_key_config = 'BMCWEB_' + option_key.to_upper()
68 option_key_config = option_key_config.replace('-', '_')
Ed Tanousfe907df2024-05-07 16:37:09 -070069
Ed Tanous7e5e98d2025-03-12 10:34:24 -070070 opt = get_option(option_key)
71 if feature_type == 'Feature'
72 opt = opt.allowed()
73 feature_options_string += 'constexpr const bool @0@=@1@;\n'.format(
74 option_key_config,
75 opt.to_string(),
76 )
77 endif
78 if feature_type == 'Numeric'
79 int_options_string += 'constexpr const int @0@=@1@;\n'.format(
80 option_key_config,
81 opt.to_string(),
82 )
83 endif
84 if feature_type == 'String'
85 string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format(
86 option_key_config,
87 opt,
88 )
89 endif
90 summary_dict += {option_key: opt}
91 endforeach
92 summary(summary_dict, section: feature_type + ' Options', bool_yn: true)
Ed Tanous25b54db2024-04-17 15:40:31 -070093endforeach
94
Myung Bae662aa6e2023-01-10 14:20:28 -060095# Logging level
96loglvlopt = get_option('bmcweb-logging')
97if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070098 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080099 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -0600100endif
Ed Tanouse7245fe2023-07-24 17:01:38 -0700101loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -0700102string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
103
104# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
Ed Tanous7e5e98d2025-03-12 10:34:24 -0700105feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
Ed Tanousfe907df2024-05-07 16:37:09 -0700106
107conf_data.set(
108 'BMCWEB_OPTIONS',
109 string_options_string + int_options_string + feature_options_string,
110)
Myung Bae662aa6e2023-01-10 14:20:28 -0600111
Nan Zhou307386e2022-10-12 20:29:34 +0000112conf_h_dep = declare_dependency(
113 include_directories: include_directories('.'),
114 sources: configure_file(
115 input: 'bmcweb_config.h.in',
116 output: 'bmcweb_config.h',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800117 configuration: conf_data,
118 ),
Nan Zhou307386e2022-10-12 20:29:34 +0000119)
120
121# Configure and install systemd unit files
Ed Tanous796ba932020-08-02 04:29:21 +0000122https_port = get_option('https_port')
123if https_port > 0
124 configure_file(
125 input: 'bmcweb.socket.in',
126 output: 'bmcweb.socket',
127 install_dir: systemd_system_unit_dir,
128 install: true,
129 configuration: configuration_data(
130 {
131 'BMCWEB_PORT': https_port,
132 'HTTP_LEVEL_ALLOWED': 'https',
133 'HTTP_AUTH_LEVEL': 'auth',
134 'HTTP_BIND': '',
135 },
136 ),
137 )
138endif
139
140ports = get_option('additional-ports')
141binds = get_option('additional-bind-to-device')
Janet Adkins58d3aab2025-02-19 14:45:43 -0600142auths = get_option('additional-auth')
Ed Tanous796ba932020-08-02 04:29:21 +0000143foreach index : range(ports.length())
144 port_number = ports[index]
145 bind_to_device = '0.0.0.0'
146 auth = 'auth'
147 if index < binds.length()
Janet Adkins58d3aab2025-02-19 14:45:43 -0600148 bind_to_device = binds[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000149 endif
150
Janet Adkins58d3aab2025-02-19 14:45:43 -0600151 if index < auths.length()
152 auth = auths[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000153 endif
154
Janet Adkins58d3aab2025-02-19 14:45:43 -0600155 filename = 'bmcweb_' + port_number
Ed Tanous796ba932020-08-02 04:29:21 +0000156 configure_file(
157 input: 'bmcweb.socket.in',
158 output: filename,
159 install_dir: systemd_system_unit_dir,
160 install: true,
161 configuration: configuration_data(
162 {
163 'BMCWEB_HTTPS_PORT': port_number,
164 'HTTP_LEVEL_ALLOWED': 'https',
Janet Adkins58d3aab2025-02-19 14:45:43 -0600165 'HTTP_BIND': bind_to_device,
Ed Tanous796ba932020-08-02 04:29:21 +0000166 'HTTP_AUTH_LEVEL': auth,
167 },
168 ),
169 )
170endforeach
Nan Zhou307386e2022-10-12 20:29:34 +0000171
Ed Tanousf2caadc2024-01-02 18:34:36 -0800172configure_file(
173 input: 'bmcweb.service.in',
174 output: 'bmcweb.service',
175 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800176 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700177 configuration: configuration_data(
rohitpaicf9085a2025-02-24 12:33:59 +0530178 {
179 'MESON_INSTALL_PREFIX': get_option('prefix'),
Roger G. Coscojuela38b3b6f2025-04-16 15:58:00 +0200180 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option(
181 'watchdog-timeout-seconds',
182 ),
rohitpaicf9085a2025-02-24 12:33:59 +0530183 },
Ed Tanous92e26be2024-08-21 13:39:14 -0700184 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800185)
Nan Zhou307386e2022-10-12 20:29:34 +0000186
187# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700188install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')