summaryrefslogtreecommitdiff
path: root/recipes/glib-networking/0001-gnutls-add-initial-support-for-static-builds.patch
blob: c94c32f5c97eca2f353cf2d838725d53eb4a8e92 (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
From 7bb395ad65ae6bf0f61ce50675c5b23f234fd412 Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <ylatuya@gmail.com>
Date: Fri, 28 Feb 2014 10:02:31 +0100
Subject: [PATCH] gnutls: add initial support for static builds

---
 configure.ac               | 20 ++++++++++++++++++++
 glib-networking.mk         |  5 ++++-
 tls/gnutls/gnutls-module.c | 15 ++++++++-------
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4234209..918ff81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -233,6 +233,26 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
 		-Werror=declaration-after-statement"
 fi
 
+dnl ****************************************************
+dnl *** Check for GIO static modules                 ***
+dnl ****************************************************
+AC_MSG_CHECKING([whether to build static modules or not])
+AC_ARG_ENABLE(
+  static-modules,
+  AC_HELP_STRING(
+    [--enable-static-modules],
+    [build static modules @<:@default=no@:>@]),
+  [AS_CASE(
+    [$enableval], [no], [], [yes], [],
+    [AC_MSG_ERROR([bad value "$enableval" for --enable-static-modules])])],
+  [enable_static_modules=no])
+AC_MSG_RESULT([$enable_static_modules])
+if test "x$enable_static_modules" = xyes; then
+  AC_DEFINE(G_IO_MODULE_BUILD_STATIC, 1,
+    [Define if static modules should be built])
+fi
+AM_CONDITIONAL(G_IO_MODULE_BUILD_STATIC, [test "x$enable_static_modules" = "xyes"])
+
 dnl *****************************
 dnl *** done                  ***
 dnl *****************************
diff --git a/glib-networking.mk b/glib-networking.mk
index 29b6a6a..5231766 100644
--- a/glib-networking.mk
+++ b/glib-networking.mk
@@ -1,6 +1,9 @@
 ### glib-networking declarations
 
-module_flags = -export_dynamic -avoid-version -module -no-undefined -export-symbols-regex '^g_io_module_(load|unload|query)'
+module_flags = -export_dynamic -avoid-version -module -no-undefined
+if !G_IO_MODULE_BUILD_STATIC
+module_flags += -export-symbols-regex '^g_io_module_(load|unload|query)'
+endif
 
 giomoduledir = $(GIO_MODULE_DIR)
 
diff --git a/tls/gnutls/gnutls-module.c b/tls/gnutls/gnutls-module.c
index a725f9b..ceddf22 100644
--- a/tls/gnutls/gnutls-module.c
+++ b/tls/gnutls/gnutls-module.c
@@ -24,9 +24,8 @@
 #include "gtlsbackend-gnutls.h"
 #include "gtlsbackend-gnutls-pkcs11.h"
 
-
-void
-g_io_module_load (GIOModule *module)
+static void
+_g_io_module_load (GIOModule *module)
 {
   g_tls_backend_gnutls_register (module);
 #ifdef HAVE_PKCS11
@@ -34,13 +33,13 @@ g_io_module_load (GIOModule *module)
 #endif
 }
 
-void
-g_io_module_unload (GIOModule *module)
+static void
+_g_io_module_unload (GIOModule *module)
 {
 }
 
-gchar **
-g_io_module_query (void)
+static gchar **
+_g_io_module_query (void)
 {
   gchar *eps[] = {
     G_TLS_BACKEND_EXTENSION_POINT_NAME,
@@ -48,3 +47,5 @@ g_io_module_query (void)
   };
   return g_strdupv (eps);
 }
+
+G_IO_MODULE_DEFINE(gnutls);
-- 
1.9.0