summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2022-08-05 00:24:49 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-10 05:34:54 +0000
commit2a470e69477e119cf7cb855b13f2aed01ae22b2e (patch)
treea19f850e5883460c59871f3d68f306de7e2c16c2 /SConstruct
parent10e65755f6a20afdedab57736d1b1648232a6194 (diff)
downloadmongo-2a470e69477e119cf7cb855b13f2aed01ae22b2e.tar.gz
SERVER-68474 added dwp files for split dwarf builds
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct61
1 files changed, 39 insertions, 22 deletions
diff --git a/SConstruct b/SConstruct
index 10aee4abbdd..93d2e562c7d 100755
--- a/SConstruct
+++ b/SConstruct
@@ -803,6 +803,16 @@ except ValueError as e:
Exit(1)
+def to_boolean(s):
+ if isinstance(s, bool):
+ return s
+ elif s.lower() in ('1', "on", "true", "yes"):
+ return True
+ elif s.lower() in ('0', "off", "false", "no"):
+ return False
+ raise ValueError(f'Invalid value {s}, must be a boolean-like string')
+
+
# Setup the command-line variables
def variable_shlex_converter(val):
# If the argument is something other than a string, propagate
@@ -836,6 +846,16 @@ def variable_arch_converter(val):
return val
+def split_dwarf_converter(val):
+ try:
+ return to_boolean(val)
+ except ValueError as exc:
+ if val.lower() != "auto":
+ raise ValueError(
+ f'Invalid SPLIT_DWARF value {s}, must be a boolean-like string or "auto"') from exc
+ return "auto"
+
+
# The Scons 'default' tool enables a lot of tools that we don't actually need to enable.
# On platforms like Solaris, it actually does the wrong thing by enabling the sunstudio
# toolchain first. As such it is simpler and more efficient to manually load the precise
@@ -1312,6 +1332,11 @@ env_vars.Add(
)
env_vars.Add(
+ 'SPLIT_DWARF',
+ help='Set the boolean (auto, on/off true/false 1/0) to enable gsplit-dwarf (non-Windows).',
+ converter=split_dwarf_converter, default="auto")
+
+env_vars.Add(
'TAPI',
help="Configures the path to the 'tapi' (an Xcode) utility",
)
@@ -1367,6 +1392,12 @@ env_vars.AddVariables(
("BUILD_METRICS_EVG_TASK_ID", "Evergreen task ID to add to build metrics data."),
("BUILD_METRICS_EVG_BUILD_VARIANT", "Evergreen build variant to add to build metrics data."),
)
+for tool in ['build_metrics', 'split_dwarf']:
+ try:
+ Tool(tool).options(env_vars)
+ except ImportError as exc:
+ print(f"Failed import while loading options for tool: {tool}\n{exc}")
+ pass
# -- Validate user provided options --
@@ -1592,17 +1623,6 @@ def conf_error(env, msg, *args):
env.AddMethod(fatal_error, 'FatalError')
env.AddMethod(conf_error, 'ConfError')
-
-def to_boolean(s):
- if isinstance(s, bool):
- return s
- elif s.lower() in ('1', "on", "true", "yes"):
- return True
- elif s.lower() in ('0', "off", "false", "no"):
- return False
- raise ValueError(f'Invalid value {s}, must be a boolean-like string')
-
-
# Normalize the VERBOSE Option, and make its value available as a
# function.
if env['VERBOSE'] == "auto":
@@ -1925,11 +1945,6 @@ if link_model == 'dynamic' and env.TargetOSIs(
Failed to detect macos version: {exc}
""") + macos_version_message)
-# TODO: SERVER-68475
-# temp fix for BF-25986, should be removed when better solution is found
-if env.ToolchainIs('gcc') and not link_model == "dynamic":
- env.Append(CCFLAGS=['-gsplit-dwarf'])
-
# libunwind configuration.
# In which the following globals are set and normalized to bool:
# - use_libunwind
@@ -5458,6 +5473,14 @@ if get_option('separate-debug') == "on" or env.TargetOSIs("windows"):
)
separate_debug(env)
+# TODO: SERVER-68475
+# temp fix for BF-25986, should be removed when better solution is found
+if env['SPLIT_DWARF'] == "auto":
+ env['SPLIT_DWARF'] = env.ToolchainIs('gcc') and not link_model == "dynamic"
+
+if env['SPLIT_DWARF']:
+ env.Tool('split_dwarf')
+
env["AUTO_ARCHIVE_TARBALL_SUFFIX"] = "tgz"
env["AIB_META_COMPONENT"] = "all"
@@ -5670,12 +5693,6 @@ elif env['PLATFORM'] == 'darwin':
env.Default(env.Alias("install-default"))
-# If the flags in the environment are configured for -gsplit-dwarf,
-# inject the necessary emitter.
-split_dwarf = Tool('split_dwarf')
-if split_dwarf.exists(env):
- split_dwarf(env)
-
# Load the compilation_db tool. We want to do this after configure so we don't end up with
# compilation database entries for the configure tests, which is weird.
if get_option('ninja') == 'disabled':