Remove options from configure file
Ideally, we should only have to declare meson options in one place, in
the meson_options.txt, and have all files generate from that list. This
patchset gets us one step closer, where we have to list options in 2
places, whereas previously it was 3.
Tested:
Code compiles. Manual inspection of generated bmcweb_config.h shows
only minor differences in generated file.
Change-Id: I4a4f863c95463e3cdf8b629de5a0a73f74cf001e
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/config/bmcweb.socket.in b/config/bmcweb.socket.in
index 68123f8..f2ffdb4 100644
--- a/config/bmcweb.socket.in
+++ b/config/bmcweb.socket.in
@@ -2,7 +2,7 @@
Description=BMC Webserver socket
[Socket]
-ListenStream=@HTTPS_PORT@
+ListenStream=@BMCWEB_HTTPS_PORT@
ReusePort=true
[Install]
diff --git a/config/bmcweb_config.h.in b/config/bmcweb_config.h.in
index adaf461..f5a1213 100644
--- a/config/bmcweb_config.h.in
+++ b/config/bmcweb_config.h.in
@@ -6,53 +6,7 @@
// clang-format off
// NOLINTBEGIN(readability-identifier-naming)
-// String params
-constexpr const std::string_view BMCWEB_LOGGING_LEVEL = "@LOGGING_LEVEL@";
-constexpr const std::string_view BMCWEB_MUTUAL_TLS_COMMON_NAME_PARSING = "@MUTUAL_TLS_COMMON_NAME_PARSING@";
-constexpr const std::string_view BMCWEB_DNS_RESOLVER = "@DNS_RESOLVER@";
-
-// Integer params
-constexpr const uint64_t BMCWEB_HTTP_BODY_LIMIT = @HTTP_BODY_LIMIT@;
-constexpr const uint16_t BMCWEB_HTTPS_PORT = @HTTPS_PORT@;
-
-// Feature Params
-constexpr const bool BMCWEB_BASIC_AUTH = @BASIC_AUTH@;
-constexpr const bool BMCWEB_COOKIE_AUTH = @COOKIE_AUTH@;
-constexpr const bool BMCWEB_EXPERIMENTAL_HTTP2 = @EXPERIMENTAL_HTTP2@;
-constexpr const bool BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM = @EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM@;
-constexpr const bool BMCWEB_HOST_SERIAL_SOCKET = @HOST_SERIAL_SOCKET@;
-constexpr const bool BMCWEB_INSECURE_DISABLE_AUTH = @INSECURE_DISABLE_AUTH@;
-constexpr const bool BMCWEB_INSECURE_DISABLE_CSRF = @INSECURE_DISABLE_CSRF@;
-constexpr const bool BMCWEB_INSECURE_DISABLE_SSL = @INSECURE_DISABLE_SSL@;
-constexpr const bool BMCWEB_INSECURE_ENABLE_REDFISH_QUERY = @INSECURE_ENABLE_REDFISH_QUERY@;
-constexpr const bool BMCWEB_INSECURE_IGNORE_CONTENT_TYPE = @INSECURE_IGNORE_CONTENT_TYPE@;
-constexpr const bool BMCWEB_INSECURE_PUSH_STYLE_NOTIFICATION = @INSECURE_PUSH_STYLE_NOTIFICATION@;
-constexpr const bool BMCWEB_INSECURE_TFTP_UPDATE = @INSECURE_TFTP_UPDATE@;
-constexpr const bool BMCWEB_KVM = @KVM@;
-constexpr const bool BMCWEB_MUTUAL_TLS_AUTH = @MUTUAL_TLS_AUTH@;
-constexpr const bool BMCWEB_REDFISH_AGGREGATION = @REDFISH_AGGREGATION@;
-constexpr const bool BMCWEB_REDFISH_ALLOW_DEPRECATED_POWER_THERMAL = @REDFISH_ALLOW_DEPRECATED_POWER_THERMAL@;
-constexpr const bool BMCWEB_REDFISH_BMC_JOURNAL = @REDFISH_BMC_JOURNAL@;
-constexpr const bool BMCWEB_REDFISH_CPU_LOG = @REDFISH_CPU_LOG@;
-constexpr const bool BMCWEB_REDFISH_DBUS_LOG = @REDFISH_DBUS_LOG@;
-constexpr const bool BMCWEB_REDFISH_DUMP_LOG = @REDFISH_DUMP_LOG@;
-constexpr const bool BMCWEB_REDFISH_HOST_LOGGER = @REDFISH_HOST_LOGGER@;
-constexpr const bool BMCWEB_REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM = @REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM@;
-constexpr const bool BMCWEB_REDFISH_OEM_MANAGER_FAN_DATA = @REDFISH_OEM_MANAGER_FAN_DATA@;
-constexpr const bool BMCWEB_REDFISH_PROVISIONING_FEATURE = @REDFISH_PROVISIONING_FEATURE@;
-constexpr const bool BMCWEB_REDFISH_UPDATESERVICE_USE_DBUS = @REDFISH_UPDATESERVICE_USE_DBUS@;
-constexpr const bool BMCWEB_REDFISH = @REDFISH@;
-constexpr const bool BMCWEB_REST = @REST@;
-constexpr const bool BMCWEB_SESSION_AUTH = @SESSION_AUTH@;
-constexpr const bool BMCWEB_STATIC_HOSTING = @STATIC_HOSTING@;
-constexpr const bool BMCWEB_TESTS = @TESTS@;
-constexpr const bool BMCWEB_VM_WEBSOCKET = @VM_WEBSOCKET@;
-constexpr const bool BMCWEB_VM_NBDPROXY = false;
-constexpr const bool BMCWEB_XTOKEN_AUTH = @XTOKEN_AUTH@;
-
-// Company specific params
-constexpr const bool BMCWEB_GOOGLE_API = @GOOGLE_API@;
-constexpr const bool BMCWEB_IBM_MANAGEMENT_CONSOLE = @IBM_MANAGEMENT_CONSOLE@;
+@BMCWEB_OPTIONS@
// NOLINTEND(readability-identifier-naming)
-// clang-format on
+// clang-format on
\ No newline at end of file
diff --git a/config/meson.build b/config/meson.build
index 9f66d0e..887c48d 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -5,13 +5,10 @@
feature_options = [
'basic-auth',
'cookie-auth',
- 'dns-resolver',
'experimental-http2',
'experimental-redfish-multi-computer-system',
'google-api',
'host-serial-socket',
- 'http-body-limit',
- 'https_port',
'ibm-management-console',
'insecure-disable-auth',
'insecure-disable-csrf',
@@ -22,7 +19,6 @@
'insecure-tftp-update',
'kvm',
'mutual-tls-auth',
- 'mutual-tls-common-name-parsing',
'redfish-aggregation',
'redfish-allow-deprecated-power-thermal',
'redfish-bmc-journal',
@@ -50,30 +46,30 @@
int_options = [
'http-body-limit',
- 'https_port',
]
-foreach option_key : feature_options
+feature_options_string = '\n//Feature options\n'
+string_options_string = '\n// String options\n'
+int_options_string = '\n// Integer options\n'
- option_key_config = option_key.to_upper()
+foreach option_key : feature_options + string_options + int_options
+ option_key_config = 'BMCWEB_' + option_key.to_upper()
option_key_config = option_key_config.replace('-', '_')
message(option_key_config)
+
opt = get_option(option_key)
if string_options.contains(option_key)
+ string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
elif int_options.contains(option_key)
+ int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
else
+ feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
opt = opt.allowed().to_string()
endif
- conf_data.set(option_key_config, opt)
summary(option_key, opt, section: 'Features')
endforeach
-conf_data.set('MESON_INSTALL_PREFIX', get_option('prefix'))
-
-conf_data.set10('BMCWEB_VIRTUAL_MEDIA_VM', get_option('vm-websocket').allowed())
-conf_data.set10('BMCWEB_VIRTUAL_MEDIA_NBD', false)
-
# Logging level
loglvlopt = get_option('bmcweb-logging')
if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
@@ -81,7 +77,15 @@
loglvlopt = 'debug'
endif
loglvlopt = loglvlopt.to_upper()
-conf_data.set('LOGGING_LEVEL', loglvlopt)
+string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
+
+# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
+feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
+
+conf_data.set(
+ 'BMCWEB_OPTIONS',
+ string_options_string + int_options_string + feature_options_string,
+)
conf_h_dep = declare_dependency(
include_directories: include_directories('.'),
@@ -93,21 +97,24 @@
)
# Configure and install systemd unit files
-
configure_file(
input: 'bmcweb.socket.in',
output: 'bmcweb.socket',
install_dir: systemd_system_unit_dir,
- configuration: conf_data,
install: true,
+ configuration: configuration_data({
+ 'BMCWEB_HTTPS_PORT': get_option('https_port'),
+ }),
)
configure_file(
input: 'bmcweb.service.in',
output: 'bmcweb.service',
install_dir: systemd_system_unit_dir,
- configuration: conf_data,
install: true,
+ configuration: configuration_data({
+ 'MESON_INSTALL_PREFIX': get_option('prefix'),
+ }),
)
# Copy pam-webserver to etc/pam.d