aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ciimage/Dockerfile1
-rw-r--r--docs/markdown/Dependencies.md9
-rw-r--r--docs/markdown/snippets/gpgme-config.md3
-rw-r--r--mesonbuild/dependencies/__init__.py3
-rw-r--r--mesonbuild/dependencies/misc.py28
-rw-r--r--test cases/frameworks/27 gpgme/gpgme_prog.c8
-rw-r--r--test cases/frameworks/27 gpgme/meson.build21
7 files changed, 71 insertions, 2 deletions
diff --git a/ciimage/Dockerfile b/ciimage/Dockerfile
index 980ed53..d5f4816 100644
--- a/ciimage/Dockerfile
+++ b/ciimage/Dockerfile
@@ -20,6 +20,7 @@ RUN sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list" \
&& apt-get -y install --no-install-recommends wine-stable \
&& apt-get -y install llvm-dev libclang-dev \
&& apt-get -y install libgcrypt11-dev \
+&& apt-get -y install libgpgme-dev \
&& apt-get -y install libhdf5-dev \
&& dub fetch urld && dub build urld --compiler=gdc \
&& dub fetch dubtestproject \
diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md
index bd07524..2789ee0 100644
--- a/docs/markdown/Dependencies.md
+++ b/docs/markdown/Dependencies.md
@@ -200,7 +200,7 @@ wmf_dep = dependency('libwmf', method : 'config-tool')
## Dependencies using config tools
[CUPS](#cups), [LLVM](#llvm), [pcap](#pcap), [WxWidgets](#wxwidgets),
-[libwmf](#libwmf), [GCrypt](#libgcrypt), and GnuStep either do not provide pkg-config
+[libwmf](#libwmf), [GCrypt](#libgcrypt), [GPGME](#gpgme), and GnuStep either do not provide pkg-config
modules or additionally can be detected via a config tool
(cups-config, llvm-config, libgcrypt-config, etc). Meson has native support for these
tools, and they can be found like other dependencies:
@@ -210,6 +210,7 @@ pcap_dep = dependency('pcap', version : '>=1.0')
cups_dep = dependency('cups', version : '>=1.4')
llvm_dep = dependency('llvm', version : '>=4.0')
libgcrypt_dep = dependency('libgcrypt', version: '>= 1.8')
+gpgme_dep = dependency('gpgme', version: '>= 1.0')
```
## AppleFrameworks
@@ -389,6 +390,12 @@ The `language` keyword may used.
`method` may be `auto`, `config-tool` or `pkg-config`.
+## GPGME
+
+*(added 0.51.0)*
+
+`method` may be `auto` or `config-tool`.
+
## Python3
Python3 is handled specially by meson:
diff --git a/docs/markdown/snippets/gpgme-config.md b/docs/markdown/snippets/gpgme-config.md
new file mode 100644
index 0000000..08a7d38
--- /dev/null
+++ b/docs/markdown/snippets/gpgme-config.md
@@ -0,0 +1,3 @@
+## gpgme dependency now supports gpgme-config
+
+Previously, we could only detect GPGME with custom invocations of `gpgme-config`. Now we added support to Meson allowing us to use `dependency('gpgme')` instead.
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py
index 1152b8d..846f3de 100644
--- a/mesonbuild/dependencies/__init__.py
+++ b/mesonbuild/dependencies/__init__.py
@@ -18,7 +18,7 @@ from .base import ( # noqa: F401
ExternalDependency, NotFoundDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
PkgConfigDependency, CMakeDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language)
from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency
-from .misc import (CoarrayDependency, HDF5Dependency, MPIDependency, NetCDFDependency, OpenMPDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency, LibWmfDependency, LibGCryptDependency, ShadercDependency)
+from .misc import (CoarrayDependency, HDF5Dependency, MPIDependency, NetCDFDependency, OpenMPDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency, LibWmfDependency, LibGCryptDependency, GpgmeDependency, ShadercDependency)
from .platform import AppleFrameworks
from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, VulkanDependency
@@ -43,6 +43,7 @@ packages.update({
'cups': CupsDependency,
'libwmf': LibWmfDependency,
'libgcrypt': LibGCryptDependency,
+ 'gpgme': GpgmeDependency,
'shaderc': ShadercDependency,
# From platform:
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 38c34a8..f4694ca 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -672,6 +672,34 @@ class LibGCryptDependency(ExternalDependency):
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
+class GpgmeDependency(ExternalDependency):
+ def __init__(self, environment, kwargs):
+ super().__init__('gpgme', environment, None, kwargs)
+
+ @classmethod
+ def _factory(cls, environment, kwargs):
+ methods = cls._process_method_kw(kwargs)
+ candidates = []
+
+ if DependencyMethods.CONFIG_TOOL in methods:
+ candidates.append(functools.partial(ConfigToolDependency.factory,
+ 'gpgme', environment, None, kwargs, ['gpgme-config'],
+ 'gpgme-config',
+ GpgmeDependency.tool_finish_init))
+
+ return candidates
+
+ @staticmethod
+ def tool_finish_init(ctdep):
+ ctdep.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args')
+ ctdep.link_args = ctdep.get_config_value(['--libs'], 'link_args')
+ ctdep.version = ctdep.get_config_value(['--version'], 'version')[0]
+
+ @staticmethod
+ def get_methods():
+ return [DependencyMethods.CONFIG_TOOL]
+
+
class ShadercDependency(ExternalDependency):
def __init__(self, environment, kwargs):
diff --git a/test cases/frameworks/27 gpgme/gpgme_prog.c b/test cases/frameworks/27 gpgme/gpgme_prog.c
new file mode 100644
index 0000000..594f685
--- /dev/null
+++ b/test cases/frameworks/27 gpgme/gpgme_prog.c
@@ -0,0 +1,8 @@
+#include <gpgme.h>
+
+int
+main()
+{
+ printf("gpgme-v%s", gpgme_check_version(NULL));
+ return 0;
+}
diff --git a/test cases/frameworks/27 gpgme/meson.build b/test cases/frameworks/27 gpgme/meson.build
new file mode 100644
index 0000000..220a4c0
--- /dev/null
+++ b/test cases/frameworks/27 gpgme/meson.build
@@ -0,0 +1,21 @@
+project('gpgme test', 'c')
+
+wm = find_program('gpgme-config', required: false)
+if not wm.found()
+ error('MESON_SKIP_TEST: gpgme-config not installed')
+endif
+
+gpgme_dep = dependency('gpgme', version: '>= 1.0')
+gpgme_ver = gpgme_dep.version()
+assert(gpgme_ver.split('.').length() > 1, 'gpgme version is "@0@"'.format(gpgme_ver))
+message('gpgme version is "@0@"'.format(gpgme_ver))
+e = executable('gpgme_prog', 'gpgme_prog.c', dependencies: gpgme_dep)
+
+test('gpgmetest', e)
+
+# Test using the method keyword:
+
+dependency('gpgme', method: 'config-tool')
+
+# Check we can apply a version constraint
+dependency('gpgme', version: '>=@0@'.format(gpgme_dep.version()), method: 'config-tool')