gambas-source-code/TEMPLATE/make-component
Benoît Minisini 7790bd8e1e [CONFIGURATION]
* BUG: Add many mising symbolic links on 'missing' and 'install-sh' files.
* NEW: Introduce Gambas minor version number.

[DEVELOPMENT ENVIRONMENT]
* NEW: Packager now uses minor version of Gambas for default component 
  requirements.

[INTERPRETER]
* NEW: System properties were replaced by constants where it is possible.
* NEW: System.FullVersion is a new constant that returns the full Gambas 
  version string, with major and minor numbers.


git-svn-id: svn://localhost/gambas/trunk@2781 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2010-03-10 00:14:54 +00:00

61 lines
2 KiB
Bash
Executable file

#!/bin/sh
if test -d ../$1; then
echo "$0: error: This component already exists";
exit 1;
fi
if test ! -e ./conf/$1.conf; then
echo "$0: error: The configuration file for this component does not exist";
exit 1;
fi
if test x`which cpp` == x; then
echo "$0: error: cpp was not found";
exit 1;
fi
echo "Creating component directory $1..."
cp -R template ../$1
pushd . > /dev/null
cd ../$1
rm -f `find . -name \*~`
for i in ../acinclude.m4 ../component.am ../config.guess ../config.sub ../main/share/gambas.h ../main/share/gb_common.h ../ltmain.sh ../reconf ../INSTALL ../COPYING ../missing ../install-sh; do
ln -s $i;
done
popd > /dev/null
echo "Applying template..."
for i in ../$1/* ../$1/*/*; do
if test ! -h $i && test ! -d $i; then
cpp -P -include ./conf/$1.conf -o $i.out $i;
rm -f $i;
cat $i.out | sed s/"\\$\/\\$"/"\/"/g | sed s/"\\$'\\$"/"\""/g | sed s/"\\$:\\$"/"\""/g | sed s/"\\$\#\\$"/"\#"/g | sed s/"\#@\#"/"@"/g | sed s/"\#\#"/""/g > $i;
rm -f $i.out;
fi
done
echo "Creating source files..."
for i in `cat ../$1/SOURCES`; do
BASENAME=`basename $i`;
SOURCE=../$1/src/$i;
if test ! `basename $i .h` = $BASENAME; then
cpp -P -include ./conf/$1.conf -D__SOURCE_NAME=`basename $i .h` -D__SOURCE_UNAME=`basename $i .h | tr '[:lower:]' '[:upper:]'` -o $SOURCE TEMPLATE.h;
elif test ! `basename $i .c` = $BASENAME; then
cpp -P -include ./conf/$1.conf -D__SOURCE_NAME=`basename $i .c` -D__SOURCE_UNAME=`basename $i .c | tr '[:lower:]' '[:upper:]'` -o $SOURCE TEMPLATE.c;
elif test ! `basename $i .cpp` = $BASENAME; then
cpp -P -include ./conf/$1.conf -D__SOURCE_NAME=`basename $i .cpp` -D__SOURCE_UNAME=`basename $i .cpp | tr '[:lower:]' '[:upper:]'` -o $SOURCE TEMPLATE.cpp;
fi
cat $SOURCE | sed s/"\\$\/\\$"/"\/"/g | sed s/"\\$'\\$"/"\""/g | sed s/"\\$:\\$"/"\""/g | sed s/"\\$\#\\$"/"\#"/g | sed s/"\#@\#"/"@"/g | sed s/"\#\#"/""/g > $SOURCE.tmp;
rm -f $SOURCE;
mv $SOURCE.tmp $SOURCE;
done
rm -f ../$1/SOURCES
pushd . > /dev/null
cd ../$1
(source ./make-component)
rm -f make-component
popd > /dev/null