Skip to content

Commit

Permalink
Merge pull request #110 from db-tu-dresden/JPietrzykTUD-patch-detect-…
Browse files Browse the repository at this point in the history
…flags

Update detect_flags.sh
alexKrauseTUD authored Sep 9, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents e9922f6 + 405b62d commit ca6ffa9
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/install_tsl.sh
Original file line number Diff line number Diff line change
@@ -13,8 +13,12 @@ curl -L "https://github.com/db-tu-dresden/TSL/releases/latest/download/detect_fl
chmod +x ${TMP_DIR}/detect_flags.sh

#create array from flags string
# AVAIL_FLAGS=($(${TMP_DIR}/detect_flags.sh))
IFS=' ' read -r -a AVAIL_FLAGS <<< "$(${TMP_DIR}/detect_flags.sh)"
DETECTED_FLAGS$=$(${TMP_DIR}/detect_flags.sh)
if [ $? != 0 ]; then
echo "Could not detect any flags."
exit 1
fi
IFS=' ' read -r -a AVAIL_FLAGS <<< "${DETECTED_FLAGS}"
unset IFS


15 changes: 10 additions & 5 deletions detect_flags.sh
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ else

if [[ -f $gcc_exe && -x $gcc_exe ]]; then
gcc_output=$(eval $gcc_exe -E - -march=native -### 2>&1)
parsed_flags=$(parse_flags "gcc" "$gcc_output")
parsed_flags=$(parse_flags "gcc" "$gcc_output" | sed "s/\./_/g")
# Parse whitespace-separated string into an array
IFS=' ' read -r -a parsed_array <<< "$parsed_flags"
@@ -77,11 +77,11 @@ else
continue
else
echo "Could not detect the current operating system. Aborting."
exit 1
# exit 1
fi
clang_output=$(eval $clang_exe -E - $arch_string -### 2>&1)
parsed_flags=$(parse_flags "clang" "$clang_output")
parsed_flags=$(parse_flags "clang" "$clang_output" | sed "s/\./_/g")
# Parse whitespace-separated string into an array
IFS=' ' read -r -a parsed_array <<< "$parsed_flags"
@@ -95,9 +95,14 @@ else
fi
done
fi
if [ -z "{flag_set}" ]; then
echo "Could not determine any flags"
exit 1
fi
IFS=$'\n' sorted=($(sort <<<"${flag_set[*]}"))
unset IFS
printf "%s " "${sorted[@]}"
printf "\n"
fi
fi

0 comments on commit ca6ffa9

Please sign in to comment.