[Libreoffice-commits] core.git: configure.ac external/gpgme

David Ostrovsky david at ostrovsky.org
Wed Nov 22 16:56:37 UTC 2017


 configure.ac                            |    2 
 external/gpgme/ExternalProject_gpgme.mk |   25 ++++++
 external/gpgme/UnpackedTarball_gpgme.mk |    1 
 external/gpgme/w32-build-fixes.patch.1  |  122 ++++++++++++++++++++++++++++++++
 4 files changed, 149 insertions(+), 1 deletion(-)

New commits:
commit bafbaa3fed95f28f368b0bd4256dbe2a714e3bd8
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Wed Sep 27 08:57:36 2017 +0200

    gpg4libre: build gpgme natively on windows
    
    Change-Id: I0b77ba0c1b8f84affa483181e26a26beaf39e878
    Reviewed-on: https://gerrit.libreoffice.org/42838
    Reviewed-by: Siegmund Gorr <siegmund.gorr at cib.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/configure.ac b/configure.ac
index dacb5ee98ffe..25d3f4153f5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10162,7 +10162,7 @@ if test "$_os" = "Linux" -o "$_os" = "Darwin"; then
 else
     # TODO(davido): Windows build must be protected with a configure option
     # unless CI doesn't support libtool with windres with gcc preprocessor
-    BUILD_TYPE="$BUILD_TYPE LIBASSUAN LIBGPGERROR"
+    BUILD_TYPE="$BUILD_TYPE LIBASSUAN LIBGPGERROR GPGMEPP"
     GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
     GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
     LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
diff --git a/external/gpgme/ExternalProject_gpgme.mk b/external/gpgme/ExternalProject_gpgme.mk
index 5c2407c1c771..dcaaf6bdfa2a 100644
--- a/external/gpgme/ExternalProject_gpgme.mk
+++ b/external/gpgme/ExternalProject_gpgme.mk
@@ -20,6 +20,30 @@ $(eval $(call gb_ExternalProject_use_externals,gpgme,\
        libassuan \
 ))
 
+ifeq ($(COM),MSC)
+$(call gb_ExternalProject_get_state_target,gpgme,build):
+	$(call gb_ExternalProject_run,build,\
+		autoreconf \
+		&& ./configure \
+		   --enable-languages="cl cpp" \
+		   --disable-gpgconf-test \
+		   --disable-gpg-test \
+		   --disable-gpgsm-test \
+		   --disable-g13-test \
+		   GPG_ERROR_CFLAGS="$(GPG_ERROR_CFLAGS)" \
+		   GPG_ERROR_LIBS="$(GPG_ERROR_LIBS)" \
+		   LIBASSUAN_CFLAGS="$(LIBASSUAN_CFLAGS)" \
+		   LIBASSUAN_LIBS="$(LIBASSUAN_LIBS)" \
+			CFLAGS='$(CFLAGS) \
+				$(if $(ENABLE_OPTIMIZED), \
+					$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS)) \
+				$(if $(ENABLE_DEBUG),$(gb_DEBUG_CFLAGS)) \
+				$(if $(filter $(true),$(gb_SYMBOL)),$(gb_DEBUGINFO_FLAGS))' \
+		   --host=$(if $(filter INTEL,$(CPUNAME)),i686-mingw32,x86_64-w64-mingw32) \
+	  && $(MAKE) \
+	)
+
+else
 $(call gb_ExternalProject_get_state_target,gpgme,build):
 	$(call gb_ExternalProject_run,build,\
 		autoreconf \
@@ -41,4 +65,5 @@ $(call gb_ExternalProject_get_state_target,gpgme,build):
 	  && $(MAKE) \
 	)
 
+endif
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgme/UnpackedTarball_gpgme.mk b/external/gpgme/UnpackedTarball_gpgme.mk
index 15259971f798..4e95fe0ab160 100644
--- a/external/gpgme/UnpackedTarball_gpgme.mk
+++ b/external/gpgme/UnpackedTarball_gpgme.mk
@@ -17,5 +17,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgme, \
     external/gpgme/find-libgpg-error-libassuan.patch \
     external/gpgme/fix-autoconf-macros.patch \
     external/gpgme/add-minimal-keyexport.patch \
+    $(if $(filter MSC,$(COM)),external/gpgme/w32-build-fixes.patch.1) \
 ))
 # vim: set noet sw=4 ts=4:
diff --git a/external/gpgme/w32-build-fixes.patch.1 b/external/gpgme/w32-build-fixes.patch.1
new file mode 100755
index 000000000000..cd45b45a31d9
--- /dev/null
+++ b/external/gpgme/w32-build-fixes.patch.1
@@ -0,0 +1,122 @@
+diff -ru gpgme.orig/m4/ax_cxx_compile_stdcxx.m4 gpgme/m4/ax_cxx_compile_stdcxx.m4
+--- gpgme.orig/m4/ax_cxx_compile_stdcxx.m4	2016-05-27 22:04:36.000000000 +0200
++++ gpgme/m4/ax_cxx_compile_stdcxx.m4	2017-09-29 17:34:49.795243600 +0200
+@@ -156,7 +156,7 @@
+ 
+ #error "This is not a C++ compiler"
+ 
+-#elif __cplusplus < 201103L
++#elif __cplusplus < 201103L && !(defined _MSC_VER)
+ 
+ #error "This is not a C++11 compiler"
+ 
+diff -ru gpgme.orig/src/dirinfo.c gpgme/src/dirinfo.c
+--- gpgme.orig/src/dirinfo.c	2017-03-21 11:09:41.000000000 +0100
++++ gpgme/src/dirinfo.c	2017-09-30 08:36:13.239279300 +0200
+@@ -33,6 +33,10 @@
+ 
+ DEFINE_STATIC_LOCK (dirinfo_lock);
+ 
++#ifndef F_OK
++#define F_OK 0
++#endif
++
+ /* Constants used internally to select the data.  */
+ enum
+   {
+diff -ru gpgme.orig/src/mbox-util.c gpgme/src/mbox-util.c
+--- gpgme.orig/src/mbox-util.c	2016-11-16 13:22:41.000000000 +0100
++++ gpgme/src/mbox-util.c	2017-09-30 08:18:29.270567500 +0200
+@@ -28,7 +28,9 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#if HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
+ #include <errno.h>
+ 
+ #include "mbox-util.h"
+diff -ru gpgme.orig/src/priv-io.h gpgme/src/priv-io.h
+--- gpgme.orig/src/priv-io.h	2016-11-16 13:23:14.000000000 +0100
++++ gpgme/src/priv-io.h	2017-09-30 08:20:38.770562400 +0200
+@@ -36,6 +36,9 @@
+ #ifdef HAVE_SYS_TYPES_H
+ # include <sys/types.h>
+ #endif
++#if _MSC_VER
++typedef int pid_t;
++#endif
+ 
+ 
+ /* A single file descriptor passed to spawn.  For child fds, dup_to
+diff -ru gpgme.orig/src/util.h gpgme/src/util.h
+--- gpgme.orig/src/util.h	2017-03-28 11:41:30.000000000 +0200
++++ gpgme/src/util.h	2017-09-30 08:10:54.194049100 +0200
+@@ -39,6 +39,9 @@
+ #ifdef HAVE_UNISTD_H
+ # include <unistd.h>
+ #endif
++#ifdef _MSC_VER
++typedef int pid_t;
++#endif
+ 
+ #include "gpgme.h"
+ 
+diff -ru gpgme.orig/src/w32-util.c gpgme/src/w32-util.c
+--- gpgme.orig/src/w32-util.c	2017-03-09 09:01:10.000000000 +0100
++++ gpgme/src/w32-util.c	2017-09-30 08:32:02.114330500 +0200
+@@ -721,7 +721,8 @@
+       v /= 62;
+       XXXXXX[5] = letters[v % 62];
+ 
+-      fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
++      //fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
++      fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL);
+       if (fd >= 0)
+ 	{
+ 	  gpg_err_set_errno (save_errno);
+diff -ru gpgme.orig/src/Makefile.am gpgme/src/Makefile.am
+--- gpgme.orig/src/Makefile.am	2017-09-30 11:50:07.456960000 +0200
++++ gpgme/src/Makefile.am	2017-09-30 11:51:29.609649400 +0200
+@@ -26,7 +26,7 @@
+ m4data_DATA = gpgme.m4
+ nodist_include_HEADERS = gpgme.h
+ 
+-bin_PROGRAMS = gpgme-tool
++bin_PROGRAMS =
+ 
+ if BUILD_W32_GLIB
+ ltlib_gpgme_glib = libgpgme-glib.la
+@@ -99,8 +99,8 @@
+ # versions, because then every object file is only compiled once.
+ AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GPG_ERROR_CFLAGS@ @GLIB_CFLAGS@
+ 
+-gpgme_tool_SOURCES = gpgme-tool.c argparse.c argparse.h
+-gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@
++gpgme_tool_SOURCES =
++gpgme_tool_LDADD =
+ 
+ 
+ if HAVE_W32_SYSTEM
+@@ -120,7 +120,7 @@
+ SUFFIXES = .rc .lo
+ 
+ .rc.lo:
+-	$(LTRCCOMPILE) -i "$<" -o "$@"
++	$(LTRCCOMPILE) -i $< -o $@
+ 
+ gpgme_res = versioninfo.lo
+ no_undefined = -no-undefined
+diff -ru gpgme.orig/src/vfs-mount.c gpgme/src/vfs-mount.c
+--- gpgme.orig/src/vfs-mount.c	2017-03-09 09:01:10.000000000 +0100
++++ gpgme/src/vfs-mount.c	2017-09-30 13:10:51.845807600 +0200
+@@ -68,7 +68,7 @@
+   if (err)
+     return err;
+ 
+-  if (! strcasecmp ("MOUNTPOINT", code))
++  if (! _stricmp ("MOUNTPOINT", code))
+     {
+       if (opd->result.mount_dir)
+ 	free (opd->result.mount_dir);


More information about the Libreoffice-commits mailing list