aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-11-23 23:03:35 +0100
committerGitHub <noreply@github.com>2020-11-24 00:03:35 +0200
commit0deab2ee9efc2ffe9e43f2787611e34656e6a304 (patch)
treefd60e29d4d91a6d566af3a0bfec1f8f6db0c2714 /mesonbuild/dependencies/base.py
parentb53505a9dc2e82a5040d3427246935c50b63184b (diff)
downloadmeson-0deab2ee9efc2ffe9e43f2787611e34656e6a304.zip
meson-0deab2ee9efc2ffe9e43f2787611e34656e6a304.tar.gz
meson-0deab2ee9efc2ffe9e43f2787611e34656e6a304.tar.bz2
compiler: allow non-built internal dependencies as arguments
Allow methods on the compiler object to receive internal dependencies, as long as they only specify compiler/linker arguments or other dependencies that satisfy the same requirements. This is useful if you're using internal dependencies to add special "-D" flags such as -DNCURSES_WIDECHAR, -D_XOPEN_SOURCE_EXTENDED or -DGLIB_STATIC_COMPILATION.
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r--mesonbuild/dependencies/base.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index ebe5b62..9026876 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -33,7 +33,7 @@ from .. import mlog
from .. import mesonlib
from ..compilers import clib_langs
from ..envconfig import get_env_var
-from ..environment import BinaryTable, Environment, MachineInfo
+from ..environment import Environment, MachineInfo
from ..cmake import CMakeExecutor, CMakeTraceParser, CMakeException, CMakeToolchain, CMakeExecScope, check_cmake_args
from ..mesonlib import MachineChoice, MesonException, OrderedSet, PerMachine
from ..mesonlib import Popen_safe, version_compare_many, version_compare, listify, stringlistify, extract_as_list, split_args
@@ -84,7 +84,7 @@ def find_external_program(env: Environment, for_machine: MachineChoice, name: st
potential_path = env.lookup_binary_entry(for_machine, name)
if potential_path is not None:
mlog.debug('{} binary for {} specified from cross file, native file, '
- 'or env var as {}'.format(display_name, for_machine, potential_path))
+ 'or env var as {}'.format(display_name, for_machine, potential_path))
yield ExternalProgram.from_entry(name, potential_path)
# We never fallback if the user-specified option is no good, so
# stop returning options.
@@ -132,6 +132,9 @@ class Dependency:
s = '<{0} {1}: {2}>'
return s.format(self.__class__.__name__, self.name, self.is_found)
+ def is_built(self) -> bool:
+ return False
+
def get_compile_args(self) -> T.List[str]:
if self.include_type == 'system':
converted = []
@@ -261,6 +264,11 @@ class InternalDependency(Dependency):
setattr(result, k, copy.deepcopy(v, memo))
return result
+ def is_built(self) -> bool:
+ if self.sources or self.libraries or self.whole_libraries:
+ return True
+ return any(d.is_built() for d in self.ext_deps)
+
def get_pkgconfig_variable(self, variable_name: str, kwargs: T.Dict[str, T.Any]) -> str:
raise DependencyException('Method "get_pkgconfig_variable()" is '
'invalid for an internal dependency')
@@ -665,7 +673,6 @@ class PkgConfigDependency(ExternalDependency):
env['PKG_CONFIG_LIBDIR'] = new_pkg_config_libdir
mlog.debug('PKG_CONFIG_LIBDIR: ' + new_pkg_config_libdir)
-
def _call_pkgbin(self, args, env=None):
# Always copy the environment since we're going to modify it
# with pkg-config variables