aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/envconfig.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-03-12 10:55:58 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-03-17 10:40:39 -0700
commit9074c7f8a43e6a50ff255a9974adc20887a3001f (patch)
tree014a1e95737d4eae9aab4ffe76849519c0beca54 /mesonbuild/envconfig.py
parent0fa70325ed479cc4d61755dd376a8b7ce5a12db0 (diff)
downloadmeson-9074c7f8a43e6a50ff255a9974adc20887a3001f.zip
meson-9074c7f8a43e6a50ff255a9974adc20887a3001f.tar.gz
meson-9074c7f8a43e6a50ff255a9974adc20887a3001f.tar.bz2
envconfig: Make compiler and linker environment variables match
Diffstat (limited to 'mesonbuild/envconfig.py')
-rw-r--r--mesonbuild/envconfig.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index 3e5e44b..8587842 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -317,11 +317,11 @@ class BinaryTable(HasEnvVarFallback):
# Linkers
'c_ld': 'CC_LD',
'cpp_ld': 'CXX_LD',
- 'd_ld': 'D_LD',
- 'fortran_ld': 'F_LD',
+ 'd_ld': 'DC_LD',
+ 'fortran_ld': 'FC_LD',
'objc_ld': 'OBJC_LD',
- 'objcpp_ld': 'OBJCPP_LD',
- 'rust_ld': 'RUST_LD',
+ 'objcpp_ld': 'OBJCXX_LD',
+ 'rust_ld': 'RUSTC_LD',
# Binutils
'strip': 'STRIP',
@@ -334,6 +334,15 @@ class BinaryTable(HasEnvVarFallback):
'pkgconfig': 'PKG_CONFIG',
} # type: T.Dict[str, str]
+ # Deprecated environment variables mapped from the new variable to the old one
+ # Deprecated in 0.54.0
+ DEPRECATION_MAP = {
+ 'DC_LD': 'D_LD',
+ 'FC_LD': 'F_LD',
+ 'RUSTC_LD': 'RUST_LD',
+ 'OBJCXX_LD': 'OBJCPP_LD',
+ } # type: T.Dict[str, str]
+
@staticmethod
def detect_ccache() -> T.List[str]:
try:
@@ -362,12 +371,10 @@ This is probably wrong, it should always point to the native compiler.''' % evar
return compiler, ccache
def lookup_entry(self, name: str) -> T.Optional[T.List[str]]:
- """Lookup binaryk
+ """Lookup binary in cross/native file and fallback to environment.
Returns command with args as list if found, Returns `None` if nothing is
found.
-
- First tries looking in explicit map, then tries environment variable.
"""
# Try explicit map, don't fall back on env var
command = self.binaries.get(name)
@@ -380,9 +387,18 @@ This is probably wrong, it should always point to the native compiler.''' % evar
# Relies on there being no "" env var
evar = self.evarMap.get(name, "")
command = os.environ.get(evar)
+ if command is None:
+ deprecated = self.DEPRECATION_MAP.get(evar)
+ if deprecated:
+ command = os.environ.get(deprecated)
+ if command:
+ mlog.deprecation(
+ 'The', deprecated, 'environment variable is deprecated in favor of',
+ evar, once=True)
if command is not None:
command = split_args(command)
+
# Do not return empty or blank string entries
if command is not None and (len(command) == 0 or len(command[0].strip()) == 0):
return None