1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #8727 from smlng/enh/tools/printtoolchains

tools/ci: enhance print_toolchain script
This commit is contained in:
Joakim Nohlgård 2018-03-05 10:47:39 +01:00 committed by GitHub
commit 57e6f5657e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,19 +1,20 @@
#!/bin/sh
gcc_version() {
local cc
get_cmd_version() {
if [ -z "$1" ]; then
cc=gcc
return
fi
local cmd="$1"
if command -v "$cmd" 2>&1 >/dev/null; then
ver=$("$cmd" --version 2> /dev/null | head -n 1)
if [ -z "$ver" ]; then
ver="error"
fi
else
cc=$1-gcc
fi
local ver=
if command -v "$cc" 2>&1 >/dev/null; then
ver=$("$cc" --version | head -n 1)
fi
if [ -z "$ver" ]; then
ver=missing/error
ver="missing"
fi
printf "%s" "$ver"
}
@ -24,83 +25,52 @@ get_define() {
line=$(echo "$3" | "$cc" -x c -include "$2" -E -o - - 2>&1 | sed -e '/^[ ]*#/d' -e '/^[ ]*$/d')
fi
if [ -z "$line" ]; then
line=missing/error
line=missing
fi
printf "%s" "$line"
}
newlib_version() {
if [ -z "$1" ]; then
cc=gcc
printf "%s" "error"
else
cc=$1-gcc
local cc="$1"
printf "%s" "$(get_define "$cc" newlib.h _NEWLIB_VERSION)"
fi
printf "%s" "$(get_define "$cc" newlib.h _NEWLIB_VERSION)"
}
avr_libc_version() {
if [ -z "$1" ]; then
cc=gcc
printf "%s" "error"
else
cc=$1-gcc
local cc="$1"
printf "%s (%s)" "$(get_define "$cc" avr/version.h __AVR_LIBC_VERSION_STRING__)" "$(get_define "$cc" avr/version.h __AVR_LIBC_DATE_STRING__)"
fi
printf "%s (%s)" "$(get_define "$cc" avr/version.h __AVR_LIBC_VERSION_STRING__)" "$(get_define "$cc" avr/version.h __AVR_LIBC_DATE_STRING__)"
}
cppcheck_version() {
local cmd="cppcheck"
if command -v "$cmd" 2>&1 >/dev/null; then
ver=$("$cmd" --version | head -n 1)
else
ver="missing"
fi
printf "%s" "$ver"
}
spatch_version() {
local cmd="spatch"
if command -v "$cmd" 2>&1 >/dev/null; then
ver=$("$cmd" --version | head -n 1)
else
ver="missing"
fi
printf "%s" "$ver"
}
git_version() {
local cmd="git"
if command -v "$cmd" 2>&1 >/dev/null; then
ver=$("$cmd" --version | head -n 1)
else
ver="missing"
fi
printf "%s" "$ver"
}
printf "%s\n" "Installed toolchain versions"
printf "%s\n" "----------------------------"
VER=$(gcc --version | head -n 1)
if [ -n "$VER" ]; then
printf "%20s: %s\n" "native gcc" "$VER"
fi
for p in msp430 avr arm-none-eabi mips-mti-elf; do
printf "%20s: %s\n" "$p-gcc" "$(gcc_version "$p")"
printf "%s\n" "Installed compiler toolchains "
printf "%s\n" "-----------------------------"
printf "%21s: %s\n" "native gcc" "$(get_cmd_version gcc)"
for p in arm-none-eabi avr mips-mti-elf msp430; do
printf "%21s: %s\n" "$p-gcc" "$(get_cmd_version ${p}-gcc)"
done
VER=$(clang --version | head -n 1)
if [ -n "$VER" ]; then
printf "%20s: %s\n" "clang" "$VER"
fi
printf "%21s: %s\n" "clang" "$(get_cmd_version clang)"
printf "\n"
printf "%s\n" "Installed compiler libs"
printf "%s\n" "-----------------------"
# platform specific newlib version
for p in arm-none-eabi mips-mti-elf; do
printf "%20s: %s\n" "$p-newlib" "$(newlib_version "$p")"
printf "%21s: %s\n" "$p-newlib" "$(newlib_version ${p}-gcc)"
done
for p in avr; do
printf "%20s: %s\n" "$p-libc" "$(avr_libc_version "$p")"
# avr libc version
printf "%21s: %s\n" "avr-libc" "$(avr_libc_version avr-gcc)"
# tools
printf "\n"
printf "%s\n" "Installed development tools"
printf "%s\n" "---------------------------"
for c in cmake cppcheck git; do
printf "%21s: %s\n" "$c" "$(get_cmd_version $c)"
done
printf "%20s: %s\n" "cppcheck" "$(cppcheck_version)"
printf "%20s: %s\n" "coccinelle" "$(spatch_version)"
printf "%20s: %s\n" "git" "$(git_version)"
printf "%21s: %s\n" "coccinelle" "$(get_cmd_version spatch)"
exit 0