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