From 8c9cfba67711d0c3902f9bba444b68c7415d4f98 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 19 Oct 2017 09:04:33 +0200 Subject: fix build with system gpgme Change-Id: I00e6d6ce476adbd22bcfb4eb55d4db4194f4bc92 --- config_host/config_gpgme.h.in | 16 ++++++++++++++++ configure.ac | 2 ++ xmlsecurity/source/gpg/CertificateImpl.cxx | 9 +++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 config_host/config_gpgme.h.in diff --git a/config_host/config_gpgme.h.in b/config_host/config_gpgme.h.in new file mode 100644 index 000000000000..50f9edd8f8a0 --- /dev/null +++ b/config_host/config_gpgme.h.in @@ -0,0 +1,16 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* Configuration for gpgme++. + */ + +// Defined if gpgme supports exporting minimal key. +#define GPGME_CAN_EXPORT_MINIMAL_KEY 0 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configure.ac b/configure.ac index 85b603060e3a..335d7de9334a 100644 --- a/configure.ac +++ b/configure.ac @@ -10242,6 +10242,7 @@ if test "$_os" = "Linux"; then else AC_MSG_RESULT([internal]) BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP" + AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY]) GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src" GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error" @@ -12353,6 +12354,7 @@ AC_CONFIG_HEADERS([config_host/config_firebird.h]) AC_CONFIG_HEADERS([config_host/config_folders.h]) AC_CONFIG_HEADERS([config_host/config_gio.h]) AC_CONFIG_HEADERS([config_host/config_global.h]) +AC_CONFIG_HEADERS([config_host/config_gpgme.h]) AC_CONFIG_HEADERS([config_host/config_java.h]) AC_CONFIG_HEADERS([config_host/config_lgpl.h]) AC_CONFIG_HEADERS([config_host/config_libepubgen.h]) diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index 6d06b24c3a2a..16eeda80441f 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -7,6 +7,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include + #include "CertificateImpl.hxx" #include @@ -215,8 +217,11 @@ void CertificateImpl::setCertificate(GpgME::Context* ctx, const GpgME::Key& key) ctx->setArmor(false); // caller will base64-encode anyway GpgME::Error err = ctx->exportPublicKeys( key.primaryFingerprint(), - data_out, - officecfg::Office::Common::Security::OpenPGP::MinimalKeyExport::get()); + data_out +#if GPGME_CAN_EXPORT_MINIMAL_KEY + , officecfg::Office::Common::Security::OpenPGP::MinimalKeyExport::get() +#endif + ); if (err) throw RuntimeException("The GpgME library failed to retrieve the public key"); -- cgit