|
|
|
@ -404,6 +404,9 @@ class EnvironmentVariables: |
|
|
|
|
return env |
|
|
|
|
|
|
|
|
|
class Target: |
|
|
|
|
|
|
|
|
|
# TODO: should Target be an abc.ABCMeta? |
|
|
|
|
|
|
|
|
|
def __init__(self, name: str, subdir: str, subproject: str, build_by_default: bool, for_machine: MachineChoice): |
|
|
|
|
if has_path_sep(name): |
|
|
|
|
# Fix failing test 53 when this becomes an error. |
|
|
|
@ -443,7 +446,10 @@ a hard error in the future.'''.format(name)) |
|
|
|
|
return NotImplemented |
|
|
|
|
return self.get_id() >= other.get_id() |
|
|
|
|
|
|
|
|
|
def get_install_dir(self, environment): |
|
|
|
|
def get_default_install_dir(self, env: environment.Environment) -> str: |
|
|
|
|
raise NotImplementedError |
|
|
|
|
|
|
|
|
|
def get_install_dir(self, environment: environment.Environment) -> T.Tuple[T.Any, bool]: |
|
|
|
|
# Find the installation directory. |
|
|
|
|
default_install_dir = self.get_default_install_dir(environment) |
|
|
|
|
outdirs = self.get_custom_install_dir() |
|
|
|
@ -554,7 +560,7 @@ class BuildTarget(Target): |
|
|
|
|
self.external_deps = [] |
|
|
|
|
self.include_dirs = [] |
|
|
|
|
self.link_language = kwargs.get('link_language') |
|
|
|
|
self.link_targets = [] |
|
|
|
|
self.link_targets: T.List[BuildTarget] = [] |
|
|
|
|
self.link_whole_targets = [] |
|
|
|
|
self.link_depends = [] |
|
|
|
|
self.added_deps = set() |
|
|
|
@ -572,7 +578,7 @@ class BuildTarget(Target): |
|
|
|
|
self.pic = False |
|
|
|
|
self.pie = False |
|
|
|
|
# Track build_rpath entries so we can remove them at install time |
|
|
|
|
self.rpath_dirs_to_remove = set() |
|
|
|
|
self.rpath_dirs_to_remove: T.Set[bytes] = set() |
|
|
|
|
# Sources can be: |
|
|
|
|
# 1. Pre-existing source files in the source tree |
|
|
|
|
# 2. Pre-existing sources generated by configure_file in the build tree |
|
|
|
@ -884,7 +890,7 @@ class BuildTarget(Target): |
|
|
|
|
result.update(i.get_link_dep_subdirs()) |
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
def get_default_install_dir(self, environment): |
|
|
|
|
def get_default_install_dir(self, environment: environment.Environment) -> str: |
|
|
|
|
return environment.get_libdir() |
|
|
|
|
|
|
|
|
|
def get_custom_install_dir(self): |
|
|
|
@ -995,7 +1001,7 @@ This will become a hard error in a future Meson release.''') |
|
|
|
|
if not(os.path.isfile(trial)): |
|
|
|
|
raise InvalidArguments('Tried to add non-existing extra file {}.'.format(i)) |
|
|
|
|
self.extra_files = extra_files |
|
|
|
|
self.install_rpath = kwargs.get('install_rpath', '') |
|
|
|
|
self.install_rpath: str = kwargs.get('install_rpath', '') |
|
|
|
|
if not isinstance(self.install_rpath, str): |
|
|
|
|
raise InvalidArguments('Install_rpath is not a string.') |
|
|
|
|
self.build_rpath = kwargs.get('build_rpath', '') |
|
|
|
@ -1299,7 +1305,7 @@ You probably should put it in link_with instead.''') |
|
|
|
|
else: |
|
|
|
|
self.extra_args[language] = args |
|
|
|
|
|
|
|
|
|
def get_aliases(self): |
|
|
|
|
def get_aliases(self) -> T.Dict[str, str]: |
|
|
|
|
return {} |
|
|
|
|
|
|
|
|
|
def get_langs_used_by_deps(self) -> T.List[str]: |
|
|
|
@ -1673,7 +1679,7 @@ class Executable(BuildTarget): |
|
|
|
|
# Only linkwithable if using export_dynamic |
|
|
|
|
self.is_linkwithable = self.export_dynamic |
|
|
|
|
|
|
|
|
|
def get_default_install_dir(self, environment): |
|
|
|
|
def get_default_install_dir(self, environment: environment.Environment) -> str: |
|
|
|
|
return environment.get_bindir() |
|
|
|
|
|
|
|
|
|
def description(self): |
|
|
|
@ -1802,8 +1808,8 @@ class SharedLibrary(BuildTarget): |
|
|
|
|
self.basic_filename_tpl = '{0.prefix}{0.name}.{0.suffix}' |
|
|
|
|
self.determine_filenames(environment) |
|
|
|
|
|
|
|
|
|
def get_link_deps_mapping(self, prefix, environment): |
|
|
|
|
result = {} |
|
|
|
|
def get_link_deps_mapping(self, prefix, environment) -> T.Dict[str, str]: |
|
|
|
|
result: T.Dict[str, str] = {} |
|
|
|
|
mappings = self.get_transitive_link_deps_mapping(prefix, environment) |
|
|
|
|
old = get_target_macos_dylib_install_name(self) |
|
|
|
|
if old not in mappings: |
|
|
|
@ -2053,7 +2059,7 @@ class SharedLibrary(BuildTarget): |
|
|
|
|
def get_all_link_deps(self): |
|
|
|
|
return [self] + self.get_transitive_link_deps() |
|
|
|
|
|
|
|
|
|
def get_aliases(self): |
|
|
|
|
def get_aliases(self) -> T.Dict[str, str]: |
|
|
|
|
""" |
|
|
|
|
If the versioned library name is libfoo.so.0.100.0, aliases are: |
|
|
|
|
* libfoo.so.0 (soversion) -> libfoo.so.0.100.0 |
|
|
|
@ -2061,11 +2067,11 @@ class SharedLibrary(BuildTarget): |
|
|
|
|
Same for dylib: |
|
|
|
|
* libfoo.dylib (unversioned; for linking) -> libfoo.0.dylib |
|
|
|
|
""" |
|
|
|
|
aliases = {} |
|
|
|
|
aliases: T.Dict[str, str] = {} |
|
|
|
|
# Aliases are only useful with .so and .dylib libraries. Also if |
|
|
|
|
# there's no self.soversion (no versioning), we don't need aliases. |
|
|
|
|
if self.suffix not in ('so', 'dylib') or not self.soversion: |
|
|
|
|
return {} |
|
|
|
|
return aliases |
|
|
|
|
# With .so libraries, the minor and micro versions are also in the |
|
|
|
|
# filename. If ltversion != soversion we create an soversion alias: |
|
|
|
|
# libfoo.so.0 -> libfoo.so.0.100.0 |
|
|
|
|