blob: 887c48d495d31f2a7fee97d9cde07412a23aab9b [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',
10 'google-api',
11 'host-serial-socket',
Ed Tanous25b54db2024-04-17 15:40:31 -070012 'ibm-management-console',
13 'insecure-disable-auth',
14 'insecure-disable-csrf',
15 'insecure-disable-ssl',
16 'insecure-enable-redfish-query',
17 'insecure-ignore-content-type',
18 'insecure-push-style-notification',
19 'insecure-tftp-update',
20 'kvm',
21 'mutual-tls-auth',
Ed Tanous25b54db2024-04-17 15:40:31 -070022 'redfish-aggregation',
23 'redfish-allow-deprecated-power-thermal',
24 'redfish-bmc-journal',
25 'redfish-cpu-log',
26 'redfish-dbus-log',
27 'redfish-dump-log',
28 'redfish-host-logger',
29 'redfish-new-powersubsystem-thermalsubsystem',
30 'redfish-oem-manager-fan-data',
31 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070032 'redfish-updateservice-use-dbus',
Ed Tanous25b54db2024-04-17 15:40:31 -070033 'redfish',
34 'rest',
35 'session-auth',
36 'static-hosting',
37 'tests',
38 'vm-websocket',
39 'xtoken-auth',
40]
41
42string_options = [
43 'dns-resolver',
44 'mutual-tls-common-name-parsing',
45]
46
47int_options = [
48 'http-body-limit',
Ed Tanous25b54db2024-04-17 15:40:31 -070049]
50
Ed Tanousfe907df2024-05-07 16:37:09 -070051feature_options_string = '\n//Feature options\n'
52string_options_string = '\n// String options\n'
53int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070054
Ed Tanousfe907df2024-05-07 16:37:09 -070055foreach option_key : feature_options + string_options + int_options
56 option_key_config = 'BMCWEB_' + option_key.to_upper()
Ed Tanous25b54db2024-04-17 15:40:31 -070057 option_key_config = option_key_config.replace('-', '_')
58
59 message(option_key_config)
Ed Tanousfe907df2024-05-07 16:37:09 -070060
Ed Tanous25b54db2024-04-17 15:40:31 -070061 opt = get_option(option_key)
62 if string_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070063 string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070064 elif int_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070065 int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070066 else
Ed Tanousfe907df2024-05-07 16:37:09 -070067 feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070068 opt = opt.allowed().to_string()
69 endif
Ed Tanous25b54db2024-04-17 15:40:31 -070070 summary(option_key, opt, section: 'Features')
71endforeach
72
Myung Bae662aa6e2023-01-10 14:20:28 -060073# Logging level
74loglvlopt = get_option('bmcweb-logging')
75if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070076 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080077 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -060078endif
Ed Tanouse7245fe2023-07-24 17:01:38 -070079loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -070080string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
81
82# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
83feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
84
85conf_data.set(
86 'BMCWEB_OPTIONS',
87 string_options_string + int_options_string + feature_options_string,
88)
Myung Bae662aa6e2023-01-10 14:20:28 -060089
Nan Zhou307386e2022-10-12 20:29:34 +000090conf_h_dep = declare_dependency(
91 include_directories: include_directories('.'),
92 sources: configure_file(
93 input: 'bmcweb_config.h.in',
94 output: 'bmcweb_config.h',
Ed Tanousf2caadc2024-01-02 18:34:36 -080095 configuration: conf_data,
96 ),
Nan Zhou307386e2022-10-12 20:29:34 +000097)
98
99# Configure and install systemd unit files
Ed Tanousf2caadc2024-01-02 18:34:36 -0800100configure_file(
101 input: 'bmcweb.socket.in',
102 output: 'bmcweb.socket',
103 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800104 install: true,
Ed Tanousfe907df2024-05-07 16:37:09 -0700105 configuration: configuration_data({
106 'BMCWEB_HTTPS_PORT': get_option('https_port'),
107 }),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800108)
Nan Zhou307386e2022-10-12 20:29:34 +0000109
Ed Tanousf2caadc2024-01-02 18:34:36 -0800110configure_file(
111 input: 'bmcweb.service.in',
112 output: 'bmcweb.service',
113 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800114 install: true,
Ed Tanousfe907df2024-05-07 16:37:09 -0700115 configuration: configuration_data({
116 'MESON_INSTALL_PREFIX': get_option('prefix'),
117 }),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800118)
Nan Zhou307386e2022-10-12 20:29:34 +0000119
120# Copy pam-webserver to etc/pam.d
Ed Tanous0a9c11e2023-05-25 14:32:49 -0700121install_data(
Ed Tanousf2caadc2024-01-02 18:34:36 -0800122 'pam-webserver',
123 install_dir: '/etc/pam.d/',
124 rename: 'webserver',
Ed Tanous0a9c11e2023-05-25 14:32:49 -0700125)