new custom dependency lookup for iconv

Also internally needed by intl, so add that as a proxied dependency
instead of coding it manually.
pull/9205/head
Eli Schwartz 3 years ago
parent 3cddb0e5c6
commit 214d03568f
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 9
      docs/markdown/Dependencies.md
  2. 8
      docs/markdown/snippets/iconv-dependency.md
  3. 3
      mesonbuild/dependencies/__init__.py
  4. 30
      mesonbuild/dependencies/misc.py

@ -453,6 +453,15 @@ language.
*New in 0.56.0* the dependencies now return proper dependency types
and `get_variable` and similar methods should work as expected.
## iconv
*(added 0.60.0)*
Provides access to the `iconv` family of C functions. On systems where this is
not built into libc, tries to find an external library providing them instead.
`method` may be `auto`, `builtin` or `system`.
## intl
*(added 0.59.0)*

@ -0,0 +1,8 @@
## New custom dependency for iconv
```
dependency('iconv')
```
will now check for the functionality of libiconv.so, but first check if it is
provided in the libc (for example in glibc or musl libc on Linux).

@ -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:

@ -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],

Loading…
Cancel
Save