blob: 2387e131c432a4f6eaca231a5fd8c18267315d13 [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',
9 'experimental-redfish-multi-computer-system',
Alexander Hansen6c58a032024-11-21 15:27:04 -080010 'experimental-redfish-dbus-log-subscription',
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 Tanous25b54db2024-04-17 15:40:31 -070024 'redfish-aggregation',
25 'redfish-allow-deprecated-power-thermal',
Ed Tanous6a371402024-12-03 14:01:25 -080026 'redfish-allow-simple-update',
Ed Tanous56b81992024-12-02 10:36:37 -080027 'redfish-use-3-digit-messageid',
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 Tanous25b54db2024-04-17 15:40:31 -070037 'redfish',
38 '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
Ed Tanous92e26be2024-08-21 13:39:14 -070053int_options = ['http-body-limit']
Ed Tanous25b54db2024-04-17 15:40:31 -070054
Ed Tanousfe907df2024-05-07 16:37:09 -070055feature_options_string = '\n//Feature options\n'
56string_options_string = '\n// String options\n'
57int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070058
Ed Tanousfe907df2024-05-07 16:37:09 -070059foreach option_key : feature_options + string_options + int_options
60 option_key_config = 'BMCWEB_' + option_key.to_upper()
Ed Tanous25b54db2024-04-17 15:40:31 -070061 option_key_config = option_key_config.replace('-', '_')
62
63 message(option_key_config)
Ed Tanousfe907df2024-05-07 16:37:09 -070064
Ed Tanous25b54db2024-04-17 15:40:31 -070065 opt = get_option(option_key)
66 if string_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070067 string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070068 elif int_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070069 int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070070 else
Ed Tanousfe907df2024-05-07 16:37:09 -070071 feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070072 opt = opt.allowed().to_string()
73 endif
Ed Tanous25b54db2024-04-17 15:40:31 -070074 summary(option_key, opt, section: 'Features')
75endforeach
76
Myung Bae662aa6e2023-01-10 14:20:28 -060077# Logging level
78loglvlopt = get_option('bmcweb-logging')
79if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070080 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080081 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -060082endif
Ed Tanouse7245fe2023-07-24 17:01:38 -070083loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -070084string_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
87feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
88
89conf_data.set(
90 'BMCWEB_OPTIONS',
91 string_options_string + int_options_string + feature_options_string,
92)
Myung Bae662aa6e2023-01-10 14:20:28 -060093
Nan Zhou307386e2022-10-12 20:29:34 +000094conf_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 Tanousf2caadc2024-01-02 18:34:36 -080099 configuration: conf_data,
100 ),
Nan Zhou307386e2022-10-12 20:29:34 +0000101)
102
103# Configure and install systemd unit files
Ed Tanous796ba932020-08-02 04:29:21 +0000104https_port = get_option('https_port')
105if https_port > 0
106 configure_file(
107 input: 'bmcweb.socket.in',
108 output: 'bmcweb.socket',
109 install_dir: systemd_system_unit_dir,
110 install: true,
111 configuration: configuration_data(
112 {
113 'BMCWEB_PORT': https_port,
114 'HTTP_LEVEL_ALLOWED': 'https',
115 'HTTP_AUTH_LEVEL': 'auth',
116 'HTTP_BIND': '',
117 },
118 ),
119 )
120endif
121
122ports = get_option('additional-ports')
123binds = get_option('additional-bind-to-device')
Janet Adkins58d3aab2025-02-19 14:45:43 -0600124auths = get_option('additional-auth')
Ed Tanous796ba932020-08-02 04:29:21 +0000125foreach index : range(ports.length())
126 port_number = ports[index]
127 bind_to_device = '0.0.0.0'
128 auth = 'auth'
129 if index < binds.length()
Janet Adkins58d3aab2025-02-19 14:45:43 -0600130 bind_to_device = binds[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000131 endif
132
Janet Adkins58d3aab2025-02-19 14:45:43 -0600133 if index < auths.length()
134 auth = auths[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000135 endif
136
Janet Adkins58d3aab2025-02-19 14:45:43 -0600137 filename = 'bmcweb_' + port_number
Ed Tanous796ba932020-08-02 04:29:21 +0000138 configure_file(
139 input: 'bmcweb.socket.in',
140 output: filename,
141 install_dir: systemd_system_unit_dir,
142 install: true,
143 configuration: configuration_data(
144 {
145 'BMCWEB_HTTPS_PORT': port_number,
146 'HTTP_LEVEL_ALLOWED': 'https',
Janet Adkins58d3aab2025-02-19 14:45:43 -0600147 'HTTP_BIND': bind_to_device,
Ed Tanous796ba932020-08-02 04:29:21 +0000148 'HTTP_AUTH_LEVEL': auth,
149 },
150 ),
151 )
152endforeach
Nan Zhou307386e2022-10-12 20:29:34 +0000153
Ed Tanousf2caadc2024-01-02 18:34:36 -0800154configure_file(
155 input: 'bmcweb.service.in',
156 output: 'bmcweb.service',
157 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800158 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700159 configuration: configuration_data(
160 {'MESON_INSTALL_PREFIX': get_option('prefix')},
161 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800162)
Nan Zhou307386e2022-10-12 20:29:34 +0000163
164# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700165install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')