blob: 32f1f86efcbebf5b1f6b5ab23723bd7845f36d8d [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#
Bence Szépkúti1e148272020-08-07 13:07:28 +02005# Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +00006# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Bence Szépkútic7da1fe2020-05-26 01:54:15 +02007#
Janos Follathb72c6782016-07-19 14:54:17 +01008# Purpose
9#
10# To print out all the relevant information about the development environment.
11#
12# This includes:
13# - architecture of the system
14# - type and version of the operating system
Ronald Cron2c1a1f02020-05-25 13:11:32 +020015# - version of make and cmake
Simon Butcher3ac07672016-09-04 14:28:44 +030016# - version of armcc, clang, gcc-arm and gcc compilers
17# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010018# - version of gnuTLS and OpenSSL
19
Andres AG31f9b5b2016-10-04 17:14:38 +010020print_version()
21{
22 BIN="$1"
23 shift
24 ARGS="$1"
25 shift
Simon Butcher69101222020-03-05 15:18:53 +000026 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010027 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010028
Simon Butcher7bfeb662020-02-27 12:58:27 +000029 if [ -n "$VARIANT" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +000030 VARIANT=" ($VARIANT)"
31 fi
32
Simon Butcher7bfeb662020-02-27 12:58:27 +000033 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher07d5a472020-02-26 15:29:40 +000034 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010035 return 0
Andres AG87bb5772016-09-27 15:05:15 +010036 fi
Andres AG87bb5772016-09-27 15:05:15 +010037
Andres AG31f9b5b2016-10-04 17:14:38 +010038 BIN=`which "$BIN"`
39 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010040
Andres AG31f9b5b2016-10-04 17:14:38 +010041 # Apply all filters
42 while [ $# -gt 0 ]; do
43 FILTER="$1"
44 shift
45 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
46 done
47
Simon Butcher69101222020-03-05 15:18:53 +000048 if [ -z "$VERSION_STR" ]; then
49 VERSION_STR="Version could not be determined."
50 fi
51
Simon Butcher07d5a472020-02-26 15:29:40 +000052 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010053}
54
Simon Butcher7bfeb662020-02-27 12:58:27 +000055echo "** Platform:"
56echo
57
58if [ `uname -s` = "Linux" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +000059 echo "Linux variant"
60 lsb_release -d -c
61else
62 echo "Unknown Unix variant"
63fi
64
Janos Follathb72c6782016-07-19 14:54:17 +010065echo
Janos Follathb72c6782016-07-19 14:54:17 +010066
Simon Butcher07d5a472020-02-26 15:29:40 +000067print_version "uname" "-a" ""
Simon Butcher69101222020-03-05 15:18:53 +000068
Simon Butcher7bfeb662020-02-27 12:58:27 +000069echo
70echo
71echo "** Tool Versions:"
72echo
Simon Butcher07d5a472020-02-26 15:29:40 +000073
Ronald Cron2c1a1f02020-05-25 13:11:32 +020074print_version "make" "--version" "" "head -n 1"
75echo
76
77print_version "cmake" "--version" "" "head -n 1"
78echo
79
Gilles Peskine26232962018-03-21 08:35:07 +010080if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
Gilles Peskine26232962018-03-21 08:35:07 +010081 : "${ARMC6_CC:=armclang}"
Simon Butcher07d5a472020-02-26 15:29:40 +000082 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010083 echo
84fi
Janos Follathb72c6782016-07-19 14:54:17 +010085
Simon Butcher07d5a472020-02-26 15:29:40 +000086print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010087echo
Janos Follathb72c6782016-07-19 14:54:17 +010088
Simon Butcher07d5a472020-02-26 15:29:40 +000089print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010090echo
Janos Follathb72c6782016-07-19 14:54:17 +010091
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +010092if [ -n "${GCC_EARLIEST+set}" ]; then
93 print_version "${GCC_EARLIEST}" "--version" "" "head -n 1"
94else
95 echo " GCC_EARLIEST : Not configured."
96fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +010097echo
98
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +010099if [ -n "${GCC_LATEST+set}" ]; then
100 print_version "${GCC_LATEST}" "--version" "" "head -n 1"
101else
102 echo " GCC_LATEST : Not configured."
103fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100104echo
105
Simon Butcher07d5a472020-02-26 15:29:40 +0000106print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +0100107echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100108
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +0100109if [ -n "${CLANG_EARLIEST+set}" ]; then
110 print_version "${CLANG_EARLIEST}" "--version" "" "head -n 2"
111else
112 echo " CLANG_EARLIEST : Not configured."
113fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100114echo
115
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +0100116if [ -n "${CLANG_LATEST+set}" ]; then
117 print_version "${CLANG_LATEST}" "--version" "" "head -n 2"
118else
119 echo " CLANG_LATEST : Not configured."
120fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100121echo
122
Simon Butcher07d5a472020-02-26 15:29:40 +0000123print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100124echo
125
Simon Butcher07d5a472020-02-26 15:29:40 +0000126print_version "valgrind" "--version" ""
127echo
128
129print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100130echo
131
Simon Butcher69101222020-03-05 15:18:53 +0000132print_version "perl" "--version" "" "head -n 2" "grep ."
133echo
134
135print_version "python" "--version" "" "head -n 1"
136echo
137
Ronald Cron87e658d2020-05-25 13:55:21 +0200138print_version "python3" "--version" "" "head -n 1"
139echo
140
Simon Butchere30d03e2020-03-16 11:30:46 +0000141# Find the installed version of Pylint. Installed as a distro package this can
142# be pylint3 and as a PEP egg, pylint. In test scripts We prefer pylint over
143# pylint3
144if type pylint >/dev/null 2>/dev/null; then
145 print_version "pylint" "--version" "" "sed /^.*config/d" "grep pylint"
146elif type pylint3 >/dev/null 2>/dev/null; then
147 print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
148else
149 echo " * pylint or pylint3: Not found."
150fi
Simon Butcher69101222020-03-05 15:18:53 +0000151echo
152
Andres AG31f9b5b2016-10-04 17:14:38 +0100153: ${OPENSSL:=openssl}
Simon Butcher07d5a472020-02-26 15:29:40 +0000154print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100155echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100156
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100157if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000158 print_version "$OPENSSL_NEXT" "version" "next"
159else
160 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100161fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000162echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100163
Andres AG31f9b5b2016-10-04 17:14:38 +0100164: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher07d5a472020-02-26 15:29:40 +0000165print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100166echo
Janos Follathb72c6782016-07-19 14:54:17 +0100167
Andres AG31f9b5b2016-10-04 17:14:38 +0100168: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher07d5a472020-02-26 15:29:40 +0000169print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100170echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100171
Simon Butcher07d5a472020-02-26 15:29:40 +0000172echo " * Installed asan versions:"
Simon Butcher7bfeb662020-02-27 12:58:27 +0000173if type dpkg-query >/dev/null 2>/dev/null; then
174 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
175 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
176 grep .
177 then
178 echo " No asan versions installed."
179 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100180else
Simon Butcher7bfeb662020-02-27 12:58:27 +0000181 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100182fi
Janos Follathb72c6782016-07-19 14:54:17 +0100183echo