Files
php-gtk-src/ext/ext_skel
Andrei Zmievski 9b1cd4cac7 This mega-patch adjusts the build system so that it can work automatically
with either old or new PHP build system. It also updates copyright years
and fixes loading of rc files by test/gtk.php.

Extension writers should take notice of the changes in the build system.
2002-04-11 02:19:50 +00:00

83 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# $Id$
file_list=".cvsignore Makefile.in Makefile.frag config.m4 php_skeleton.c php_skeleton.h skeleton.overrides"
giveup() {
echo $*
echo ""
exit 1
}
usage() {
echo "$0 --widget=name"
echo ""
echo " --widget=name the name of the widget."
echo " It's actually important to name the"
echo " widget properly, e.g. SQPaned and"
echo " not Sqpaned."
echo ""
exit 1
}
if test $# = 0; then
usage
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--widget=?*)
Widget=$optarg
WIDGET=`echo $Widget | tr [a-z] [A-Z]`
widget=`echo $Widget | tr [A-Z] [a-z]`
;;
*)
usage
;;
esac
shift
done
if test -d "$widget"; then
giveup "Directory $widget already exists."
fi
test -f ext_skel || giveup "ext_skel must be in the current directory"
test -d skeleton || giveup "subdirectory skeleton does not exist or is not directory"
echo "Creating directory $widget"
mkdir $widget || giveup "Cannot create directory $widget"
echo "Creating skeleton files"
cd skeleton
cp -a $file_list ../$widget/
cd ../$widget/
perl -p -i -e "s/skeleton/$widget/g" $file_list
perl -p -i -e "s/Skeleton/$Widget/g" $file_list
perl -p -i -e "s/SKELETON/$WIDGET/g" $file_list
perl -p -i -e "s/^dnl //" config.m4
mv php_skeleton.c php_$widget.c
mv php_skeleton.h php_$widget.h
mv skeleton.overrides $widget.overrides
echo "Skeleton built."
echo ""
echo "Now you can create your $widget/$widget.defs file with:"
echo ""
echo -e "\t../generator/h2def.py <path>/$widget.h >$widget/$widget.defs"
echo ""
echo "and don't forget to add the constructor line to $widget.defs:"
echo ""
echo -e "\t(is-constructor-of Gtk$Widget)"
echo ""
echo "in the definition of gtk_${widget}_new"
echo ""