summaryrefslogtreecommitdiffstats
path: root/src/libgcrypt-1-fixes.patch
blob: cd93e5bb9c816beb6c89f29adc9dde00f1ec83f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 6e118d36f8c15474065fe357446cf288cdc1e179 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 4 Dec 2014 15:07:43 +1100
Subject: [PATCH 1/3] fix for mingw cross building

Taken from:
https://aur.archlinux.org/packages/mingw-w64-libgcrypt/

diff --git a/acinclude.m4 b/acinclude.m4
index 96be833..9e14e12 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -102,7 +102,9 @@ AC_DEFUN([GNUPG_SYS_SYMBOL_UNDERSCORE],
 [tmp_do_check="no"
 case "${host}" in
     i?86-mingw32* | i?86-*-mingw32*)
-        ac_cv_sys_symbol_underscore=yes
+        if test "x$ac_cv_sys_symbol_underscore" = x ; then
+           ac_cv_sys_symbol_underscore=yes
+        fi
         ;;
     x86_64-*-mingw32*)
         ac_cv_sys_symbol_underscore=no
diff --git a/mpi/generic/mpi-asm-defs.h b/mpi/generic/mpi-asm-defs.h
index e607806..4c57111 100644
--- a/mpi/generic/mpi-asm-defs.h
+++ b/mpi/generic/mpi-asm-defs.h
@@ -4,5 +4,9 @@
 #if __GNUC__ >= 3 && defined(__x86_64__) && defined(__ILP32__)
 #define BYTES_PER_MPI_LIMB 8
 #else
+#ifdef _WIN64
+#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
+#else
 #define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG)
 #endif
+#endif
diff --git a/mpi/mpi-internal.h b/mpi/mpi-internal.h
index 898ca47..afd1a1f 100644
--- a/mpi/mpi-internal.h
+++ b/mpi/mpi-internal.h
@@ -169,6 +169,12 @@ typedef int mpi_size_t;        /* (must be a signed type) */
     } while (0)
 
 
+#ifdef _WIN64
+#define ATTR_ABI __attribute__ ((sysv_abi))
+#else
+#define ATTR_ABI
+#endif
+
 /*-- mpiutil.c --*/
 #define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
 mpi_ptr_t _gcry_mpi_alloc_limb_space( unsigned nlimbs, int sec );
@@ -187,7 +193,7 @@ void _gcry_mpi_lshift_limbs( gcry_mpi_t a, unsigned int count );
 mpi_limb_t _gcry_mpih_add_1(mpi_ptr_t res_ptr,  mpi_ptr_t s1_ptr,
 			 mpi_size_t s1_size, mpi_limb_t s2_limb );
 mpi_limb_t _gcry_mpih_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
-			  mpi_ptr_t s2_ptr,  mpi_size_t size);
+			  mpi_ptr_t s2_ptr,  mpi_size_t size) ATTR_ABI;
 mpi_limb_t _gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
 		       mpi_ptr_t s2_ptr, mpi_size_t s2_size);
 
@@ -195,7 +201,7 @@ mpi_limb_t _gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_siz
 mpi_limb_t _gcry_mpih_sub_1( mpi_ptr_t res_ptr,  mpi_ptr_t s1_ptr,
 			  mpi_size_t s1_size, mpi_limb_t s2_limb );
 mpi_limb_t _gcry_mpih_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
-			  mpi_ptr_t s2_ptr, mpi_size_t size);
+			  mpi_ptr_t s2_ptr, mpi_size_t size) ATTR_ABI;
 mpi_limb_t _gcry_mpih_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size,
 		       mpi_ptr_t s2_ptr, mpi_size_t s2_size);
 
@@ -217,9 +223,9 @@ struct karatsuba_ctx {
 void _gcry_mpih_release_karatsuba_ctx( struct karatsuba_ctx *ctx );
 
 mpi_limb_t _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
-			     mpi_size_t s1_size, mpi_limb_t s2_limb);
+			     mpi_size_t s1_size, mpi_limb_t s2_limb) ATTR_ABI;
 mpi_limb_t _gcry_mpih_submul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
-			     mpi_size_t s1_size, mpi_limb_t s2_limb);
+			     mpi_size_t s1_size, mpi_limb_t s2_limb) ATTR_ABI;
 void _gcry_mpih_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp,
 						   mpi_size_t size);
 mpi_limb_t _gcry_mpih_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize,
@@ -236,7 +242,7 @@ void _gcry_mpih_mul_karatsuba_case( mpi_ptr_t prodp,
 
 /*-- mpih-mul_1.c (or xxx/cpu/ *.S) --*/
 mpi_limb_t _gcry_mpih_mul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr,
-			  mpi_size_t s1_size, mpi_limb_t s2_limb);
+			  mpi_size_t s1_size, mpi_limb_t s2_limb) ATTR_ABI;
 
 /*-- mpih-div.c --*/
 mpi_limb_t _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size,
@@ -250,9 +256,9 @@ mpi_limb_t _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr,
 
 /*-- mpih-shift.c --*/
 mpi_limb_t _gcry_mpih_lshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize,
-							   unsigned cnt);
+							   unsigned cnt) ATTR_ABI;
 mpi_limb_t _gcry_mpih_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize,
-							   unsigned cnt);
+							   unsigned cnt) ATTR_ABI;
 
 
 /* Define stuff for longlong.h.  */
diff --git a/src/libgcrypt.def b/src/libgcrypt.def
index 067cb84..df71bba 100644
--- a/src/libgcrypt.def
+++ b/src/libgcrypt.def
@@ -1,3 +1,4 @@
+EXPORTS
 ;; libgcrypt.defs -  Exported symbols for W32
 ;; Copyright (C) 2003, 2007 Free Software Foundation, Inc.
 ;;
@@ -22,7 +23,6 @@
 ;; never be changed.  Also check libgcrypt.vers and visibility.h.
 
 
-EXPORTS
       gcry_check_version  @1
       gcry_control  @2
 
-- 
2.7.4


From 9ff9c0ae66b9f51decfda8dffa2024d8dbaa9fe6 Mon Sep 17 00:00:00 2001
From: Saikrishna Arcot <saiarcot895@gmail.com>
Date: Fri, 12 Jun 2015 14:53:55 -0700
Subject: [PATCH 2/3] Don't call git to determine the revision.


diff --git a/configure.ac b/configure.ac
index f683e21..d43c012 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,13 +38,10 @@ m4_define(mym4_version_micro, [0])
 # processing is done by autoconf and not during the configure run.
 m4_define(mym4_version,
           [mym4_version_major.mym4_version_minor.mym4_version_micro])
-m4_define([mym4_revision],
-          m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
+m4_define([mym4_revision], [4091])
 m4_define([mym4_revision_dec],
           m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
-m4_define([mym4_betastring],
-          m4_esyscmd_s([git describe --match 'libgcrypt-[0-9].*[0-9]' --long|\
-                        awk -F- '$3!=0{print"-beta"$3}']))
+m4_define([mym4_betastring], [])
 m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
 
-- 
2.7.4


From 7a22846e84ca5047b2f5cae7eb12ccab53c03026 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Jun 2015 17:17:25 +0200
Subject: [PATCH 3/3] configure.ac: no serial-tests if automake < 1.12

Earlier versions of automake complain if they get a configuration
parameter which they don't understand.  The error is:

configure.ac:27: error: option 'serial-tests' not recognized

Use some m4 hackery to work around this.

Fix libgcrypt build under x86_64
See https://www.redhat.com/archives/libguestfs/2013-February/msg00102.html

diff --git a/configure.ac b/configure.ac
index d43c012..b6f20ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,7 +71,24 @@ VERSION=$PACKAGE_VERSION
 
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/libgcrypt.vers])
-AM_INIT_AUTOMAKE([serial-tests dist-bzip2])
+
+dnl Initialize automake.  automake < 1.12 didn't have serial-tests and
+dnl gives an error if it sees this, but for automake >= 1.13
+dnl serial-tests is required so we have to include it.  Solution is to
+dnl test for the version of automake (by running an external command)
+dnl and provide it if necessary.  Note we have to do this entirely using
+dnl m4 macros since automake queries this macro by running
+dnl 'autoconf --trace ...'.
+m4_define([serial_tests], [
+    m4_esyscmd([automake --version |
+                head -1 |
+                awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { '\
+                    'print "serial-tests" }}'
+    ])
+])
+dnl NB: Do not [quote] this parameter.
+AM_INIT_AUTOMAKE(serial_tests dist-bzip2)
+
 AC_CONFIG_HEADER(config.h)
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_LIBOBJ_DIR([compat])
-- 
2.7.4