diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-19 19:19:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 19:19:29 +0200 |
commit | 321774d715f47b3bd3a2e240e0a190dfad7bd22d (patch) | |
tree | 0c9f22d4cee7c1d3a85dde4694b0739d1e4e916f /mesonbuild | |
parent | 00104b1081cd5076451d83524f4f9bfa75750cf6 (diff) | |
parent | b8294b4436f7a187cd8cfae02554ce0140428e78 (diff) | |
download | meson-321774d715f47b3bd3a2e240e0a190dfad7bd22d.zip meson-321774d715f47b3bd3a2e240e0a190dfad7bd22d.tar.gz meson-321774d715f47b3bd3a2e240e0a190dfad7bd22d.tar.bz2 |
Merge pull request #6789 from dcbaker/deprecated-c-ld
Make linker selection environment variables match docs
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/mixins/gnu.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 4 | ||||
-rw-r--r-- | mesonbuild/envconfig.py | 30 |
3 files changed, 27 insertions, 11 deletions
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index ae4b7db..4c8ca0b 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -304,6 +304,10 @@ class GnuLikeCompiler(metaclass=abc.ABCMeta): @classmethod def use_linker_args(cls, linker: str) -> T.List[str]: + if linker not in {'gold', 'bfd', 'lld'}: + raise mesonlib.MesonException( + 'Unsupported linker, only bfd, gold, and lld are supported, ' + 'not {}.'.format(linker)) return ['-fuse-ld={}'.format(linker)] diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 44aefc8..d0004ce 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -366,10 +366,6 @@ class VisualStudioLikeCompiler(metaclass=abc.ABCMeta): def get_argument_syntax(self) -> str: return 'msvc' - @classmethod - def use_linker_args(cls, linker: str) -> T.List[str]: - return [] - class MSVCCompiler(VisualStudioLikeCompiler): 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 |