aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-06-13 13:45:15 -0400
committerEli Schwartz <eschwartz@archlinux.org>2021-06-17 13:22:25 -0400
commit2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648 (patch)
tree9bdcb39277363de6d67c91ade68416618a4d556d /mesonbuild
parentad206037e321237bc664227764a5b3fe6243c554 (diff)
downloadmeson-2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648.zip
meson-2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648.tar.gz
meson-2c6ccfe4c40741ae1f15f073f7d7bc8c398a1648.tar.bz2
intl custom dependency
Checking how to aquire the *gettext family of symbols portably is annoyingly complex, and may come from the libc, or standalone. builtin dependency: This detects if libintl is unneeded, because the *gettext family of symbols is available in the libc. system dependency: This detects if libintl is installed as separate software, linkable via -lintl; unfortunately, GNU gettext does not ship pkg-config files for it. Fixes #3929
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/__init__.py3
-rw-r--r--mesonbuild/dependencies/misc.py28
2 files changed, 29 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py
index 0dafae1..bd90c90 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,
+ shaderc_factory, threads_factory, ThreadDependency, 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,
+ 'intl': intl_factory,
# From platform:
'appleframeworks': AppleFrameworks,
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 87b1a9b..f131cb7 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -24,7 +24,7 @@ from .. import mesonlib
from .. import mlog
from ..environment import detect_cpu_family
from .base import DependencyException, DependencyMethods
-from .base import SystemDependency
+from .base import BuiltinDependency, SystemDependency
from .cmake import CMakeDependency
from .configtool import ConfigToolDependency
from .factory import DependencyFactory, factory_methods
@@ -487,6 +487,25 @@ class CursesSystemDependency(SystemDependency):
return [DependencyMethods.SYSTEM]
+class IntlBuiltinDependency(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('ngettext', '', env)[0]:
+ self.is_found = True
+
+
+class IntlSystemDependency(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('libintl.h', '', env)
+ self.link_args = self.clib_compiler.find_library('intl', env, [])
+
+ if h and self.link_args:
+ self.is_found = True
+
+
@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.SYSTEM})
def curses_factory(env: 'Environment',
for_machine: 'MachineChoice',
@@ -596,3 +615,10 @@ threads_factory = DependencyFactory(
cmake_name='Threads',
system_class=ThreadDependency,
)
+
+intl_factory = DependencyFactory(
+ 'intl',
+ [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM],
+ builtin_class=IntlBuiltinDependency,
+ system_class=IntlSystemDependency,
+)