#!/bin/sh class=basetransform GST_IS_REPLACE=MY_IS_EXAMPLE GST_REPLACE=MY_EXAMPLE GST_TYPE_REPLACE=MY_TYPE_EXAMPLE GstReplace=MyExample gst_replace=my_example gstreplace=myexample replace=example source=gst$class.c pkg=`grep -A 10000 '^% pkg-config' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1` GST_TYPE_BASE_REPLACE=`grep -A 10000 '^% TYPE_CLASS_NAME' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1` GstBaseReplace=`grep -A 10000 '^% ClassName' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1` generate () { grep -A 10000 '^% copyright' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 cat <"); } static void gst_replace_class_init (GstReplaceClass * klass) { EOF grep -A 10000 '^% declare-class' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% declare-class' gobject.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% declare-class' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 echo grep -A 10000 '^% set-methods' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% set-methods' gobject.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% set-methods' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 cat <myexample.c generate_header | sed \ -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \ -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \ -e "s/GstBaseReplace/$GstBaseReplace/g" \ -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \ -e "s/GST_REPLACE/$GST_REPLACE/g" \ -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \ -e "s/GstReplace/$GstReplace/g" \ -e "s/gst_replace/$gst_replace/g" \ -e "s/gstreplace/$gstreplace/g" \ -e "s/replace/$replace/g" >myexample.h gst-indent myexample.c echo pkg is $pkg gcc -Wall $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o myexample.o myexample.c gcc -shared -o myexample.so myexample.o $(pkg-config --libs gstreamer-0.10 $pkg)