diff options
author | Trevor Guidry <trevor.guidry@mongodb.com> | 2022-10-18 16:19:21 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-26 17:57:51 +0000 |
commit | 80b4fc675eae7aa5671d90e3e281272f616588a7 (patch) | |
tree | b90ccf0809fa5cfee90640a7abf2e231908446f3 /SConstruct | |
parent | 1b9a4e528e9c6b0bb8fbf1cb40b07021e11d231b (diff) | |
download | mongo-80b4fc675eae7aa5671d90e3e281272f616588a7.tar.gz |
SERVER-69507 only set rpath when link-model is dynamic
(cherry picked from commit eff572b7c1a78919e3d79957000a11e4d0dcf985)
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/SConstruct b/SConstruct index 450a309c6f5..5b11393eded 100644 --- a/SConstruct +++ b/SConstruct @@ -4965,7 +4965,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') @@ -4977,16 +4980,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. @@ -5007,12 +5012,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")) |