Package: webfs / 1.21+ds1-12

85_conditional_gcrypt.diff Patch series | download
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
Description: Make libgcrypt conditional.
 More recent versions of libgnutls no longer
 require libgcrypt as an unconditional dependency.
 Adjust to this fact.
Author: Mats Erik Andersson <debian@gisladisker.se>
Bug-Debian: http://bugs.debian.org/746159
Forwarded: not-needed
Last-Update: 2014-06-27

--- webfs-1.21+ds1.debian/GNUmakefile
+++ webfs-1.21+ds1/GNUmakefile
@@ -46,10 +46,12 @@ CFLAGS	+= -DUSE_THREADS=1 -D_REENTRANT -
 endif
 
 ifeq ($(USE_GNUTLS),yes)
+COND_GCRYPT = $(shell if pkg-config --exists 'gnutls <= 2.11'; then echo '-lgcrypt'; fi)
+
 USE_SSL = no
 CFLAGS	+= -DUSE_GNUTLS=1
 OBJS	+= ssl.o
-LDLIBS	+= -lgnutls -lgcrypt
+LDLIBS	+= -lgnutls $(COND_GCRYPT)
 endif
 
 
--- webfs-1.21+ds1.debian/webfsd.c
+++ webfs-1.21+ds1/webfsd.c
@@ -25,10 +25,12 @@
 #include "httpd.h"
 
 #ifdef USE_GNUTLS
-#include <gcrypt.h>
-# if USE_THREADS
-   GCRY_THREAD_OPTION_PTHREAD_IMPL;
-# endif
+# if GNUTLS_VERSION_NUMBER <= 0x020b00
+#  include <gcrypt.h>
+#  if USE_THREADS
+    GCRY_THREAD_OPTION_PTHREAD_IMPL;
+#  endif /* USE_THREADS */
+# endif /* GNUTLS_VERSION_NUMBER */
 #endif /* USE_GNUTLS */
 
 /* ---------------------------------------------------------------------- */
@@ -812,11 +814,13 @@ main(int argc, char *argv[])
 #endif
 
 #ifdef USE_GNUTLS
+# if GNUTLS_VERSION_NUMBER <= 0x020b00
     /* Avoid using '/dev/random' since it blocks reading. */
     gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0);
 #  if USE_THREADS
     gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
-#  endif
+#  endif /* USE_THREADS */
+# endif /* GNUTLS_VERSION_NUMBER */
 #endif /* USE_GNUTLS */
 
     uid  = getuid();