blob: 89425fce6fef502dada5f0da071767eac155d6c6 [file] [log] [blame]
Andres AG31f9b5b2016-10-04 17:14:38 +01001#! /usr/bin/env sh
2
Janos Follathb72c6782016-07-19 14:54:17 +01003# output_env.sh
4#
5# This file is part of mbed TLS (https://tls.mbed.org)
6#
7# Copyright (c) 2016, ARM Limited, All Rights Reserved
8#
9# Purpose
10#
11# To print out all the relevant information about the development environment.
12#
13# This includes:
14# - architecture of the system
15# - type and version of the operating system
Ronald Crona960dc92020-05-25 13:11:32 +020016# - version of make and cmake
Simon Butcher3ac07672016-09-04 14:28:44 +030017# - version of armcc, clang, gcc-arm and gcc compilers
18# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010019# - version of gnuTLS and OpenSSL
20
Andres AG31f9b5b2016-10-04 17:14:38 +010021print_version()
22{
23 BIN="$1"
24 shift
25 ARGS="$1"
26 shift
Simon Butcher82770412020-03-05 15:18:53 +000027 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010028 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010029
Simon Butcherd40e6032020-02-27 12:58:27 +000030 if [ -n "$VARIANT" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000031 VARIANT=" ($VARIANT)"
32 fi
33
Simon Butcherd40e6032020-02-27 12:58:27 +000034 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher870ee822020-02-26 15:29:40 +000035 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010036 return 0
Andres AG87bb5772016-09-27 15:05:15 +010037 fi
Andres AG87bb5772016-09-27 15:05:15 +010038
Andres AG31f9b5b2016-10-04 17:14:38 +010039 BIN=`which "$BIN"`
40 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010041
Andres AG31f9b5b2016-10-04 17:14:38 +010042 # Apply all filters
43 while [ $# -gt 0 ]; do
44 FILTER="$1"
45 shift
46 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
47 done
48
Simon Butcher82770412020-03-05 15:18:53 +000049 if [ -z "$VERSION_STR" ]; then
50 VERSION_STR="Version could not be determined."
51 fi
52
Simon Butcher870ee822020-02-26 15:29:40 +000053 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010054}
55
Simon Butcherd40e6032020-02-27 12:58:27 +000056echo "** Platform:"
57echo
58
59if [ `uname -s` = "Linux" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000060 echo "Linux variant"
61 lsb_release -d -c
62else
63 echo "Unknown Unix variant"
64fi
65
Janos Follathb72c6782016-07-19 14:54:17 +010066echo
Janos Follathb72c6782016-07-19 14:54:17 +010067
Simon Butcher870ee822020-02-26 15:29:40 +000068print_version "uname" "-a" ""
Simon Butcher82770412020-03-05 15:18:53 +000069
Simon Butcherd40e6032020-02-27 12:58:27 +000070echo
71echo
72echo "** Tool Versions:"
73echo
Simon Butcher870ee822020-02-26 15:29:40 +000074
Ronald Crona960dc92020-05-25 13:11:32 +020075print_version "make" "--version" "" "head -n 1"
76echo
77
78print_version "cmake" "--version" "" "head -n 1"
79echo
80
Gilles Peskine53038eb2018-03-21 08:35:07 +010081if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
82 : "${ARMC5_CC:=armcc}"
Simon Butcher870ee822020-02-26 15:29:40 +000083 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +010084 echo
Janos Follathb72c6782016-07-19 14:54:17 +010085
Gilles Peskine53038eb2018-03-21 08:35:07 +010086 : "${ARMC6_CC:=armclang}"
Simon Butcher870ee822020-02-26 15:29:40 +000087 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +010088 echo
89fi
Janos Follathb72c6782016-07-19 14:54:17 +010090
Simon Butcher870ee822020-02-26 15:29:40 +000091print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010092echo
Janos Follathb72c6782016-07-19 14:54:17 +010093
Simon Butcher870ee822020-02-26 15:29:40 +000094print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010095echo
Janos Follathb72c6782016-07-19 14:54:17 +010096
Simon Butcher870ee822020-02-26 15:29:40 +000097print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010098echo
Andres AG7a63eaf2016-09-05 12:24:47 +010099
Simon Butcher870ee822020-02-26 15:29:40 +0000100print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100101echo
102
Simon Butcher870ee822020-02-26 15:29:40 +0000103print_version "valgrind" "--version" ""
104echo
105
106print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100107echo
108
Simon Butcher82770412020-03-05 15:18:53 +0000109print_version "perl" "--version" "" "head -n 2" "grep ."
110echo
111
112print_version "python" "--version" "" "head -n 1"
113echo
114
Simon Butcher8eb64e62020-03-06 14:50:49 +0000115print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
Simon Butcher82770412020-03-05 15:18:53 +0000116echo
117
Andres AG31f9b5b2016-10-04 17:14:38 +0100118: ${OPENSSL:=openssl}
Simon Butcher870ee822020-02-26 15:29:40 +0000119print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100120echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100121
122if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000123 print_version "$OPENSSL_LEGACY" "version" "legacy"
124else
125 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100126fi
Simon Butcher870ee822020-02-26 15:29:40 +0000127echo
Janos Follathb72c6782016-07-19 14:54:17 +0100128
Andres AG31f9b5b2016-10-04 17:14:38 +0100129: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher870ee822020-02-26 15:29:40 +0000130print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100131echo
Janos Follathb72c6782016-07-19 14:54:17 +0100132
Andres AG31f9b5b2016-10-04 17:14:38 +0100133: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher870ee822020-02-26 15:29:40 +0000134print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100135echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100136
137if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000138 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
139else
140 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100141fi
Simon Butcher870ee822020-02-26 15:29:40 +0000142echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100143
144if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000145 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
146else
147 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100148fi
Simon Butcher870ee822020-02-26 15:29:40 +0000149echo
Janos Follathb72c6782016-07-19 14:54:17 +0100150
Simon Butcher870ee822020-02-26 15:29:40 +0000151echo " * Installed asan versions:"
Simon Butcherd40e6032020-02-27 12:58:27 +0000152if type dpkg-query >/dev/null 2>/dev/null; then
153 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
154 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
155 grep .
156 then
157 echo " No asan versions installed."
158 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100159else
Simon Butcherd40e6032020-02-27 12:58:27 +0000160 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100161fi
Janos Follathb72c6782016-07-19 14:54:17 +0100162echo