xref: /openbmc/bmcweb/config/meson.build (revision 05ecd3a9)
1# Gather the Configuration data
2
3conf_data = configuration_data()
4
5feature_options = [
6    'basic-auth',
7    'cookie-auth',
8    'experimental-http2',
9    'experimental-redfish-multi-computer-system',
10    'google-api',
11    'host-serial-socket',
12    'hypervisor-computer-system',
13    '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',
20    'kvm',
21    'meta-tls-common-name-parsing',
22    'mutual-tls-auth',
23    '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',
33    'redfish-updateservice-use-dbus',
34    'redfish',
35    'rest',
36    'session-auth',
37    'static-hosting',
38    'tests',
39    'vm-websocket',
40    'xtoken-auth',
41]
42
43string_options = [
44    'dns-resolver',
45    'mutual-tls-common-name-parsing-default',
46    'redfish-manager-uri-name',
47    'redfish-system-uri-name',
48]
49
50int_options = [
51    'http-body-limit',
52]
53
54feature_options_string = '\n//Feature options\n'
55string_options_string = '\n// String options\n'
56int_options_string = '\n// Integer options\n'
57
58foreach option_key : feature_options + string_options + int_options
59    option_key_config = 'BMCWEB_' + option_key.to_upper()
60    option_key_config = option_key_config.replace('-', '_')
61
62    message(option_key_config)
63
64    opt = get_option(option_key)
65    if string_options.contains(option_key)
66        string_options_string += 'constexpr std::string_view  ' + option_key_config + ' = "' + opt + '";\n'
67    elif int_options.contains(option_key)
68        int_options_string += 'constexpr const int         ' + option_key_config + ' = ' + opt.to_string() + ';\n'
69    else
70        feature_options_string += 'constexpr const bool        ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
71        opt = opt.allowed().to_string()
72    endif
73    summary(option_key, opt, section: 'Features')
74endforeach
75
76# Logging level
77loglvlopt = get_option('bmcweb-logging')
78if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
79    # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
80    loglvlopt = 'debug'
81endif
82loglvlopt = loglvlopt.to_upper()
83string_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)
92
93conf_h_dep = declare_dependency(
94    include_directories: include_directories('.'),
95    sources: configure_file(
96        input: 'bmcweb_config.h.in',
97        output: 'bmcweb_config.h',
98        configuration: conf_data,
99    ),
100)
101
102# Configure and install systemd unit files
103configure_file(
104    input: 'bmcweb.socket.in',
105    output: 'bmcweb.socket',
106    install_dir: systemd_system_unit_dir,
107    install: true,
108    configuration: configuration_data({
109        'BMCWEB_HTTPS_PORT': get_option('https_port'),
110    }),
111)
112
113configure_file(
114    input: 'bmcweb.service.in',
115    output: 'bmcweb.service',
116    install_dir: systemd_system_unit_dir,
117    install: true,
118    configuration: configuration_data({
119        'MESON_INSTALL_PREFIX': get_option('prefix'),
120    }),
121)
122
123# Copy pam-webserver to etc/pam.d
124install_data(
125    'pam-webserver',
126    install_dir: '/etc/pam.d/',
127    rename: 'webserver',
128)
129