diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-09-01 00:13:46 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-09-12 13:45:43 -0400 |
commit | 214d03568f75fbd578cc97d46f48d5d882f3870b (patch) | |
tree | 745b2a5a8b038d78feed64bb49c2ae652d13ad70 /mesonbuild | |
parent | 3cddb0e5c6e2fbc71e64e5cbbacb3b88ad2ad816 (diff) | |
download | meson-214d03568f75fbd578cc97d46f48d5d882f3870b.zip meson-214d03568f75fbd578cc97d46f48d5d882f3870b.tar.gz meson-214d03568f75fbd578cc97d46f48d5d882f3870b.tar.bz2 |
new custom dependency lookup for iconv
Also internally needed by intl, so add that as a proxied dependency
instead of coding it manually.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/dependencies/__init__.py | 3 | ||||
-rw-r--r-- | mesonbuild/dependencies/misc.py | 30 |
2 files changed, 31 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py index bd90c90..ff0bd30 100644 --- a/mesonbuild/dependencies/__init__.py +++ b/mesonbuild/dependencies/__init__.py @@ -35,7 +35,7 @@ from .scalapack import scalapack_factory from .misc import ( BlocksDependency, OpenMPDependency, cups_factory, curses_factory, gpgme_factory, libgcrypt_factory, libwmf_factory, netcdf_factory, pcap_factory, python3_factory, - shaderc_factory, threads_factory, ThreadDependency, intl_factory, + shaderc_factory, threads_factory, ThreadDependency, iconv_factory, intl_factory, ) from .platform import AppleFrameworks from .qt import qt4_factory, qt5_factory, qt6_factory @@ -252,6 +252,7 @@ packages.update({ 'libgcrypt': libgcrypt_factory, 'gpgme': gpgme_factory, 'shaderc': shaderc_factory, + 'iconv': iconv_factory, 'intl': intl_factory, # From platform: diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index faf06a1..daa7dff 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -448,6 +448,25 @@ class CursesSystemDependency(SystemDependency): break +class IconvBuiltinDependency(BuiltinDependency): + def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]): + super().__init__(name, env, kwargs) + + if self.clib_compiler.has_function('iconv_open', '', env)[0]: + self.is_found = True + + +class IconvSystemDependency(SystemDependency): + def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]): + super().__init__(name, env, kwargs) + + h = self.clib_compiler.has_header('iconv.h', '', env) + self.link_args = self.clib_compiler.find_library('iconv', env, [], self.libtype) + + if h[0] and self.link_args: + self.is_found = True + + class IntlBuiltinDependency(BuiltinDependency): def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]): super().__init__(name, env, kwargs) @@ -467,7 +486,9 @@ class IntlSystemDependency(SystemDependency): self.is_found = True if self.static: - self.link_args += self.clib_compiler.find_library('iconv', env, [], self.libtype) + if not self._add_sub_dependency(iconv_factory(env, self.for_machine, {})): + self.is_found = False + return @factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.SYSTEM}) @@ -580,6 +601,13 @@ threads_factory = DependencyFactory( system_class=ThreadDependency, ) +iconv_factory = DependencyFactory( + 'iconv', + [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM], + builtin_class=IconvBuiltinDependency, + system_class=IconvSystemDependency, +) + intl_factory = DependencyFactory( 'intl', [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM], |