Mercurial > mxe-octave
comparison src/msvc-nettle-1.patch @ 3077:9c56d108c141
[MSVC] enable nettle compilation
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Sat, 22 Jun 2013 13:19:20 -0400 |
parents | |
children | 5e2851e5d048 |
comparison
equal
deleted
inserted
replaced
3076:b39e8dc859f7 | 3077:9c56d108c141 |
---|---|
1 diff -ur nettle-2.5-orig/Makefile.in nettle-2.5/Makefile.in | |
2 --- nettle-2.5-orig/Makefile.in 2012-07-07 09:27:54 -0400 | |
3 +++ nettle-2.5/Makefile.in 2013-06-22 13:11:19 -0400 | |
4 @@ -161,6 +161,9 @@ | |
5 hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT)) | |
6 hogweed_PURE_OBJS = $(hogweed_OBJS:.$(OBJEXT)=.p$(OBJEXT)) | |
7 | |
8 +$(nettle_OBJS): PRE_CPPFLAGS += -DBUILDING_NETTLE | |
9 +$(hogweed_OBJS): PRE_CPPFLAGS += -DBUILDING_HOGWEED | |
10 + | |
11 libnettle.a: $(nettle_OBJS) | |
12 -rm -f $@ | |
13 $(AR) $(ARFLAGS) $@ $(nettle_OBJS) | |
14 @@ -211,7 +214,7 @@ | |
15 $(LINK) twofishdata.$(OBJEXT) $(LIBS) -o twofishdata$(EXEEXT) | |
16 | |
17 shadata$(EXEEXT): shadata.$(OBJEXT) | |
18 - $(LINK) shadata.$(OBJEXT) $(LIBS) -lm -o shadata$(EXEEXT) | |
19 + $(LINK) shadata.$(OBJEXT) $(LIBS) -o shadata$(EXEEXT) | |
20 | |
21 gcmdata$(EXEEXT): gcmdata.$(OBJEXT) | |
22 $(LINK) gcmdata.$(OBJEXT) $(LIBS) -o gcmdata$(EXEEXT) | |
23 @@ -236,13 +239,13 @@ | |
24 .asm.$(OBJEXT): | |
25 $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \ | |
26 $< >$*.s | |
27 - $(COMPILE) $(CCPIC_MAYBE) -c $*.s | |
28 + $(COMPILE_AS) $(CCPIC_MAYBE) -c $*.s | |
29 echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d | |
30 | |
31 .asm.p$(OBJEXT): | |
32 $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 \ | |
33 $< >$*.s | |
34 - $(COMPILE) $(SHLIBCFLAGS) -c $*.s -o $@ | |
35 + $(COMPILE_AS) $(SHLIBCFLAGS) -c $*.s -o $@ | |
36 echo "$@ : $< $(srcdir)/asm.m4 machine.m4 config.m4" >$@.d | |
37 | |
38 # Texinfo rules | |
39 diff -ur nettle-2.5-orig/config.make.in nettle-2.5/config.make.in | |
40 --- nettle-2.5-orig/config.make.in 2012-07-07 09:27:54 -0400 | |
41 +++ nettle-2.5/config.make.in 2013-06-22 13:11:19 -0400 | |
42 @@ -1,6 +1,7 @@ | |
43 # Makefile settings shared between Makefiles. | |
44 | |
45 CC = @CC@ | |
46 +CCAS = @CCAS@ | |
47 CXX = @CXX@ | |
48 CFLAGS = @CFLAGS@ | |
49 CXXFLAGS = @CXXFLAGS@ | |
50 @@ -68,6 +69,7 @@ | |
51 | |
52 COMPILE = $(CC) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(CCPIC) $(DEP_FLAGS) | |
53 COMPILE_CXX = $(CXX) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CCPIC) $(DEP_FLAGS) | |
54 +COMPILE_AS = $(CCAS) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(CCPIC) $(DEP_FLAGS) | |
55 LINK = $(CC) $(CFLAGS) $(PRE_LDFLAGS) $(LDFLAGS) | |
56 LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS) | |
57 | |
58 diff -ur nettle-2.5-orig/configure nettle-2.5/configure | |
59 --- nettle-2.5-orig/configure 2012-07-07 09:27:54 -0400 | |
60 +++ nettle-2.5/configure 2013-06-22 13:11:19 -0400 | |
61 @@ -656,6 +656,7 @@ | |
62 LDFLAGS | |
63 CFLAGS | |
64 CC | |
65 +CCAS | |
66 host_os | |
67 host_vendor | |
68 host_cpu | |
69 @@ -4718,7 +4719,7 @@ | |
70 .size foo, .Lend - foo | |
71 | |
72 EOF | |
73 -gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" | |
74 +gmp_assemble="$CCAS $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" | |
75 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5 | |
76 (eval $gmp_assemble) 2>&5 | |
77 ac_status=$? | |
78 @@ -4754,7 +4755,7 @@ | |
79 .size foo, .Lend - foo | |
80 | |
81 EOF | |
82 -gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" | |
83 +gmp_assemble="$CCAS $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" | |
84 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5 | |
85 (eval $gmp_assemble) 2>&5 | |
86 ac_status=$? | |
87 @@ -4793,7 +4794,7 @@ | |
88 .align 3 | |
89 | |
90 EOF | |
91 -gmp_assemble="$CC $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" | |
92 +gmp_assemble="$CCAS $CFLAGS $CPPFLAGS -c conftest.s >conftest.out 2>&1" | |
93 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5 | |
94 (eval $gmp_assemble) 2>&5 | |
95 ac_status=$? | |
96 diff -ur nettle-2.5-orig/examples/base16enc.c nettle-2.5/examples/base16enc.c | |
97 --- nettle-2.5-orig/examples/base16enc.c 2012-07-07 09:27:55 -0400 | |
98 +++ nettle-2.5/examples/base16enc.c 2013-06-22 13:11:50 -0400 | |
99 @@ -47,16 +47,18 @@ | |
100 int | |
101 main(int argc UNUSED, char **argv UNUSED) | |
102 { | |
103 + uint8_t * buffer; | |
104 + uint8_t * result; | |
105 | |
106 /* "buffer" will hold the bytes from disk: */ | |
107 - uint8_t * buffer = (uint8_t *) malloc (CHUNK_SIZE * sizeof(uint8_t)); | |
108 + buffer = (uint8_t *) malloc (CHUNK_SIZE * sizeof(uint8_t)); | |
109 if (buffer == NULL) { | |
110 fprintf (stderr, "Cannot allocate read buffer.\n"); | |
111 return EXIT_FAILURE; | |
112 } | |
113 | |
114 /* "result" will hold bytes before output: */ | |
115 - uint8_t * result = (uint8_t *) malloc (ENCODED_SIZE * sizeof(uint8_t)); | |
116 + result = (uint8_t *) malloc (ENCODED_SIZE * sizeof(uint8_t)); | |
117 if (result == NULL) { | |
118 fprintf (stderr, "Cannot allocate write buffer.\n"); | |
119 return EXIT_FAILURE; | |
120 diff -ur nettle-2.5-orig/nettle-meta.h nettle-2.5/nettle-meta.h | |
121 --- nettle-2.5-orig/nettle-meta.h 2012-07-07 09:27:54 -0400 | |
122 +++ nettle-2.5/nettle-meta.h 2013-06-22 13:11:19 -0400 | |
123 @@ -28,6 +28,16 @@ | |
124 | |
125 #include "nettle-types.h" | |
126 | |
127 +#ifdef _MSC_VER | |
128 +# ifdef BUILDING_NETTLE | |
129 +# define NETTLE_EXPORTED __declspec(dllexport) | |
130 +# else | |
131 +# define NETTLE_EXPORTED __declspec(dllimport) | |
132 +# endif | |
133 +#else | |
134 +# define NETTLE_EXPORTED | |
135 +#endif | |
136 + | |
137 #ifdef __cplusplus | |
138 extern "C" { | |
139 #endif | |
140 @@ -97,32 +107,32 @@ | |
141 } | |
142 | |
143 /* null-terminated list of ciphers implemented by this version of nettle */ | |
144 -extern const struct nettle_cipher * const nettle_ciphers[]; | |
145 +extern NETTLE_EXPORTED const struct nettle_cipher * const nettle_ciphers[]; | |
146 | |
147 -extern const struct nettle_cipher nettle_aes128; | |
148 -extern const struct nettle_cipher nettle_aes192; | |
149 -extern const struct nettle_cipher nettle_aes256; | |
150 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_aes128; | |
151 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_aes192; | |
152 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_aes256; | |
153 | |
154 -extern const struct nettle_cipher nettle_arcfour128; | |
155 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_arcfour128; | |
156 | |
157 -extern const struct nettle_cipher nettle_camellia128; | |
158 -extern const struct nettle_cipher nettle_camellia192; | |
159 -extern const struct nettle_cipher nettle_camellia256; | |
160 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_camellia128; | |
161 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_camellia192; | |
162 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_camellia256; | |
163 | |
164 -extern const struct nettle_cipher nettle_cast128; | |
165 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_cast128; | |
166 | |
167 -extern const struct nettle_cipher nettle_serpent128; | |
168 -extern const struct nettle_cipher nettle_serpent192; | |
169 -extern const struct nettle_cipher nettle_serpent256; | |
170 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_serpent128; | |
171 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_serpent192; | |
172 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_serpent256; | |
173 | |
174 -extern const struct nettle_cipher nettle_twofish128; | |
175 -extern const struct nettle_cipher nettle_twofish192; | |
176 -extern const struct nettle_cipher nettle_twofish256; | |
177 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_twofish128; | |
178 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_twofish192; | |
179 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_twofish256; | |
180 | |
181 -extern const struct nettle_cipher nettle_arctwo40; | |
182 -extern const struct nettle_cipher nettle_arctwo64; | |
183 -extern const struct nettle_cipher nettle_arctwo128; | |
184 -extern const struct nettle_cipher nettle_arctwo_gutmann128; | |
185 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_arctwo40; | |
186 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_arctwo64; | |
187 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_arctwo128; | |
188 +extern NETTLE_EXPORTED const struct nettle_cipher nettle_arctwo_gutmann128; | |
189 | |
190 struct nettle_hash | |
191 { | |
192 @@ -153,17 +163,17 @@ | |
193 } | |
194 | |
195 /* null-terminated list of digests implemented by this version of nettle */ | |
196 -extern const struct nettle_hash * const nettle_hashes[]; | |
197 +extern NETTLE_EXPORTED const struct nettle_hash * const nettle_hashes[]; | |
198 | |
199 -extern const struct nettle_hash nettle_md2; | |
200 -extern const struct nettle_hash nettle_md4; | |
201 -extern const struct nettle_hash nettle_md5; | |
202 -extern const struct nettle_hash nettle_ripemd160; | |
203 -extern const struct nettle_hash nettle_sha1; | |
204 -extern const struct nettle_hash nettle_sha224; | |
205 -extern const struct nettle_hash nettle_sha256; | |
206 -extern const struct nettle_hash nettle_sha384; | |
207 -extern const struct nettle_hash nettle_sha512; | |
208 +extern NETTLE_EXPORTED const struct nettle_hash nettle_md2; | |
209 +extern NETTLE_EXPORTED const struct nettle_hash nettle_md4; | |
210 +extern NETTLE_EXPORTED const struct nettle_hash nettle_md5; | |
211 +extern NETTLE_EXPORTED const struct nettle_hash nettle_ripemd160; | |
212 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha1; | |
213 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha224; | |
214 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha256; | |
215 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha384; | |
216 +extern NETTLE_EXPORTED const struct nettle_hash nettle_sha512; | |
217 | |
218 struct nettle_armor | |
219 { | |
220 @@ -215,10 +225,10 @@ | |
221 } | |
222 | |
223 /* null-terminated list of armor schemes implemented by this version of nettle */ | |
224 -extern const struct nettle_armor * const nettle_armors[]; | |
225 +extern NETTLE_EXPORTED const struct nettle_armor * const nettle_armors[]; | |
226 | |
227 -extern const struct nettle_armor nettle_base64; | |
228 -extern const struct nettle_armor nettle_base16; | |
229 +extern NETTLE_EXPORTED const struct nettle_armor nettle_base64; | |
230 +extern NETTLE_EXPORTED const struct nettle_armor nettle_base16; | |
231 | |
232 #ifdef __cplusplus | |
233 } | |
234 diff -ur nettle-2.5-orig/tools/sexp-conv.c nettle-2.5/tools/sexp-conv.c | |
235 --- nettle-2.5-orig/tools/sexp-conv.c 2012-07-07 09:27:54 -0400 | |
236 +++ nettle-2.5/tools/sexp-conv.c 2013-06-22 13:12:00 -0400 | |
237 @@ -225,7 +225,7 @@ | |
238 | |
239 for (;;) | |
240 { | |
241 - static const struct nettle_hash *hashes[] = | |
242 + const struct nettle_hash *hashes[] = | |
243 { &nettle_md5, &nettle_sha1, &nettle_sha256, NULL }; | |
244 | |
245 static const struct option options[] = |