X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmk_module_init.sh;h=4969208d57340435469df0ed6d66bf66f75b9b64;hb=85a7e6b84462d72e14a287d4bbdbd3e41c97e76d;hp=8ffd366327ef2134f6ab64cd2ba17e79c25524d3;hpb=e69b77c29da528ca9b1342e9928ad4413da76c18;p=citadel.git diff --git a/citadel/mk_module_init.sh b/citadel/mk_module_init.sh index 8ffd36632..4969208d5 100755 --- a/citadel/mk_module_init.sh +++ b/citadel/mk_module_init.sh @@ -23,15 +23,70 @@ ECHO=/usr/bin/printf CUR_DIR=`pwd` C_FILE="$CUR_DIR/modules_init.c" H_FILE="$CUR_DIR/modules_init.h" +MOD_FILE="$CUR_DIR/Make_modules" +SRC_FILE="$CUR_DIR/Make_sources" +U_FILE="$CUR_DIR/modules_upgrade.c" /usr/bin/printf "Scanning extension modules for entry points.\n" -/usr/bin/printf "This version of echo $ECHO supports $MINUS_e $MINUS_E.\n" -cat <$C_FILE +#start of the files which inturn removes any existing file +# + +# start the Makefile included file for $SERV_MODULES +cat <$MOD_FILE +# +# Make_modules +# This file is to be included by Makefile to dynamically add modules to the build process +# THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE +# + +EOF -#start ofs the files which inturn removes any existing file +# start the Makefile included file for $SOURCES +cat <$SRC_FILE +# +# Make_sources +# This file is to be included by Makefile to dynamically add modules to the build process +# THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE # + +EOF + +# start the upgrade file +cat <$U_FILE +/* + * $U_FILE + * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE + */ + + + +#include "sysdep.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "citadel.h" +#include "modules_init.h" +#include "sysdep_decls.h" + + + + +void upgrade_modules (void) +{ + + CtdlLogPrintf (CTDL_INFO, "Upgrade modules.\n"); + +EOF + +# start the c file +cat <$C_FILE /* * $C_FILE * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE @@ -44,6 +99,9 @@ cat <$C_FILE #include #include #include +#include +#include +#include #include "citadel.h" #include "modules_init.h" #include "sysdep_decls.h" @@ -54,12 +112,15 @@ extern long DetailErrorFlags; -void initialise_modules (void) +void initialise_modules (int threading) { long filter; nSizErrmsg = 0; - lprintf (CTDL_INFO, "New citadel module init proceedure.\n"); + if (threading) + CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads enabled.\n"); + else + CtdlLogPrintf (CTDL_INFO, "Initialise modules, CtdlThreads not yet enabled.\n"); EOF @@ -75,8 +136,8 @@ cat < $H_FILE #define MODULES_INIT_H #include "ctdl_module.h" extern size_t nSizErrmsg; -void initialise_modules (void); - +void initialise_modules (int threading); +void upgrade_modules(void); EOF for i in serv_*.c @@ -86,11 +147,23 @@ do RES_OUT=`echo $RES | cut -b2-` /usr/bin/printf "Found entry point in file $i\n" cat <> $C_FILE - lprintf (CTDL_INFO, "%%s\n", CTDL_INIT_CALL($RES_OUT)); + CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT)); EOF cat <>$H_FILE CTDL_MODULE_INIT($RES_OUT); +EOF + fi + RES=X`grep CTDL_MODULE_UPGRADE $i | cut -f2 -d\( | cut -f1 -d\)` + if [ $RES != "X" ] ; then + RES_OUT=`echo $RES | cut -b2-` + /usr/bin/printf "Found upgrade point in file $i\n" +cat <> $U_FILE + CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT)); + +EOF +cat <>$H_FILE +CTDL_MODULE_UPGRADE($RES_OUT); EOF fi done @@ -105,15 +178,43 @@ if [ -d "modules" ] ; then for k in *.c do if [ -f "$k" ] ; then +# Add this .c file to the Makefile included list of SOURCES +cat <> $SRC_FILE +SOURCES += modules/$j/$k +EOF + +# Generate a .o file name +O_FILE=`basename $k .c` +O_FILE="$O_FILE.o" +# Add this .o file to the Makefile included list of SERV_MODULES +cat <> $MOD_FILE +SERV_MODULES += modules/$j/$O_FILE +EOF + RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)` if [ $RES != "X" ] ; then RES_OUT=`echo $RES | cut -b2-` /usr/bin/printf "Found entry point in file modules/$j/$k\n" +# Add this entry point to the .c file cat <> $C_FILE - lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT)); + CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT)); EOF +# Add this entry point to the .h file cat <> $H_FILE CTDL_MODULE_INIT($RES_OUT); +EOF + fi + RES=X`grep CTDL_MODULE_UPGRADE $k | cut -f2 -d\( | cut -f1 -d\)` + if [ $RES != "X" ] ; then + RES_OUT=`echo $RES | cut -b2-` + /usr/bin/printf "Found upgrade point in file modules/$j/$k\n" +# Add this entry point to the .c file +cat <> $U_FILE + CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT)); +EOF +# Add this entry point to the .h file +cat <> $H_FILE + CTDL_MODULE_UPGRADE($RES_OUT); EOF fi fi @@ -134,15 +235,39 @@ if [ -d "user_modules" ] ; then for k in *.c do if [ -f "$k" ] ; then +# Add this .c file to the Makefile included list of SOURCES +cat <> $SRC_FILE +SOURCES=\$(SOURCES) user_modules/$j/$k +EOF + +# Generate a .o file name +O_FILE=`basename $k .c` +O_FILE="$O_FILE.o" +# Add this .o file to the Makefile included list of SERV_MODULES +cat <> $MOD_FILE +SERV_MODULES += user_modules/$j/$O_FILE +EOF + RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)` if [ $RES != "X" ] ; then RES_OUT=`echo $RES | cut -b2-` /usr/bin/printf "Found entry point in file user_modules/$j/$k\n" cat <> $C_FILE - lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT)); + CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT)); EOF cat <> $H_FILE CTDL_MODULE_INIT($RES_OUT); +EOF + fi + RES=X`grep CTDL_MODULE_UPGRADE $k | cut -f2 -d\( | cut -f1 -d\)` + if [ $RES != "X" ] ; then + RES_OUT=`echo $RES | cut -b2-` + /usr/bin/printf "Found upgrade point in file user_modules/$j/$k\n" +cat <> $U_FILE + CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT)); +EOF +cat <> $H_FILE +CTDL_MODULE_UPGRADE($RES_OUT); EOF fi fi @@ -160,5 +285,7 @@ cd $CUR_DIR /usr/bin/printf "\t\t\tLogPrintMessages(filter);\n" >> $C_FILE /usr/bin/printf "}\n" >> $C_FILE +#close the upgrade file +/usr/bin/printf "}\n" >> $U_FILE /usr/bin/printf "\n#endif /* MODULES_INIT_H */\n" >> $H_FILE