blob: 0f08bcf957b6a950c9464742e40b6b66090ebdc6 [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',
Gunnar Mills68896202024-08-21 11:34:20 -050012 'hypervisor-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070013 'ibm-management-console',
14 'insecure-disable-auth',
15 'insecure-disable-csrf',
16 'insecure-disable-ssl',
17 'insecure-enable-redfish-query',
18 'insecure-ignore-content-type',
19 'insecure-push-style-notification',
Ed Tanous25b54db2024-04-17 15:40:31 -070020 'kvm',
Ed Tanous3ce36882024-06-09 10:58:16 -070021 'meta-tls-common-name-parsing',
Ed Tanous25b54db2024-04-17 15:40:31 -070022 'mutual-tls-auth',
Ed Tanous25b54db2024-04-17 15:40:31 -070023 'redfish-aggregation',
24 'redfish-allow-deprecated-power-thermal',
25 'redfish-bmc-journal',
26 'redfish-cpu-log',
27 'redfish-dbus-log',
28 'redfish-dump-log',
29 'redfish-host-logger',
30 'redfish-new-powersubsystem-thermalsubsystem',
31 'redfish-oem-manager-fan-data',
32 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070033 'redfish-updateservice-use-dbus',
Ed Tanous25b54db2024-04-17 15:40:31 -070034 'redfish',
35 'rest',
36 'session-auth',
37 'static-hosting',
38 'tests',
39 'vm-websocket',
40 'xtoken-auth',
41]
42
43string_options = [
44 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070045 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070046 'redfish-manager-uri-name',
47 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070048]
49
Ed Tanous92e26be2024-08-21 13:39:14 -070050int_options = ['http-body-limit']
Ed Tanous25b54db2024-04-17 15:40:31 -070051
Ed Tanousfe907df2024-05-07 16:37:09 -070052feature_options_string = '\n//Feature options\n'
53string_options_string = '\n// String options\n'
54int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070055
Ed Tanousfe907df2024-05-07 16:37:09 -070056foreach option_key : feature_options + string_options + int_options
57 option_key_config = 'BMCWEB_' + option_key.to_upper()
Ed Tanous25b54db2024-04-17 15:40:31 -070058 option_key_config = option_key_config.replace('-', '_')
59
60 message(option_key_config)
Ed Tanousfe907df2024-05-07 16:37:09 -070061
Ed Tanous25b54db2024-04-17 15:40:31 -070062 opt = get_option(option_key)
63 if string_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070064 string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070065 elif int_options.contains(option_key)
Ed Tanousfe907df2024-05-07 16:37:09 -070066 int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070067 else
Ed Tanousfe907df2024-05-07 16:37:09 -070068 feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070069 opt = opt.allowed().to_string()
70 endif
Ed Tanous25b54db2024-04-17 15:40:31 -070071 summary(option_key, opt, section: 'Features')
72endforeach
73
Myung Bae662aa6e2023-01-10 14:20:28 -060074# Logging level
75loglvlopt = get_option('bmcweb-logging')
76if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070077 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080078 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -060079endif
Ed Tanouse7245fe2023-07-24 17:01:38 -070080loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -070081string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
82
83# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
84feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
85
86conf_data.set(
87 'BMCWEB_OPTIONS',
88 string_options_string + int_options_string + feature_options_string,
89)
Myung Bae662aa6e2023-01-10 14:20:28 -060090
Nan Zhou307386e2022-10-12 20:29:34 +000091conf_h_dep = declare_dependency(
92 include_directories: include_directories('.'),
93 sources: configure_file(
94 input: 'bmcweb_config.h.in',
95 output: 'bmcweb_config.h',
Ed Tanousf2caadc2024-01-02 18:34:36 -080096 configuration: conf_data,
97 ),
Nan Zhou307386e2022-10-12 20:29:34 +000098)
99
100# Configure and install systemd unit files
Ed Tanousf2caadc2024-01-02 18:34:36 -0800101configure_file(
102 input: 'bmcweb.socket.in',
103 output: 'bmcweb.socket',
104 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800105 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700106 configuration: configuration_data(
107 {'BMCWEB_HTTPS_PORT': get_option('https_port')},
108 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800109)
Nan Zhou307386e2022-10-12 20:29:34 +0000110
Ed Tanousf2caadc2024-01-02 18:34:36 -0800111configure_file(
112 input: 'bmcweb.service.in',
113 output: 'bmcweb.service',
114 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800115 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700116 configuration: configuration_data(
117 {'MESON_INSTALL_PREFIX': get_option('prefix')},
118 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800119)
Nan Zhou307386e2022-10-12 20:29:34 +0000120
121# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700122install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')