xref: /openbmc/bmcweb/config/meson.build (revision 92e26be5)
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 = ['http-body-limit']
51
52feature_options_string = '\n//Feature options\n'
53string_options_string = '\n// String options\n'
54int_options_string = '\n// Integer options\n'
55
56foreach option_key : feature_options + string_options + int_options
57    option_key_config = 'BMCWEB_' + option_key.to_upper()
58    option_key_config = option_key_config.replace('-', '_')
59
60    message(option_key_config)
61
62    opt = get_option(option_key)
63    if string_options.contains(option_key)
64        string_options_string += 'constexpr std::string_view  ' + option_key_config + ' = "' + opt + '";\n'
65    elif int_options.contains(option_key)
66        int_options_string += 'constexpr const int         ' + option_key_config + ' = ' + opt.to_string() + ';\n'
67    else
68        feature_options_string += 'constexpr const bool        ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
69        opt = opt.allowed().to_string()
70    endif
71    summary(option_key, opt, section: 'Features')
72endforeach
73
74# Logging level
75loglvlopt = get_option('bmcweb-logging')
76if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
77    # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
78    loglvlopt = 'debug'
79endif
80loglvlopt = loglvlopt.to_upper()
81string_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)
90
91conf_h_dep = declare_dependency(
92    include_directories: include_directories('.'),
93    sources: configure_file(
94        input: 'bmcweb_config.h.in',
95        output: 'bmcweb_config.h',
96        configuration: conf_data,
97    ),
98)
99
100# Configure and install systemd unit files
101configure_file(
102    input: 'bmcweb.socket.in',
103    output: 'bmcweb.socket',
104    install_dir: systemd_system_unit_dir,
105    install: true,
106    configuration: configuration_data(
107        {'BMCWEB_HTTPS_PORT': get_option('https_port')},
108    ),
109)
110
111configure_file(
112    input: 'bmcweb.service.in',
113    output: 'bmcweb.service',
114    install_dir: systemd_system_unit_dir,
115    install: true,
116    configuration: configuration_data(
117        {'MESON_INSTALL_PREFIX': get_option('prefix')},
118    ),
119)
120
121# Copy pam-webserver to etc/pam.d
122install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')
123