Merged revisions 69689 via svnmerge from
[asterisk/asterisk.git] / build_tools / prep_moduledeps
1 #!/bin/sh
2
3 get_description() {
4         TDESC=`grep -e AST_MODULE_INFO ${1} | head -n 1 | cut -d '"' -f 2`
5 }
6
7 process_dir() {
8         dir=${1}
9         prefix=${2}_
10         catsuffix=${3}
11         displayname=${4}
12
13         printf "\t<category name=\"MENUSELECT_${catsuffix}\" displayname=\"${displayname}\" remove_on_change=\"${dir}/modules.link\">\n"
14         for file in `ls ${dir}/${prefix}*.c ${dir}/${prefix}*.cc 2> /dev/null | sort`
15         do
16                 if [ ! -f ${file} ]; then
17                         continue
18                 fi
19                 fname=`basename ${file} .c`
20                 fname=`basename ${fname} .cc`
21                 get_description ${file}
22                 desc=${TDESC}
23                 printf "\t\t<member name=\"${fname}\" displayname=\"${desc}\" remove_on_change=\"${dir}/${fname}.o ${dir}/${fname}.oo ${dir}/${fname}.so\">\n"
24                 awk -f build_tools/get_moduleinfo ${file}
25                 printf "\t\t</member>\n"
26                 awk -f build_tools/get_makeopts ${file} >> .makeoptstmp
27         done
28         printf "\t</category>\n"
29 }
30
31 echo "<?xml version=\"1.0\"?>"
32 echo
33 echo "<menu name=\"Asterisk Module Selection\">"
34 rm -f .makeoptstmp
35 process_dir apps app APPS Applications
36 process_dir cdr cdr CDR "Call Detail Recording"
37 process_dir channels chan CHANNELS "Channel Drivers"
38 process_dir codecs codec CODECS "Codec Translators"
39 process_dir formats format FORMATS "Format Interpreters"
40 process_dir funcs func FUNCS "Dialplan Functions"
41 process_dir pbx pbx PBX "PBX Modules"
42 process_dir res res RES "Resource Modules"
43 cat .makeoptstmp
44 cat build_tools/cflags.xml
45 cat build_tools/embed_modules.xml
46 cat sounds/sounds.xml
47 rm -f .makeoptstmp
48 echo "</menu>"