From 391c93d0d442f2f74a43bc61f8031c20adaf2ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 25 Sep 2018 13:40:12 +0300 Subject: [PATCH] Allow strip-llvm.sh to run on files with a potential $EXEEXT suffix --- strip-llvm.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/strip-llvm.sh b/strip-llvm.sh index 1010dba..1c01a2a 100755 --- a/strip-llvm.sh +++ b/strip-llvm.sh @@ -11,13 +11,27 @@ cd "$PREFIX" cd bin for i in bugpoint c-index-test clang-* diagtool dsymutil git-clang-format hmaptool llc lli llvm-* obj2yaml opt sancov sanstats scan-build scan-view verify-uselistorder yaml2obj; do - case $i in + basename=$i + if [ -n "$EXEEXT" ]; then + # Some in the list are expanded globs, some are plain names we list. + case $i in + *$EXEEXT) + basename=$(echo $i | sed s/$EXEEXT//) + ;; + esac + i=$basename + if [ -e $basename$EXEEXT ]; then + i=$basename$EXEEXT + fi + fi + # Basename has got $EXEEXT stripped, but any other suffix kept intact. + case $basename in *.sh) ;; clang++|clang-*.*|clang-cpp) ;; clang-*) - suffix="${i#*-}" + suffix="${basename#*-}" # Test removing all numbers from the suffix; if it is empty, the suffix # was a plain number (as if the original name was clang-7); if it wasn't # empty, remove the tool.