qse/ase/rel/rel.sh

145 lines
2.5 KiB
Bash
Raw Normal View History

2007-02-03 11:54:02 +00:00
#!/bin/sh
finalize ()
{
2007-02-04 13:01:26 +00:00
cur="$1"; dir="$2";
2007-02-03 11:54:02 +00:00
if [ "$dir" = "" ]
then
2007-02-04 13:01:26 +00:00
cd "$BASE"
2007-02-03 11:54:02 +00:00
else
2007-02-04 13:01:26 +00:00
cd "$BASE/$dir"
2007-02-03 11:54:02 +00:00
fi
for i in *
do
if [ "$i" = "*" ]; then continue; fi
if [ "$i" = "CVS" ]; then continue; fi
2007-02-04 12:37:46 +00:00
if [ "$i" = "stx" ]; then continue; fi
2007-02-03 11:54:02 +00:00
if [ "$cur" = "" ]
then
file="$i"
2007-02-04 13:01:26 +00:00
full="$BASE/$i"
2007-02-03 11:54:02 +00:00
else
file="$cur/$i"
2007-02-04 13:01:26 +00:00
full="$BASE/$cur/$i"
2007-02-03 11:54:02 +00:00
fi
if [ -d "$full" ]
then
if [ "$dir" = "" ]
then
new="$i"
else
new="$dir/$i"
fi
2007-02-04 13:01:26 +00:00
finalize "$file" "$new"
cur="$1"; dir="$2";
2007-02-03 11:54:02 +00:00
elif [ -f "$full" ]
then
2007-02-04 13:30:35 +00:00
target="$SOURCE_ROOT/ase"
2007-02-03 11:54:02 +00:00
mkdir -p "$target/$cur"
2007-02-04 13:30:35 +00:00
case "$i" in
2007-02-03 11:54:02 +00:00
*.h|*.c|*.cc|*.cpp|*.java|*.awk|*.in)
2007-02-09 14:25:46 +00:00
"$ASEAWK" -f "$BASE/rel/lic.awk" -a "$target/$file" "$full"
2007-02-04 13:07:15 +00:00
;;
*.man)
2007-02-04 13:30:35 +00:00
html=`echo $i | sed 's/.man$/.html/'`
2007-02-09 14:25:46 +00:00
"$ASEAWK" -f "$BASE/rel/doc.awk" "$full" > "$SOURCE_ROOT/html/$html"
2007-02-09 14:39:00 +00:00
"$ASEAWK" -f "$BASE/rel/doc.awk" "$full" > "$ASETGT/$html"
2007-02-04 13:07:15 +00:00
cp -f "$full" "$target/$file"
;;
*.css)
cp -f "$full" "$target/$file"
2007-02-04 13:30:35 +00:00
cp -f "$full" "$SOURCE_ROOT/html/$i"
2007-02-09 14:39:00 +00:00
cp -f "$full" "$ASETGT/$i"
2007-02-03 11:54:02 +00:00
;;
2007-03-22 05:27:58 +00:00
*.dsp|*.dsw|*.sln|*.vcproj)
"$ASEAWK" -f "$BASE/rel/unix2dos.awk" "$full" > "$target/$file"
;;
descrip.mms)
2007-03-22 04:01:14 +00:00
"$ASEAWK" -f "$BASE/rel/unix2dos.awk" "$full" > "$target/$file"
;;
2007-03-22 04:16:49 +00:00
*.frx)
cp -f "$full" "$target/$file"
;;
2007-02-03 11:54:02 +00:00
*)
2007-03-22 04:15:16 +00:00
if [ "$dir" = "test/com" ]
then
"$ASEAWK" -f "$BASE/rel/unix2dos.awk" "$full" > "$target/$file"
else
cp -f "$full" "$target/$file"
fi
2007-02-03 11:54:02 +00:00
;;
esac
fi
done
}
2007-02-04 12:37:46 +00:00
2007-03-22 05:27:58 +00:00
print_usage ()
{
echo "Usage: $0 awk version target archiver"
echo "where awk := full path to aseawk"
echo " version := any string"
echo " target := full path to the target directory"
echo " archiver := gzip | zip"
}
2007-02-04 13:33:56 +00:00
############################
# BEGINNING OF THE PROGRAM #
############################
2007-02-04 13:07:15 +00:00
2007-03-22 05:27:58 +00:00
if [ $# -ne 4 ]
2007-02-09 14:25:46 +00:00
then
2007-03-22 05:27:58 +00:00
print_usage "$0"
exit 1
fi
if [ "$4" != "gzip" -a "$4" != "zip" ]
then
print_usage "$0"
2007-02-09 14:25:46 +00:00
exit 1
fi
ASEAWK="$1"
ASEVER="$2"
2007-02-09 14:39:00 +00:00
ASETGT="$3"
2007-03-22 05:27:58 +00:00
ASEARC="$4"
2007-02-04 12:41:21 +00:00
2007-02-04 13:33:56 +00:00
CURDIR=`pwd`
2007-02-03 11:54:02 +00:00
cd ".."
2007-02-04 13:01:26 +00:00
BASE=`pwd`
2007-02-04 13:33:56 +00:00
2007-02-09 14:39:00 +00:00
SOURCE_ROOT="$ASETGT/ase-$ASEVER"
2007-02-04 13:30:35 +00:00
2007-02-09 14:39:00 +00:00
rm -rf "$ASETGT"
mkdir -p "$ASETGT"
2007-02-04 13:30:35 +00:00
mkdir -p "$SOURCE_ROOT"
mkdir -p "$SOURCE_ROOT/html"
2007-02-04 13:00:37 +00:00
2007-02-04 13:01:26 +00:00
finalize "" ""
2007-02-04 13:00:37 +00:00
2007-02-09 14:39:00 +00:00
cd "$ASETGT"
2007-03-22 05:27:58 +00:00
if [ "$ASEARC" = "gzip" ]
then
tar -cvf "ase-$ASEVER.tar" "ase-$ASEVER"
gzip "ase-$ASEVER.tar"
mv "ase-$ASEVER.tar.gz" "ase-$ASEVER.tgz"
elif [ "$ASEARC" = "zip" ]
then
ls -l
echo zip -r "ase-$ASEVER" "ase-$ASEVER"
zip -r ase "ase-$ASEVER"
mv -f ase.zip "ase-$ASEVER.zip"
fi
2007-02-09 14:25:46 +00:00
rm -rf "ase-$ASEVER"
2007-02-04 13:30:35 +00:00
2007-02-04 13:33:56 +00:00
cd "$CURDIR"
2007-02-03 11:54:02 +00:00
exit 0