summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorTrevor Guidry <trevor.guidry@mongodb.com>2022-10-18 16:19:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-24 15:27:38 +0000
commitddf194c91328d8680890844babd9991462175d4a (patch)
treeaa17a1229e6fc925422817dae021adcd7e14d2df /SConstruct
parentd69115cf6b30532985ec49db1b9bc4236d461e6b (diff)
downloadmongo-ddf194c91328d8680890844babd9991462175d4a.tar.gz
SERVER-69507 only set rpath when link-model is dynamic
(cherry picked from commit eff572b7c1a78919e3d79957000a11e4d0dcf985)
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct17
1 files changed, 11 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct
index e00699eb055..b0b7fde7c28 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5158,7 +5158,10 @@ env.AddPackageNameAlias(
name="mh-debugsymbols",
)
-def rpath_generator(env, source, target, for_signature):
+env['RPATH_ESCAPED_DOLLAR_ORIGIN'] = '\\$$$$ORIGIN'
+
+
+def prefix_libdir_rpath_generator(env, source, target, for_signature):
# If the PREFIX_LIBDIR has an absolute path, we will use that directly as
# RPATH because that indicates the final install destination of the libraries.
prefix_libdir = env.subst('$PREFIX_LIBDIR')
@@ -5170,16 +5173,18 @@ def rpath_generator(env, source, target, for_signature):
lib_rel = os.path.relpath(prefix_libdir, env.subst('$PREFIX_BINDIR'))
if env['PLATFORM'] == 'posix':\
- return [env.Literal(f"\\$$ORIGIN/{lib_rel}")]
+ return f"$RPATH_ESCAPED_DOLLAR_ORIGIN/{lib_rel}"
if env['PLATFORM'] == 'darwin':
- return [f"@loader_path/{lib_rel}",]
+ return f"@loader_path/{lib_rel}"
+
-env['RPATH_GENERATOR'] = rpath_generator
+if get_option('link-model').startswith('dynamic'):
+ env['PREFIX_LIBDIR_RPATH_GENERATOR'] = prefix_libdir_rpath_generator
if env['PLATFORM'] == 'posix':
env.AppendUnique(
- RPATH='$RPATH_GENERATOR',
+ RPATH=['$PREFIX_LIBDIR_RPATH_GENERATOR'],
LINKFLAGS=[
# Most systems *require* -z,origin to make origin work, but android
# blows up at runtime if it finds DF_ORIGIN_1 in DT_FLAGS_1.
@@ -5200,12 +5205,12 @@ elif env['PLATFORM'] == 'darwin':
# so we setup RPATH and LINKFLAGS ourselves.
env['RPATHPREFIX'] = '-Wl,-rpath,'
env['RPATHSUFFIX'] = ''
- env['RPATH'] = '$RPATH_GENERATOR'
env.AppendUnique(
LINKFLAGS="${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}",
SHLINKFLAGS=[
"-Wl,-install_name,@rpath/${TARGET.file}",
],
+ RPATH=['$PREFIX_LIBDIR_RPATH_GENERATOR'],
)
env.Default(env.Alias("install-default"))