xref: /openbmc/bmcweb/config/meson.build (revision 6a37140a)
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    'experimental-redfish-dbus-log-subscription',
11    'google-api',
12    'host-serial-socket',
13    'hypervisor-computer-system',
14    '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',
21    'kvm',
22    'meta-tls-common-name-parsing',
23    'mutual-tls-auth',
24    'redfish-aggregation',
25    'redfish-allow-deprecated-power-thermal',
26    'redfish-allow-simple-update',
27    'redfish-use-3-digit-messageid',
28    'redfish-bmc-journal',
29    'redfish-cpu-log',
30    'redfish-dbus-log',
31    'redfish-dump-log',
32    'redfish-host-logger',
33    'redfish-new-powersubsystem-thermalsubsystem',
34    'redfish-oem-manager-fan-data',
35    'redfish-provisioning-feature',
36    'redfish-updateservice-use-dbus',
37    'redfish',
38    'rest',
39    'session-auth',
40    'static-hosting',
41    'tests',
42    'vm-websocket',
43    'xtoken-auth',
44]
45
46string_options = [
47    'dns-resolver',
48    'mutual-tls-common-name-parsing-default',
49    'redfish-manager-uri-name',
50    'redfish-system-uri-name',
51]
52
53int_options = ['http-body-limit']
54
55feature_options_string = '\n//Feature options\n'
56string_options_string = '\n// String options\n'
57int_options_string = '\n// Integer options\n'
58
59foreach option_key : feature_options + string_options + int_options
60    option_key_config = 'BMCWEB_' + option_key.to_upper()
61    option_key_config = option_key_config.replace('-', '_')
62
63    message(option_key_config)
64
65    opt = get_option(option_key)
66    if string_options.contains(option_key)
67        string_options_string += 'constexpr std::string_view  ' + option_key_config + ' = "' + opt + '";\n'
68    elif int_options.contains(option_key)
69        int_options_string += 'constexpr const int         ' + option_key_config + ' = ' + opt.to_string() + ';\n'
70    else
71        feature_options_string += 'constexpr const bool        ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
72        opt = opt.allowed().to_string()
73    endif
74    summary(option_key, opt, section: 'Features')
75endforeach
76
77# Logging level
78loglvlopt = get_option('bmcweb-logging')
79if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
80    # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
81    loglvlopt = 'debug'
82endif
83loglvlopt = loglvlopt.to_upper()
84string_options_string += 'constexpr std::string_view  BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
85
86# NBD proxy is disabled due to lack of maintenance.  See meson_options.txt
87feature_options_string += 'constexpr const bool        BMCWEB_VM_NBDPROXY = false;\n'
88
89conf_data.set(
90    'BMCWEB_OPTIONS',
91    string_options_string + int_options_string + feature_options_string,
92)
93
94conf_h_dep = declare_dependency(
95    include_directories: include_directories('.'),
96    sources: configure_file(
97        input: 'bmcweb_config.h.in',
98        output: 'bmcweb_config.h',
99        configuration: conf_data,
100    ),
101)
102
103# Configure and install systemd unit files
104configure_file(
105    input: 'bmcweb.socket.in',
106    output: 'bmcweb.socket',
107    install_dir: systemd_system_unit_dir,
108    install: true,
109    configuration: configuration_data(
110        {'BMCWEB_HTTPS_PORT': get_option('https_port')},
111    ),
112)
113
114configure_file(
115    input: 'bmcweb.service.in',
116    output: 'bmcweb.service',
117    install_dir: systemd_system_unit_dir,
118    install: true,
119    configuration: configuration_data(
120        {'MESON_INSTALL_PREFIX': get_option('prefix')},
121    ),
122)
123
124# Copy pam-webserver to etc/pam.d
125install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')
126