blob: 927040ebe610eb16fdb659f05792ba7aa100cfc0 [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 Cron2c1a1f02020-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 Butcher69101222020-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 Butcher7bfeb662020-02-27 12:58:27 +000030 if [ -n "$VARIANT" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +000031 VARIANT=" ($VARIANT)"
32 fi
33
Simon Butcher7bfeb662020-02-27 12:58:27 +000034 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher07d5a472020-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 Butcher69101222020-03-05 15:18:53 +000049 if [ -z "$VERSION_STR" ]; then
50 VERSION_STR="Version could not be determined."
51 fi
52
Simon Butcher07d5a472020-02-26 15:29:40 +000053 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010054}
55
Simon Butcher7bfeb662020-02-27 12:58:27 +000056echo "** Platform:"
57echo
58
59if [ `uname -s` = "Linux" ]; then
Simon Butcher07d5a472020-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 Butcher07d5a472020-02-26 15:29:40 +000068print_version "uname" "-a" ""
Simon Butcher69101222020-03-05 15:18:53 +000069
Simon Butcher7bfeb662020-02-27 12:58:27 +000070echo
71echo
72echo "** Tool Versions:"
73echo
Simon Butcher07d5a472020-02-26 15:29:40 +000074
Ronald Cron2c1a1f02020-05-25 13:11:32 +020075print_version "make" "--version" "" "head -n 1"
76echo
77
78print_version "cmake" "--version" "" "head -n 1"
79echo
80
Gilles Peskine26232962018-03-21 08:35:07 +010081if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
82 : "${ARMC5_CC:=armcc}"
Simon Butcher07d5a472020-02-26 15:29:40 +000083 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010084 echo
Janos Follathb72c6782016-07-19 14:54:17 +010085
Gilles Peskine26232962018-03-21 08:35:07 +010086 : "${ARMC6_CC:=armclang}"
Simon Butcher07d5a472020-02-26 15:29:40 +000087 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010088 echo
89fi
Janos Follathb72c6782016-07-19 14:54:17 +010090
Simon Butcher07d5a472020-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 Butcher07d5a472020-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 Butcher07d5a472020-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 Butcher07d5a472020-02-26 15:29:40 +0000100print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100101echo
102
Simon Butcher07d5a472020-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 Butcher69101222020-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 Butchere30d03e2020-03-16 11:30:46 +0000115# Find the installed version of Pylint. Installed as a distro package this can
116# be pylint3 and as a PEP egg, pylint. In test scripts We prefer pylint over
117# pylint3
118if type pylint >/dev/null 2>/dev/null; then
119 print_version "pylint" "--version" "" "sed /^.*config/d" "grep pylint"
120elif type pylint3 >/dev/null 2>/dev/null; then
121 print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
122else
123 echo " * pylint or pylint3: Not found."
124fi
Simon Butcher69101222020-03-05 15:18:53 +0000125echo
126
Andres AG31f9b5b2016-10-04 17:14:38 +0100127: ${OPENSSL:=openssl}
Simon Butcher07d5a472020-02-26 15:29:40 +0000128print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100129echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100130
131if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000132 print_version "$OPENSSL_LEGACY" "version" "legacy"
133else
134 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100135fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000136echo
Janos Follathb72c6782016-07-19 14:54:17 +0100137
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100138if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000139 print_version "$OPENSSL_NEXT" "version" "next"
140else
141 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100142fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000143echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100144
Andres AG31f9b5b2016-10-04 17:14:38 +0100145: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher07d5a472020-02-26 15:29:40 +0000146print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100147echo
Janos Follathb72c6782016-07-19 14:54:17 +0100148
Andres AG31f9b5b2016-10-04 17:14:38 +0100149: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher07d5a472020-02-26 15:29:40 +0000150print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100151echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100152
153if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000154 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
155else
156 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100157fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000158echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100159
160if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000161 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
162else
163 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100164fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000165echo
Janos Follathb72c6782016-07-19 14:54:17 +0100166
Simon Butcher07d5a472020-02-26 15:29:40 +0000167echo " * Installed asan versions:"
Simon Butcher7bfeb662020-02-27 12:58:27 +0000168if type dpkg-query >/dev/null 2>/dev/null; then
169 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
170 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
171 grep .
172 then
173 echo " No asan versions installed."
174 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100175else
Simon Butcher7bfeb662020-02-27 12:58:27 +0000176 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100177fi
Janos Follathb72c6782016-07-19 14:54:17 +0100178echo