blob: 0044a222a7d2c48a0b43aa5c07387685cd5d74c7 [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#
Janos Follathb72c6782016-07-19 14:54:17 +01005# Copyright (c) 2016, ARM Limited, All Rights Reserved
Bence Szépkútic7da1fe2020-05-26 01:54:15 +02006# SPDX-License-Identifier: Apache-2.0
7#
8# Licensed under the Apache License, Version 2.0 (the "License"); you may
9# not use this file except in compliance with the License.
10# You may obtain a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17# See the License for the specific language governing permissions and
18# limitations under the License.
19#
20# This file is part of Mbed TLS (https://tls.mbed.org)
Janos Follathb72c6782016-07-19 14:54:17 +010021#
22# Purpose
23#
24# To print out all the relevant information about the development environment.
25#
26# This includes:
27# - architecture of the system
28# - type and version of the operating system
Ronald Cron2c1a1f02020-05-25 13:11:32 +020029# - version of make and cmake
Simon Butcher3ac07672016-09-04 14:28:44 +030030# - version of armcc, clang, gcc-arm and gcc compilers
31# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010032# - version of gnuTLS and OpenSSL
33
Andres AG31f9b5b2016-10-04 17:14:38 +010034print_version()
35{
36 BIN="$1"
37 shift
38 ARGS="$1"
39 shift
Simon Butcher69101222020-03-05 15:18:53 +000040 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010041 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010042
Simon Butcher7bfeb662020-02-27 12:58:27 +000043 if [ -n "$VARIANT" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +000044 VARIANT=" ($VARIANT)"
45 fi
46
Simon Butcher7bfeb662020-02-27 12:58:27 +000047 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher07d5a472020-02-26 15:29:40 +000048 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010049 return 0
Andres AG87bb5772016-09-27 15:05:15 +010050 fi
Andres AG87bb5772016-09-27 15:05:15 +010051
Andres AG31f9b5b2016-10-04 17:14:38 +010052 BIN=`which "$BIN"`
53 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010054
Andres AG31f9b5b2016-10-04 17:14:38 +010055 # Apply all filters
56 while [ $# -gt 0 ]; do
57 FILTER="$1"
58 shift
59 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
60 done
61
Simon Butcher69101222020-03-05 15:18:53 +000062 if [ -z "$VERSION_STR" ]; then
63 VERSION_STR="Version could not be determined."
64 fi
65
Simon Butcher07d5a472020-02-26 15:29:40 +000066 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010067}
68
Simon Butcher7bfeb662020-02-27 12:58:27 +000069echo "** Platform:"
70echo
71
72if [ `uname -s` = "Linux" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +000073 echo "Linux variant"
74 lsb_release -d -c
75else
76 echo "Unknown Unix variant"
77fi
78
Janos Follathb72c6782016-07-19 14:54:17 +010079echo
Janos Follathb72c6782016-07-19 14:54:17 +010080
Simon Butcher07d5a472020-02-26 15:29:40 +000081print_version "uname" "-a" ""
Simon Butcher69101222020-03-05 15:18:53 +000082
Simon Butcher7bfeb662020-02-27 12:58:27 +000083echo
84echo
85echo "** Tool Versions:"
86echo
Simon Butcher07d5a472020-02-26 15:29:40 +000087
Ronald Cron2c1a1f02020-05-25 13:11:32 +020088print_version "make" "--version" "" "head -n 1"
89echo
90
91print_version "cmake" "--version" "" "head -n 1"
92echo
93
Gilles Peskine26232962018-03-21 08:35:07 +010094if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
95 : "${ARMC5_CC:=armcc}"
Simon Butcher07d5a472020-02-26 15:29:40 +000096 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010097 echo
Janos Follathb72c6782016-07-19 14:54:17 +010098
Gilles Peskine26232962018-03-21 08:35:07 +010099 : "${ARMC6_CC:=armclang}"
Simon Butcher07d5a472020-02-26 15:29:40 +0000100 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +0100101 echo
102fi
Janos Follathb72c6782016-07-19 14:54:17 +0100103
Simon Butcher07d5a472020-02-26 15:29:40 +0000104print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100105echo
Janos Follathb72c6782016-07-19 14:54:17 +0100106
Simon Butcher07d5a472020-02-26 15:29:40 +0000107print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100108echo
Janos Follathb72c6782016-07-19 14:54:17 +0100109
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
Simon Butcher07d5a472020-02-26 15:29:40 +0000113print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100114echo
115
Simon Butcher07d5a472020-02-26 15:29:40 +0000116print_version "valgrind" "--version" ""
117echo
118
119print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100120echo
121
Simon Butcher69101222020-03-05 15:18:53 +0000122print_version "perl" "--version" "" "head -n 2" "grep ."
123echo
124
125print_version "python" "--version" "" "head -n 1"
126echo
127
Ronald Cron87e658d2020-05-25 13:55:21 +0200128print_version "python3" "--version" "" "head -n 1"
129echo
130
Simon Butchere30d03e2020-03-16 11:30:46 +0000131# Find the installed version of Pylint. Installed as a distro package this can
132# be pylint3 and as a PEP egg, pylint. In test scripts We prefer pylint over
133# pylint3
134if type pylint >/dev/null 2>/dev/null; then
135 print_version "pylint" "--version" "" "sed /^.*config/d" "grep pylint"
136elif type pylint3 >/dev/null 2>/dev/null; then
137 print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
138else
139 echo " * pylint or pylint3: Not found."
140fi
Simon Butcher69101222020-03-05 15:18:53 +0000141echo
142
Andres AG31f9b5b2016-10-04 17:14:38 +0100143: ${OPENSSL:=openssl}
Simon Butcher07d5a472020-02-26 15:29:40 +0000144print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100145echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100146
147if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000148 print_version "$OPENSSL_LEGACY" "version" "legacy"
149else
150 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100151fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000152echo
Janos Follathb72c6782016-07-19 14:54:17 +0100153
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100154if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000155 print_version "$OPENSSL_NEXT" "version" "next"
156else
157 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100158fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000159echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100160
Andres AG31f9b5b2016-10-04 17:14:38 +0100161: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher07d5a472020-02-26 15:29:40 +0000162print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100163echo
Janos Follathb72c6782016-07-19 14:54:17 +0100164
Andres AG31f9b5b2016-10-04 17:14:38 +0100165: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher07d5a472020-02-26 15:29:40 +0000166print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100167echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100168
169if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000170 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
171else
172 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100173fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000174echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100175
176if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher07d5a472020-02-26 15:29:40 +0000177 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
178else
179 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100180fi
Simon Butcher07d5a472020-02-26 15:29:40 +0000181echo
Janos Follathb72c6782016-07-19 14:54:17 +0100182
Simon Butcher07d5a472020-02-26 15:29:40 +0000183echo " * Installed asan versions:"
Simon Butcher7bfeb662020-02-27 12:58:27 +0000184if type dpkg-query >/dev/null 2>/dev/null; then
185 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
186 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
187 grep .
188 then
189 echo " No asan versions installed."
190 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100191else
Simon Butcher7bfeb662020-02-27 12:58:27 +0000192 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100193fi
Janos Follathb72c6782016-07-19 14:54:17 +0100194echo