blob: d338b774a9a6420353a22af6fbfaa1a41bb60a73 [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',
26 'redfish-bmc-journal',
27 'redfish-cpu-log',
28 'redfish-dbus-log',
29 'redfish-dump-log',
30 'redfish-host-logger',
31 'redfish-new-powersubsystem-thermalsubsystem',
32 'redfish-oem-manager-fan-data',
33 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070034 'redfish-updateservice-use-dbus',
Ed Tanous25b54db2024-04-17 15:40:31 -070035 'redfish',
36 'rest',
37 'session-auth',
38 'static-hosting',
39 'tests',
40 'vm-websocket',
41 'xtoken-auth',
42]
43
44string_options = [
45 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070046 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070047 'redfish-manager-uri-name',
48 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070049]
50
Ed Tanous92e26be2024-08-21 13:39:14 -070051int_options = ['http-body-limit']
Ed Tanous25b54db2024-04-17 15:40:31 -070052
Ed Tanousfe907df2024-05-07 16:37:09 -070053feature_options_string = '\n//Feature options\n'
54string_options_string = '\n// String options\n'
55int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070056
Ed Tanousfe907df2024-05-07 16:37:09 -070057foreach option_key : feature_options + string_options + int_options
58 option_key_config = 'BMCWEB_' + option_key.to_upper()
Ed Tanous25b54db2024-04-17 15:40:31 -070059 option_key_config = option_key_config.replace('-', '_')
60
61 message(option_key_config)
Ed Tanousfe907df2024-05-07 16:37:09 -070062
Ed Tanous25b54db2024-04-17 15:40:31 -070063 opt = get_option(option_key)
64 if string_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070065 string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070066 elif int_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070067 int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070068 else
Ed Tanousfe907df2024-05-07 16:37:09 -070069 feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070070 opt = opt.allowed().to_string()
71 endif
Ed Tanous25b54db2024-04-17 15:40:31 -070072 summary(option_key, opt, section: 'Features')
73endforeach
74
Myung Bae662aa6e2023-01-10 14:20:28 -060075# Logging level
76loglvlopt = get_option('bmcweb-logging')
77if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070078 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080079 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -060080endif
Ed Tanouse7245fe2023-07-24 17:01:38 -070081loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -070082string_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
85feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
86
87conf_data.set(
88 'BMCWEB_OPTIONS',
89 string_options_string + int_options_string + feature_options_string,
90)
Myung Bae662aa6e2023-01-10 14:20:28 -060091
Nan Zhou307386e2022-10-12 20:29:34 +000092conf_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 Tanousf2caadc2024-01-02 18:34:36 -080097 configuration: conf_data,
98 ),
Nan Zhou307386e2022-10-12 20:29:34 +000099)
100
101# Configure and install systemd unit files
Ed Tanousf2caadc2024-01-02 18:34:36 -0800102configure_file(
103 input: 'bmcweb.socket.in',
104 output: 'bmcweb.socket',
105 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800106 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700107 configuration: configuration_data(
108 {'BMCWEB_HTTPS_PORT': get_option('https_port')},
109 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800110)
Nan Zhou307386e2022-10-12 20:29:34 +0000111
Ed Tanousf2caadc2024-01-02 18:34:36 -0800112configure_file(
113 input: 'bmcweb.service.in',
114 output: 'bmcweb.service',
115 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800116 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700117 configuration: configuration_data(
118 {'MESON_INSTALL_PREFIX': get_option('prefix')},
119 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800120)
Nan Zhou307386e2022-10-12 20:29:34 +0000121
122# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700123install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')