Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From bb693db0e1d1d693e8ca31fcbc4f46d1674eeca1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Thu, 13 Sep 2018 14:20:57 +0800 |
| 4 | Subject: [PATCH] makeinit.sh: fix parallel build issue |
| 5 | |
| 6 | While building plugins, each <plugin>.c requires a <plugin>_init.c, |
| 7 | and the <plugin>_init.c is dynamically generated by makeinit.sh. |
| 8 | |
| 9 | But the makeinit.sh generates all *_init.c (13 mechanism plugins, |
| 10 | 3 auxprop plugins) at one time, if there are multiple plugins, |
| 11 | there will be multiple makeinit.sh invoking. |
| 12 | |
| 13 | It caused a parallel issue, the *_init.c files will be generated |
| 14 | repeatedly. |
| 15 | |
| 16 | It occasionally generate dapdb_init.c incorrectly |
| 17 | [snip plugins/ldapdb_init.c] |
| 18 | SASL_CANONUSER_PLUG_INIT( ldapdb ) |
| 19 | SASL_CANONUSER_PLUG_INIT( ldapdb ) |
| 20 | SASL_CANONUSER_PLUG_INIT( ldapdb ) |
| 21 | [snip plugins/ldapdb_init.c] |
| 22 | |
| 23 | Let makeinit.sh generate the expected <plugin>_init.c which |
| 24 | is exactly required by <plugin>.c. |
| 25 | |
| 26 | Upstream-Status: Submitted [https://github.com/cyrusimap/cyrus-sasl/pull/532] |
| 27 | |
| 28 | Signed-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 | |
| 34 | diff --git a/plugins/Makefile.am b/plugins/Makefile.am |
| 35 | index 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 $@ |
| 44 | diff --git a/plugins/makeinit.sh b/plugins/makeinit.sh |
| 45 | index 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 | -- |
| 94 | 2.7.4 |
| 95 | |