summaryrefslogtreecommitdiff
path: root/meta-openembedded/meta-networking/recipes-daemons/cyrus-sasl/cyrus-sasl/0001-makeinit.sh-fix-parallel-build-issue.patch
blob: bf232ac272ea27aba8fb6f73c5b3c3ceb89bc534 (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
From bb693db0e1d1d693e8ca31fcbc4f46d1674eeca1 Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
Date: Thu, 13 Sep 2018 14:20:57 +0800
Subject: [PATCH] makeinit.sh: fix parallel build issue

While building plugins, each <plugin>.c requires a <plugin>_init.c,
and the <plugin>_init.c is dynamically generated by makeinit.sh.

But the makeinit.sh generates all *_init.c (13 mechanism plugins,
3 auxprop plugins) at one time, if there are multiple plugins,
there will be multiple makeinit.sh invoking.

It caused a parallel issue, the *_init.c files will be generated
repeatedly.

It occasionally generate dapdb_init.c incorrectly
[snip plugins/ldapdb_init.c]
SASL_CANONUSER_PLUG_INIT( ldapdb )
SASL_CANONUSER_PLUG_INIT( ldapdb )
SASL_CANONUSER_PLUG_INIT( ldapdb )
[snip plugins/ldapdb_init.c]

Let makeinit.sh generate the expected <plugin>_init.c which
is exactly required by <plugin>.c.

Upstream-Status: Submitted [https://github.com/cyrusimap/cyrus-sasl/pull/532]

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 plugins/Makefile.am |  2 +-
 plugins/makeinit.sh | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 929f6a4..81e7f0b 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -149,4 +149,4 @@ passdss_init.c sasldb_init.c sql_init.c ldapdb_init.c
 CLEANFILES=$(init_src)
 
 ${init_src}: $(srcdir)/makeinit.sh
-	$(SHELL) $(srcdir)/makeinit.sh
+	$(SHELL) $(srcdir)/makeinit.sh $@
diff --git a/plugins/makeinit.sh b/plugins/makeinit.sh
index cc65f7d..3131877 100644
--- a/plugins/makeinit.sh
+++ b/plugins/makeinit.sh
@@ -1,7 +1,9 @@
+plugin_init="$1"
 # mechanism plugins
 for mech in anonymous crammd5 digestmd5 scram gssapiv2 kerberos4 login ntlm otp passdss plain srp gs2; do
+    if [ ${plugin_init} = "${mech}_init.c" ];then
 
-echo "
+        echo "
 #include <config.h>
 
 #include <string.h>
@@ -43,13 +45,16 @@ BOOL APIENTRY DllMain( HANDLE hModule,
 
 SASL_CLIENT_PLUG_INIT( $mech )
 SASL_SERVER_PLUG_INIT( $mech )
-" > ${mech}_init.c
+"       > ${mech}_init.c
+        echo "generating $1"
+    fi # End of `if [ ${plugin_init} = "${mech}_init.c" ];then'
 done
 
 # auxprop plugins
 for auxprop in sasldb sql ldapdb; do
+    if [ ${plugin_init} = "${auxprop}_init.c" ];then
 
-echo "
+        echo "
 #include <config.h>
 
 #include <string.h>
@@ -86,8 +91,12 @@ BOOL APIENTRY DllMain( HANDLE hModule,
 #endif
 
 SASL_AUXPROP_PLUG_INIT( $auxprop )
-" > ${auxprop}_init.c
+"       > ${auxprop}_init.c
+        echo "generating $1"
+    fi # End of `if [ ${plugin_init} = "${auxprop}_init.c" ];then'
 done
 
 # ldapdb is also a canon_user plugin
-echo "SASL_CANONUSER_PLUG_INIT( ldapdb )" >> ldapdb_init.c
+if [ ${plugin_init} = "ldapdb_init.c" ];then
+    echo "SASL_CANONUSER_PLUG_INIT( ldapdb )" >> ldapdb_init.c
+fi
-- 
2.7.4