Commit f80b9823 authored by Roland Levillain's avatar Roland Levillain
Browse files

Update bison++.

	* build-aux/bison++.in: Catch up with TC's bison++.in.
parent 1d96240b
2008-12-06 Roland Levillain <roland@lrde.epita.fr>
Update bison++.
* build-aux/bison++.in: Catch up with TC's bison++.in.
2008-12-06 Roland Levillain <roland@lrde.epita.fr> 2008-12-06 Roland Levillain <roland@lrde.epita.fr>
* bootstrap: Help autoreconf find a valid libtoolize. * bootstrap: Help autoreconf find a valid libtoolize.
......
...@@ -19,10 +19,15 @@ input_base=$(basename "$input") ...@@ -19,10 +19,15 @@ input_base=$(basename "$input")
shift shift
output=$1 output=$1
output_base=$(basename "$output") output_base=$(basename "$output")
output_base_noext=$(echo "$output_base" | sed -e 's/\.[^.]*//')
output_dir=$(dirname "$output") output_dir=$(dirname "$output")
output_dir_abs=$(cd "$output_dir" && pwd)
shift shift
options="$@" options="$@"
if $BISON --xml --version >/dev/null 2>&1; then
options="$options --xml"
fi
# Alexandre Duret-Lutz also notes that in VPATH-builds $(srcdir) can # Alexandre Duret-Lutz also notes that in VPATH-builds $(srcdir) can
# be an absolute path depending on how ./configure is called ... # be an absolute path depending on how ./configure is called ...
...@@ -34,7 +39,7 @@ options="$@" ...@@ -34,7 +39,7 @@ options="$@"
# paths with Bison, chdir there. # paths with Bison, chdir there.
# A tmp dir. # A tmp dir.
tmp=$output_base.dir tmp=$output_base_noext.dir
rm -rf $tmp rm -rf $tmp
mkdir $tmp mkdir $tmp
...@@ -47,23 +52,77 @@ $BISON $options $input_base -o $output_base ...@@ -47,23 +52,77 @@ $BISON $options $input_base -o $output_base
status=$? status=$?
set -e set -e
if test $status = 0; then
for file in * # fix_bison_output FILE
# ---------------------
# Fixes in place.
fix_bison_output ()
{
# Fix doxygen tags.
perl -pi -e "s|\Q\\file $base\E\b|\\\\file parse/$base|g;" "$1"
}
# Go back to where we were and use relative paths instead of using
# absolute file names. The messages look nicer.
cd ..
case $status in
0)
for file in $tmp/*
do do
case $file in base=$(basename $file)
$input_base) base_noext=$(echo "$base" | sed -e 's/\.[^.]*//')
out=$output_dir/$base
case $base in
$input_base)
# Leave it here. # Leave it here.
;; ;;
*)
# Fix doxygen tags. *.xml)
perl -pi -e "s|\Q\\file $file\E\b|\\\\file parse/$file|g;" "$file" # Computing the HTML is slow. Do it when the XML changed.
$move_if_change "$file" "$output_dir_abs/$file" fix_bison_output "$file"
;; if ! test -r "$out" || ! cmp -s "$file" "$out"; then
esac xml2html="xsltproc $($BISON --print-datadir)/xslt/xml2xhtml.xsl"
if $xml2html "$file" >$tmp/$base_noext.html; then
$move_if_change "$tmp/$base_noext.html" \
"$output_dir/$base_noext.html"
else
echo >&2 "$0: cannot convert XML report to HTML"
rm $tmp/$base_noext.html
fi
fi
$move_if_change "$file" "$out"
;;
*.hh)
fix_bison_output "$file"
# To save cycles, if the file differs only on sync lines,
# update it (to be right), but keep the original timestamps.
if test -r "$out" &&
diff -I '^#line' -I '/\* Line .* of .* \*/' -q "$file" "$out"; then
touch -r "$out" "$file"
cp "$out" "$out.bak"
echo >&2 "$0: kept the stamps of $file"
fi
$move_if_change "$file" "$out"
;;
*)
fix_bison_output "$file"
$move_if_change "$file" "$out"
;;
esac
done done
fi ;;
*) # We really want to keep the *.output files.
for file in $(ls $tmp/*.output $tmp/*.xml $tmp/*.html 2>/dev/null)
do
$move_if_change "$file" "$output_dir/$(basename $file)"
done
;;
esac
# Get rid of the tmp dir. # Get rid of the tmp dir.
cd ..
rm -rf $tmp rm -rf $tmp
exit $status exit $status
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment