1From c72a489e2eb13296c7b514b7341033114abf430a Mon Sep 17 00:00:00 2001 2From: Miroslav Lichvar <mlichvar@redhat.com> 3Date: Mon, 22 Apr 2024 11:31:24 +0200 4Subject: [PATCH 1/2] SConscript: provide variable names to MergeFlags 5 6If the scons MergeFlags() function is provided with a list of 7compiler/linker options, it needs to guess what options belong where. If 8it doesn't recognize an option, it is silently ignored. There are also 9ambiguous options that could be both in CFLAGS and LINKFLAGS (e.g. -spec). 10 11Provide MergeFlags() with a dict instead of list to avoid the guesswork 12in order to pass all options, even if some are not recognized by scons. 13Switch LDFLAGS to LINKFLAGS for better compatibility with existing 14scripts. 15 16Upstream-Status: Submitted [https://gitlab.com/gpsd/gpsd/-/merge_requests/406] 17Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> 18 19--- 20 SConscript | 11 ++++++----- 21 1 file changed, 6 insertions(+), 5 deletions(-) 22 23diff --git a/SConscript b/SConscript 24index dab481654..ee90d87c4 100644 25--- a/SConscript 26+++ b/SConscript 27@@ -585,8 +585,8 @@ env['SC_PYTHON'] = sys.executable # Path to SCons Python 28 # explicitly quote them or (better yet) use the "=" form of GNU option 29 # settings. 30 # 31-# Scons also uses different internal names than most other build-systems. 32-# So we rely on MergeFlags/ParseFlags to do the right thing for us. 33+# Scons also uses different internal names than most other build-systems, 34+# e.g. it uses LINKFLAGS instead of LDFLAGS. 35 # 36 # scons uses gcc, or clang, to link. Thus LDFLAGS does not serve its 37 # traditional function of providing arguments to ln. LDFLAGS set in the 38@@ -618,7 +618,10 @@ for i in ["ARFLAGS", 39 "SHLINKFLAGS", 40 ]: 41 if i in os.environ: 42- env.MergeFlags(Split(os.getenv(i))) 43+ t = i 44+ if t == "LDFLAGS": 45+ t = "LINKFLAGS" 46+ env.MergeFlags({t: Split(os.getenv(i))}) 47 48 49 # Keep scan-build options in the environment 50-- 51GitLab 52