initial import from CVS gstreamer/gst-template/gst-plugin
[gst-scaletempo-rj.git] / tools / make_element
blob434c1b1476a2ecdc80a4cbd150da06d100ec71af
1 #!/bin/sh
3 Template=$1;
4 srcfile=$2.c;
5 srcfile_h=$2.h;
7 if test x"$1" = x ; then
8 echo "$0 Objectname [srcfile]\n";
9 echo " creates gstobjectname.{c,h} implementing GstObjectname\n";
10 exit 1;
13 if test x"$2" = x ; then
14 srcfile="gstplugin.c"
15 srcfile_h="gstplugin.h"
18 id=$(echo '$Id: make_element,v 1.4 2007-01-22 12:16:02 tpm Exp $' | sed \
19 -e 's/\$I[d]: \([^$]*\)\$/\1/g' \
22 TEMPLATE=$(echo $Template | tr a-z A-Z)
23 template=$(echo $Template | tr A-Z a-z)
24 filename=$(echo $template | tr -d _)
25 Template=$(echo $Template | tr -d _)
27 # remember to break up the Id: in the line below
28 sed \
29 -e 's/gstplugin\.c/SOURCEFILE/g' \
30 -e "s/gstplugin\.h/gst$filename.h/g" \
31 -e "s/GstPluginTemplate/Gst$Template/g" \
32 -e "s/gst_plugin_template/gst_$template/g" \
33 -e "s/gst_type_plugin_template/gst_$template/g" \
34 -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \
35 -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \
36 -e 's/\$I[d]: \([^$]*\)\$/\1/g' \
37 -e 's/SOURCEFILE/gstobject\.c/g' \
38 -e "s%MAKEFILTERVERSION%$id%g" \
39 $srcfile >gst$filename.c.tmp && mv gst$filename.c.tmp gst$filename.c
41 sed \
42 -e 's/gstplugin\.c/SOURCEFILE/g' \
43 -e "s/GstPluginTemplate/Gst$Template/g" \
44 -e "s/gst_plugin_template/gst_$template/g" \
45 -e "s/gst_type_plugin_template/gst_$template/g" \
46 -e "s/GST_PLUGIN_TEMPLATE/GST_$TEMPLATE/g" \
47 -e "s/GST_TYPE_PLUGIN_TEMPLATE/GST_TYPE_$TEMPLATE/g" \
48 -e "s/GST_IS_PLUGIN_TEMPLATE/GST_IS_$TEMPLATE/g" \
49 -e 's/\$I[d]: \([^$]*\)\$/\1/g' \
50 -e 's/SOURCEFILE/gstobject\.c/g' \
51 -e "s%MAKEFILTERVERSION%$id%g" \
52 $srcfile_h >gst$filename.h.tmp && mv gst$filename.h.tmp gst$filename.h