From 4f1563a8f343e6c7062c55c7d7f16922a2e811ba Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Fri, 11 Oct 2024 09:17:12 +1100 Subject: [PATCH] c-parser: handle sed backup files uniformly in mkrelease mkrelease was trying to distinguish BSD and GNU sed command line options, but was using shell substitution incorrectly. Instead, use backup files for both versions, and then manually remove the backup file afterwards. Signed-off-by: Gerwin Klein --- tools/c-parser/mkrelease | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/c-parser/mkrelease b/tools/c-parser/mkrelease index 27be698bcb..5dc135dae5 100755 --- a/tools/c-parser/mkrelease +++ b/tools/c-parser/mkrelease @@ -12,8 +12,8 @@ set -e case $(uname) in - Darwin* ) TAR=gtar ; SEDIOPT="-i ''" ;; - * ) TAR=tar ; SEDIOPT=-i ;; + Darwin* ) TAR=gtar ;; + * ) TAR=tar ;; esac @@ -145,18 +145,20 @@ echo "Hacking Makefile to remove ROOT generation." if ! grep -q '^testfiles/\$(L4V_ARCH)/ROOT' "$outputdir/src/c-parser/Makefile"; then die "failed to process c-parser/Makefile" fi -sed $SEDIOPT \ +sed -i .bak \ -e '/^testfiles\/\$(L4V_ARCH)\/ROOT/,/CParserTest/d' \ -e '/^all_tests_\$(L4V_ARCH)\.thy/,/CParser/d' \ "$outputdir/src/c-parser/Makefile" +rm -f "$outputdir/src/c-parser/Makefile.bak" echo "Hacking Makefile to change root dir." if ! grep -q '^L4V_ROOT_DIR = ' "$outputdir/src/c-parser/Makefile"; then die "failed to process c-parser/Makefile" fi -sed $SEDIOPT \ +sed -i .bak \ -e 's/^L4V_ROOT_DIR = .*$/L4V_ROOT_DIR = ../' \ "$outputdir/src/c-parser/Makefile" +rm -f "$outputdir/src/c-parser/Makefile.bak" echo "Generating standalone-parser/table.ML" pushd "$TOPLEVEL_DIR/tools/c-parser" > /dev/null @@ -177,7 +179,7 @@ popd > /dev/null echo "Making PDF of ctranslation file." cd "$outputdir/src/c-parser/doc" make ctranslation.pdf > /dev/null -/bin/rm ctranslation.{log,aux,blg,bbl,toc} +/bin/rm -f ctranslation.{log,aux,blg,bbl,toc} mv ctranslation.pdf "$outputdir/doc" popd > /dev/null