summaryrefslogtreecommitdiff
path: root/source4/heimdal_build
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-10-30 15:47:03 +1100
committerAndrew Tridgell <tridge@samba.org>2010-10-30 23:49:02 +1100
commita139628423e0a48c1a63321ee054734673f03c9e (patch)
treee3d6d791d624dd1c79f6a88afada915fd72a4b4d /source4/heimdal_build
parenta00657db758ba2a1bdc26f27024d72b8c7a1f114 (diff)
downloadsamba-a139628423e0a48c1a63321ee054734673f03c9e.tar.gz
samba-a139628423e0a48c1a63321ee054734673f03c9e.tar.bz2
samba-a139628423e0a48c1a63321ee054734673f03c9e.zip
s4-waf: added a lexyacc.sh script that manually rebuilds the heimdal parsers
we so rarely need to rebuild these that it is simplest to just run lexyacc.sh when we import a new heimdal release
Diffstat (limited to 'source4/heimdal_build')
-rwxr-xr-xsource4/heimdal_build/lexyacc.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/source4/heimdal_build/lexyacc.sh b/source4/heimdal_build/lexyacc.sh
new file mode 100755
index 0000000000..cee21668e5
--- /dev/null
+++ b/source4/heimdal_build/lexyacc.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# rebuild our heimdal lex/yacc files. Run this manually if you update heimdal
+
+lexfiles="heimdal/lib/asn1/lex.l heimdal/lib/hx509/sel-lex.l heimdal/lib/com_err/lex.l"
+yaccfiles="heimdal/lib/asn1/asn1parse.y heimdal/lib/hx509/sel-gram.y heimdal/lib/com_err/parse.y"
+
+set -e
+
+LEX="lex"
+YACC="yacc"
+
+top=$PWD
+
+call_lex() {
+ lfile="$1"
+
+ echo "Calling $LEX on $lfile"
+
+ dir=$(dirname $lfile)
+ base=$(basename $lfile .l)
+ cfile=$base".c"
+ lfile=$base".l"
+
+ cd $dir
+
+ $LEX $lfile || exit 1
+
+ if [ -r lex.yy.c ]; then
+ echo "#include \"config.h\"" > $base.c
+ sed -e "s|lex\.yy\.c|$DEST|" lex.yy.c >> $base.c
+ rm -f $base.yy.c
+ elif [ -r $base.yy.c ]; then
+ echo "#include \"config.h\"" > $base.c
+ sed -e "s|$base\.yy\.c|$DEST|" $base.yy.c >> $base.c
+ rm -f $base.yy.c
+ elif [ -r $base.c ]; then
+ mv $base.c $base.c.tmp
+ echo "#include \"config.h\"" > $base.c
+ sed -e "s|$base\.yy\.c|$DEST|" $base.c.tmp >> $base.c
+ rm -f $base.c.tmp
+ elif [ ! -r base.c ]; then
+ echo "$base.c nor $base.yy.c nor lex.yy.c generated."
+ exit 1
+ fi
+ cd $top
+}
+
+
+call_yacc() {
+ yfile="$1"
+
+ echo "Calling $YACC on $yfile"
+
+ dir=$(dirname $yfile)
+ base=$(basename $yfile .y)
+ cfile=$base".c"
+ yfile=$base".y"
+
+ cd $dir
+
+ $YACC -d $yfile || exit 1
+ if [ -r y.tab.h -a -r y.tab.c ];then
+ sed -e "/^#/!b" -e "s|y\.tab\.h|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.h > $base.h
+ sed -e "s|y\.tab\.c|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.c > $base.c
+ rm -f y.tab.c y.tab.h
+ elif [ ! -r $base.h -a ! -r $base.c]; then
+ echo "$base.h nor $base.c generated."
+ exit 1
+ fi
+ cd $top
+}
+
+
+
+for lfile in $lexfiles; do
+ call_lex $lfile
+done
+
+for yfile in $yaccfiles; do
+ call_yacc $yfile
+done