blob: b056ffde66096114c88b45c6161ffc971232665f [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
81 : "${ARMC5_CC:=armcc}"
Simon Butcher07d5a472020-02-26 15:29:40 +000082 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010083 echo
Janos Follathb72c6782016-07-19 14:54:17 +010084
Gilles Peskine26232962018-03-21 08:35:07 +010085 : "${ARMC6_CC:=armclang}"
Simon Butcher07d5a472020-02-26 15:29:40 +000086 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010087 echo
88fi
Janos Follathb72c6782016-07-19 14:54:17 +010089
Simon Butcher07d5a472020-02-26 15:29:40 +000090print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010091echo
Janos Follathb72c6782016-07-19 14:54:17 +010092
Simon Butcher07d5a472020-02-26 15:29:40 +000093print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010094echo
Janos Follathb72c6782016-07-19 14:54:17 +010095
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +010096if [ -n "${GCC_EARLIEST+set}" ]; then
97 print_version "${GCC_EARLIEST}" "--version" "" "head -n 1"
98else
99 echo " GCC_EARLIEST : Not configured."
100fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100101echo
102
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +0100103if [ -n "${GCC_LATEST+set}" ]; then
104 print_version "${GCC_LATEST}" "--version" "" "head -n 1"
105else
106 echo " GCC_LATEST : Not configured."
107fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100108echo
109
Simon Butcher07d5a472020-02-26 15:29:40 +0000110print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +0100111echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100112
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +0100113if [ -n "${CLANG_EARLIEST+set}" ]; then
114 print_version "${CLANG_EARLIEST}" "--version" "" "head -n 2"
115else
116 echo " CLANG_EARLIEST : Not configured."
117fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100118echo
119
Gowtham Suresh Kumar6f1977b2023-07-28 17:04:47 +0100120if [ -n "${CLANG_LATEST+set}" ]; then
121 print_version "${CLANG_LATEST}" "--version" "" "head -n 2"
122else
123 echo " CLANG_LATEST : Not configured."
124fi
Gowtham Suresh Kumara12baf82023-07-19 08:39:20 +0100125echo
126
Simon Butcher07d5a472020-02-26 15:29:40 +0000127print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100128echo
129
Simon Butcher07d5a472020-02-26 15:29:40 +0000130print_version "valgrind" "--version" ""
131echo
132
133print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100134echo
135
Simon Butcher69101222020-03-05 15:18:53 +0000136print_version "perl" "--version" "" "head -n 2" "grep ."
137echo
138
139print_version "python" "--version" "" "head -n 1"
140echo
141
Ronald Cron87e658d2020-05-25 13:55:21 +0200142print_version "python3" "--version" "" "head -n 1"
143echo
144
Simon Butchere30d03e2020-03-16 11:30:46 +0000145# Find the installed version of Pylint. Installed as a distro package this can
146# be pylint3 and as a PEP egg, pylint. In test scripts We prefer pylint over
147# pylint3
148if type pylint >/dev/null 2>/dev/null; then
149 print_version "pylint" "--version" "" "sed /^.*config/d" "grep pylint"
150elif type pylint3 >/dev/null 2>/dev/null; then
151 print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
152else
153 echo " * pylint or pylint3: Not found."
154fi
Simon Butcher69101222020-03-05 15:18:53 +0000155echo
156
Andres AG31f9b5b2016-10-04 17:14:38 +0100157: ${OPENSSL:=openssl}
Simon Butcher07d5a472020-02-26 15:29:40 +0000158print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100159echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100160
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100161if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000162 print_version "$OPENSSL_NEXT" "version" "next"
163else
164 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100165fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000166echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100167
Andres AG31f9b5b2016-10-04 17:14:38 +0100168: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher07d5a472020-02-26 15:29:40 +0000169print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100170echo
Janos Follathb72c6782016-07-19 14:54:17 +0100171
Andres AG31f9b5b2016-10-04 17:14:38 +0100172: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher07d5a472020-02-26 15:29:40 +0000173print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100174echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100175
Simon Butcher07d5a472020-02-26 15:29:40 +0000176echo " * Installed asan versions:"
Simon Butcher7bfeb662020-02-27 12:58:27 +0000177if type dpkg-query >/dev/null 2>/dev/null; then
178 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
179 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
180 grep .
181 then
182 echo " No asan versions installed."
183 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100184else
Simon Butcher7bfeb662020-02-27 12:58:27 +0000185 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100186fi
Janos Follathb72c6782016-07-19 14:54:17 +0100187echo