aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies
diff options
context:
space:
mode:
authorAndrew Krasavin <noiseless-ak@yandex.ru>2022-02-01 06:13:09 +0300
committerEli Schwartz <eschwartz93@gmail.com>2022-02-01 15:51:15 -0500
commitb564e342219b9a453ae2c5857b5aa2bcc54511af (patch)
tree7467caff2f478cfc96b5a3d1336d646adb08722d /mesonbuild/dependencies
parent248e6cf4736ef9ec636228da66c28f9be03aa74f (diff)
downloadmeson-b564e342219b9a453ae2c5857b5aa2bcc54511af.zip
meson-b564e342219b9a453ae2c5857b5aa2bcc54511af.tar.gz
meson-b564e342219b9a453ae2c5857b5aa2bcc54511af.tar.bz2
new custom dependency lookup for libdl
Diffstat (limited to 'mesonbuild/dependencies')
-rw-r--r--mesonbuild/dependencies/__init__.py2
-rw-r--r--mesonbuild/dependencies/misc.py26
2 files changed, 28 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py
index ff0bd30..b0c25b1 100644
--- a/mesonbuild/dependencies/__init__.py
+++ b/mesonbuild/dependencies/__init__.py
@@ -36,6 +36,7 @@ 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, iconv_factory, intl_factory,
+ dl_factory
)
from .platform import AppleFrameworks
from .qt import qt4_factory, qt5_factory, qt6_factory
@@ -254,6 +255,7 @@ packages.update({
'shaderc': shaderc_factory,
'iconv': iconv_factory,
'intl': intl_factory,
+ 'dl': dl_factory,
# From platform:
'appleframeworks': AppleFrameworks,
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 470305e..c95f7da 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -60,6 +60,25 @@ def netcdf_factory(env: 'Environment',
return candidates
+class DlBuiltinDependency(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('dlopen', '#include <dlfcn.h>', env)[0]:
+ self.is_found = True
+
+
+class DlSystemDependency(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('dlfcn.h', '', env)
+ self.link_args = self.clib_compiler.find_library('dl', env, [], self.libtype)
+
+ if h[0] and self.link_args:
+ self.is_found = True
+
+
class OpenMPDependency(SystemDependency):
# Map date of specification release (which is the macro value) to a version.
VERSIONS = {
@@ -559,6 +578,13 @@ cups_factory = DependencyFactory(
cmake_name='Cups',
)
+dl_factory = DependencyFactory(
+ 'dl',
+ [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM],
+ builtin_class=DlBuiltinDependency,
+ system_class=DlSystemDependency,
+)
+
gpgme_factory = DependencyFactory(
'gpgme',
[DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],