Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: patches/gnupg/1.4.23/
Date: Thu, 16 Jul 2020 15:03:31
Message-Id: 1594736014.0d59668f0cb3ce17ae92116a32b3f50f33c2de67.whissi@gentoo
1 commit: 0d59668f0cb3ce17ae92116a32b3f50f33c2de67
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 14 14:13:34 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 14 14:13:34 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=0d59668f
7
8 gnupg: Allow building against gcc-10
9
10 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
11
12 patches/gnupg/1.4.23/gnupg-1.4.23-gcc-10.patch | 156 +++++++++++++++++++++++++
13 1 file changed, 156 insertions(+)
14
15 diff --git a/patches/gnupg/1.4.23/gnupg-1.4.23-gcc-10.patch b/patches/gnupg/1.4.23/gnupg-1.4.23-gcc-10.patch
16 new file mode 100644
17 index 0000000..9f0ba1b
18 --- /dev/null
19 +++ b/patches/gnupg/1.4.23/gnupg-1.4.23-gcc-10.patch
20 @@ -0,0 +1,156 @@
21 +From 45ef4455a60929932d1499cf718c1c9f59af9f26 Mon Sep 17 00:00:00 2001
22 +From: Thomas Petazzoni <thomas.petazzoni@×××××××.com>
23 +Date: Tue, 26 May 2020 22:57:05 +0200
24 +Subject: [PATCH] build: Always use EXTERN_UNLESS_MAIN_MODULE pattern
25 +
26 +This patch is loosely based on upstream commit
27 +6aff8a132815a84bab69401c1e7de96ec549fbf2 ("build: Always use
28 +EXTERN_UNLESS_MAIN_MODULE pattern."). However, this upstream commit
29 +applies to gnupg2, and the code base has changed quite significantly
30 +compared to gnupg 1.x, so upstream's patch cannot be applied
31 +as-is. The goal of the patch is to make sure each variable is only
32 +defined once, ass gcc 10 now default to -fno-common.
33 +
34 +Essentially, this patch mainly fixes the EXTERN_UNLESS_MAIN_MODULE
35 +define so that it really expands to "extern" when
36 +INCLUDED_BY_MAIN_MODULE is not defined, even on non-RiscOS
37 +systems. Contrary to upstream's patch we however do not factorize the
38 +multiple EXTERN_UNLESS_MAIN_MODULE definitions into a single place as
39 +it requires too many changes: instead we simply fix the few
40 +definitions of this macro.
41 +
42 +Once the macro is fixed, two places need to define
43 +INCLUDED_BY_MAIN_MODULE: tools/bftest.c and tools/mpicalc.c so that
44 +when they include the common headers, their variables are at least
45 +defined once.
46 +
47 +The iobuf.{c,h} case is handled differently: iobuf.h gains an
48 +unconditional "extern", with the variable being added to iobuf.c. This
49 +is identical to what upstream's
50 +6aff8a132815a84bab69401c1e7de96ec549fbf2 is doing.
51 +
52 +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@×××××××.com>
53 +---
54 + g10/options.h | 3 +--
55 + include/cipher.h | 2 +-
56 + include/iobuf.h | 9 +--------
57 + include/memory.h | 2 +-
58 + include/mpi.h | 2 +-
59 + tools/bftest.c | 1 +
60 + tools/mpicalc.c | 1 +
61 + util/iobuf.c | 2 ++
62 + 8 files changed, 9 insertions(+), 13 deletions(-)
63 +
64 +diff --git a/g10/options.h b/g10/options.h
65 +index 0ac6e7755..bae19e9e3 100644
66 +--- a/g10/options.h
67 ++++ b/g10/options.h
68 +@@ -26,8 +26,7 @@
69 + #include "packet.h"
70 +
71 + #ifndef EXTERN_UNLESS_MAIN_MODULE
72 +-/* Norcraft can't cope with common symbols */
73 +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
74 ++#if !defined (INCLUDED_BY_MAIN_MODULE)
75 + #define EXTERN_UNLESS_MAIN_MODULE extern
76 + #else
77 + #define EXTERN_UNLESS_MAIN_MODULE
78 +diff --git a/include/cipher.h b/include/cipher.h
79 +index dd4af18cb..6ef6e6829 100644
80 +--- a/include/cipher.h
81 ++++ b/include/cipher.h
82 +@@ -115,7 +115,7 @@ struct gcry_md_context {
83 + typedef struct gcry_md_context *MD_HANDLE;
84 +
85 + #ifndef EXTERN_UNLESS_MAIN_MODULE
86 +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
87 ++#if !defined (INCLUDED_BY_MAIN_MODULE)
88 + #define EXTERN_UNLESS_MAIN_MODULE extern
89 + #else
90 + #define EXTERN_UNLESS_MAIN_MODULE
91 +diff --git a/include/iobuf.h b/include/iobuf.h
92 +index 030f8c8e9..b4d26b7e1 100644
93 +--- a/include/iobuf.h
94 ++++ b/include/iobuf.h
95 +@@ -69,14 +69,7 @@ struct iobuf_struct {
96 + } unget;
97 + };
98 +
99 +-#ifndef EXTERN_UNLESS_MAIN_MODULE
100 +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
101 +-#define EXTERN_UNLESS_MAIN_MODULE extern
102 +-#else
103 +-#define EXTERN_UNLESS_MAIN_MODULE
104 +-#endif
105 +-#endif
106 +-EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode;
107 ++extern int iobuf_debug_mode;
108 +
109 + void iobuf_enable_special_filenames ( int yes );
110 + int iobuf_is_pipe_filename (const char *fname);
111 +diff --git a/include/memory.h b/include/memory.h
112 +index d414a9b2e..6698337e3 100644
113 +--- a/include/memory.h
114 ++++ b/include/memory.h
115 +@@ -91,7 +91,7 @@ unsigned secmem_get_flags(void);
116 + #define DBG_MEMSTAT memory_stat_debug_mode
117 +
118 + #ifndef EXTERN_UNLESS_MAIN_MODULE
119 +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
120 ++#if !defined (INCLUDED_BY_MAIN_MODULE)
121 + #define EXTERN_UNLESS_MAIN_MODULE extern
122 + #else
123 + #define EXTERN_UNLESS_MAIN_MODULE
124 +diff --git a/include/mpi.h b/include/mpi.h
125 +index a4c16f5af..7a45ff805 100644
126 +--- a/include/mpi.h
127 ++++ b/include/mpi.h
128 +@@ -36,7 +36,7 @@
129 + #include "memory.h"
130 +
131 + #ifndef EXTERN_UNLESS_MAIN_MODULE
132 +-#if defined (__riscos__) && !defined (INCLUDED_BY_MAIN_MODULE)
133 ++#if !defined (INCLUDED_BY_MAIN_MODULE)
134 + #define EXTERN_UNLESS_MAIN_MODULE extern
135 + #else
136 + #define EXTERN_UNLESS_MAIN_MODULE
137 +diff --git a/tools/bftest.c b/tools/bftest.c
138 +index 8a1572c2b..5afd7e125 100644
139 +--- a/tools/bftest.c
140 ++++ b/tools/bftest.c
141 +@@ -26,6 +26,7 @@
142 + #include <fcntl.h>
143 + #endif
144 +
145 ++#define INCLUDED_BY_MAIN_MODULE
146 + #include "util.h"
147 + #include "cipher.h"
148 + #include "i18n.h"
149 +diff --git a/tools/mpicalc.c b/tools/mpicalc.c
150 +index 46e5fc824..31acd82a4 100644
151 +--- a/tools/mpicalc.c
152 ++++ b/tools/mpicalc.c
153 +@@ -31,6 +31,7 @@
154 + #include <stdlib.h>
155 + #include <ctype.h>
156 +
157 ++#define INCLUDED_BY_MAIN_MODULE
158 + #include "util.h"
159 + #include "mpi.h"
160 + #include "i18n.h"
161 +diff --git a/util/iobuf.c b/util/iobuf.c
162 +index c8442929a..0d9ee4cec 100644
163 +--- a/util/iobuf.c
164 ++++ b/util/iobuf.c
165 +@@ -113,6 +113,8 @@ typedef struct {
166 + static CLOSE_CACHE close_cache;
167 + #endif
168 +
169 ++int iobuf_debug_mode;
170 ++
171 + #ifdef _WIN32
172 + typedef struct {
173 + int sock;
174 +--
175 +2.26.2
176 +