X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lexer-gcc-3.1.sh;h=1898f27eb8b5f9cefc9ba97d3806cd8a5de0430e;hb=114de397288bb051f4b715ca894d6d4ab178879d;hp=944497fdf9f8725323aa1feee97d61ae2e62499a;hpb=48e99f68aed5df0fdf63974b4adb725e92583cce;p=lilypond.git diff --git a/lexer-gcc-3.1.sh b/lexer-gcc-3.1.sh index 944497fdf9..1898f27eb8 100755 --- a/lexer-gcc-3.1.sh +++ b/lexer-gcc-3.1.sh @@ -4,7 +4,11 @@ set -e -includes="$HOME/usr/include /usr/local/include /usr/include" +FLEXLEXER=OK + +if [ -z "$FLEXLEXER" ]; then + +includes="$HOME/usr/include $PREFIX/include /usr/local/include /usr/include" for i in $includes; do file=$i/FlexLexer.h @@ -24,6 +28,7 @@ EOF exit 1 fi +fi # flexlexer if [ -n "$CONF" ]; then CONFIGSUFFIX=-$CONF @@ -33,27 +38,29 @@ if [ -n "$CONF" ]; then fi outdir=out$CONFIGSUFFIX +if [ -z "$FLEXLEXER" ]; then + echo -n "Copying and fixing $file... " mkdir -p lily/$outdir rm -f lily/$outdir/FlexLexer.h -sed -e 's/iostream.h/iostream/' \ - -e 's/\/std::istream/' \ - -e 's/\/std::ostream/' \ +perl -p -e 's/iostream.h/iostream/g;' \ + -e 's/\bistream\b/std::istream/g;' \ + -e 's/\bostream\b/std::ostream/' \ $file > lily/$outdir/FlexLexer.h echo "done" +fi # flexlexer if [ -f GNUmakefile ]; then - echo -n "Generating and fixing $file... " - file=lily/$outdir/lexer.cc + echo -n "Generating and fixing $file... " rm -f $file make conf=$CONF -C lily $outdir/lexer.cc > /dev/null 2>&1 || true mv $file $file.orig - sed -e 's/\/std::cin/g' \ - -e 's/\/std::cout/g' \ - -e 's/\/std::cerr/g' \ + perl -p -e 's/\bcin\b/std::cin/g;' \ + -e 's/\bcout\b/std::cout/g;' \ + -e 's/\bcerr\b/std::cerr/g' \ $file.orig > $file echo "done" fi