blob: be54d2db955faf0d274b0d9e9335e615a7795881 [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 Tanous56b81992024-12-02 10:36:37 -080026 'redfish-use-3-digit-messageid',
Ed Tanous25b54db2024-04-17 15:40:31 -070027 'redfish-bmc-journal',
28 'redfish-cpu-log',
29 'redfish-dbus-log',
30 'redfish-dump-log',
31 'redfish-host-logger',
32 'redfish-new-powersubsystem-thermalsubsystem',
33 'redfish-oem-manager-fan-data',
34 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070035 'redfish-updateservice-use-dbus',
Ed Tanous25b54db2024-04-17 15:40:31 -070036 'redfish',
37 'rest',
38 'session-auth',
39 'static-hosting',
40 'tests',
41 'vm-websocket',
42 'xtoken-auth',
43]
44
45string_options = [
46 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070047 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070048 'redfish-manager-uri-name',
49 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070050]
51
Ed Tanous92e26be2024-08-21 13:39:14 -070052int_options = ['http-body-limit']
Ed Tanous25b54db2024-04-17 15:40:31 -070053
Ed Tanousfe907df2024-05-07 16:37:09 -070054feature_options_string = '\n//Feature options\n'
55string_options_string = '\n// String options\n'
56int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070057
Ed Tanousfe907df2024-05-07 16:37:09 -070058foreach option_key : feature_options + string_options + int_options
59 option_key_config = 'BMCWEB_' + option_key.to_upper()
Ed Tanous25b54db2024-04-17 15:40:31 -070060 option_key_config = option_key_config.replace('-', '_')
61
62 message(option_key_config)
Ed Tanousfe907df2024-05-07 16:37:09 -070063
Ed Tanous25b54db2024-04-17 15:40:31 -070064 opt = get_option(option_key)
65 if string_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070066 string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070067 elif int_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070068 int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070069 else
Ed Tanousfe907df2024-05-07 16:37:09 -070070 feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070071 opt = opt.allowed().to_string()
72 endif
Ed Tanous25b54db2024-04-17 15:40:31 -070073 summary(option_key, opt, section: 'Features')
74endforeach
75
Myung Bae662aa6e2023-01-10 14:20:28 -060076# Logging level
77loglvlopt = get_option('bmcweb-logging')
78if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070079 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080080 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -060081endif
Ed Tanouse7245fe2023-07-24 17:01:38 -070082loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -070083string_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
86feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
87
88conf_data.set(
89 'BMCWEB_OPTIONS',
90 string_options_string + int_options_string + feature_options_string,
91)
Myung Bae662aa6e2023-01-10 14:20:28 -060092
Nan Zhou307386e2022-10-12 20:29:34 +000093conf_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 Tanousf2caadc2024-01-02 18:34:36 -080098 configuration: conf_data,
99 ),
Nan Zhou307386e2022-10-12 20:29:34 +0000100)
101
102# Configure and install systemd unit files
Ed Tanousf2caadc2024-01-02 18:34:36 -0800103configure_file(
104 input: 'bmcweb.socket.in',
105 output: 'bmcweb.socket',
106 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800107 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700108 configuration: configuration_data(
109 {'BMCWEB_HTTPS_PORT': get_option('https_port')},
110 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800111)
Nan Zhou307386e2022-10-12 20:29:34 +0000112
Ed Tanousf2caadc2024-01-02 18:34:36 -0800113configure_file(
114 input: 'bmcweb.service.in',
115 output: 'bmcweb.service',
116 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800117 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700118 configuration: configuration_data(
119 {'MESON_INSTALL_PREFIX': get_option('prefix')},
120 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800121)
Nan Zhou307386e2022-10-12 20:29:34 +0000122
123# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700124install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')