blob: bf232ac272ea27aba8fb6f73c5b3c3ceb89bc534 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From bb693db0e1d1d693e8ca31fcbc4f46d1674eeca1 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 13 Sep 2018 14:20:57 +0800
4Subject: [PATCH] makeinit.sh: fix parallel build issue
5
6While building plugins, each <plugin>.c requires a <plugin>_init.c,
7and the <plugin>_init.c is dynamically generated by makeinit.sh.
8
9But the makeinit.sh generates all *_init.c (13 mechanism plugins,
103 auxprop plugins) at one time, if there are multiple plugins,
11there will be multiple makeinit.sh invoking.
12
13It caused a parallel issue, the *_init.c files will be generated
14repeatedly.
15
16It occasionally generate dapdb_init.c incorrectly
17[snip plugins/ldapdb_init.c]
18SASL_CANONUSER_PLUG_INIT( ldapdb )
19SASL_CANONUSER_PLUG_INIT( ldapdb )
20SASL_CANONUSER_PLUG_INIT( ldapdb )
21[snip plugins/ldapdb_init.c]
22
23Let makeinit.sh generate the expected <plugin>_init.c which
24is exactly required by <plugin>.c.
25
26Upstream-Status: Submitted [https://github.com/cyrusimap/cyrus-sasl/pull/532]
27
28Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
29---
30 plugins/Makefile.am | 2 +-
31 plugins/makeinit.sh | 19 ++++++++++++++-----
32 2 files changed, 15 insertions(+), 6 deletions(-)
33
34diff --git a/plugins/Makefile.am b/plugins/Makefile.am
35index 929f6a4..81e7f0b 100644
36--- a/plugins/Makefile.am
37+++ b/plugins/Makefile.am
38@@ -149,4 +149,4 @@ passdss_init.c sasldb_init.c sql_init.c ldapdb_init.c
39 CLEANFILES=$(init_src)
40
41 ${init_src}: $(srcdir)/makeinit.sh
42- $(SHELL) $(srcdir)/makeinit.sh
43+ $(SHELL) $(srcdir)/makeinit.sh $@
44diff --git a/plugins/makeinit.sh b/plugins/makeinit.sh
45index cc65f7d..3131877 100644
46--- a/plugins/makeinit.sh
47+++ b/plugins/makeinit.sh
48@@ -1,7 +1,9 @@
49+plugin_init="$1"
50 # mechanism plugins
51 for mech in anonymous crammd5 digestmd5 scram gssapiv2 kerberos4 login ntlm otp passdss plain srp gs2; do
52+ if [ ${plugin_init} = "${mech}_init.c" ];then
53
54-echo "
55+ echo "
56 #include <config.h>
57
58 #include <string.h>
59@@ -43,13 +45,16 @@ BOOL APIENTRY DllMain( HANDLE hModule,
60
61 SASL_CLIENT_PLUG_INIT( $mech )
62 SASL_SERVER_PLUG_INIT( $mech )
63-" > ${mech}_init.c
64+" > ${mech}_init.c
65+ echo "generating $1"
66+ fi # End of `if [ ${plugin_init} = "${mech}_init.c" ];then'
67 done
68
69 # auxprop plugins
70 for auxprop in sasldb sql ldapdb; do
71+ if [ ${plugin_init} = "${auxprop}_init.c" ];then
72
73-echo "
74+ echo "
75 #include <config.h>
76
77 #include <string.h>
78@@ -86,8 +91,12 @@ BOOL APIENTRY DllMain( HANDLE hModule,
79 #endif
80
81 SASL_AUXPROP_PLUG_INIT( $auxprop )
82-" > ${auxprop}_init.c
83+" > ${auxprop}_init.c
84+ echo "generating $1"
85+ fi # End of `if [ ${plugin_init} = "${auxprop}_init.c" ];then'
86 done
87
88 # ldapdb is also a canon_user plugin
89-echo "SASL_CANONUSER_PLUG_INIT( ldapdb )" >> ldapdb_init.c
90+if [ ${plugin_init} = "ldapdb_init.c" ];then
91+ echo "SASL_CANONUSER_PLUG_INIT( ldapdb )" >> ldapdb_init.c
92+fi
93--
942.7.4
95