Add gpgme-config support

GPGME does not support pkg-config so we need config-tool support if
we do not want projects like Almanah and Seahorse to parse the values
manually.
pull/5228/head
Jan Tojnar 5 years ago committed by Jussi Pakkanen
parent d6be7822a0
commit e8a688428d
  1. 1
      ciimage/Dockerfile
  2. 9
      docs/markdown/Dependencies.md
  3. 3
      docs/markdown/snippets/gpgme-config.md
  4. 3
      mesonbuild/dependencies/__init__.py
  5. 28
      mesonbuild/dependencies/misc.py
  6. 8
      test cases/frameworks/27 gpgme/gpgme_prog.c
  7. 21
      test cases/frameworks/27 gpgme/meson.build

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

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

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

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

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

@ -0,0 +1,8 @@
#include <gpgme.h>
int
main()
{
printf("gpgme-v%s", gpgme_check_version(NULL));
return 0;
}

@ -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')
Loading…
Cancel
Save