blob: cfce12961b89165fddde1eeb1ce0c111eed18fd7 [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úti09b4f192020-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 Crona960dc92020-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 Butcher82770412020-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 Butcherd40e6032020-02-27 12:58:27 +000043 if [ -n "$VARIANT" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000044 VARIANT=" ($VARIANT)"
45 fi
46
Simon Butcherd40e6032020-02-27 12:58:27 +000047 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher870ee822020-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 Butcher82770412020-03-05 15:18:53 +000062 if [ -z "$VERSION_STR" ]; then
63 VERSION_STR="Version could not be determined."
64 fi
65
Simon Butcher870ee822020-02-26 15:29:40 +000066 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010067}
68
Simon Butcherd40e6032020-02-27 12:58:27 +000069echo "** Platform:"
70echo
71
72if [ `uname -s` = "Linux" ]; then
Simon Butcher870ee822020-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 Butcher870ee822020-02-26 15:29:40 +000081print_version "uname" "-a" ""
Simon Butcher82770412020-03-05 15:18:53 +000082
Simon Butcherd40e6032020-02-27 12:58:27 +000083echo
84echo
85echo "** Tool Versions:"
86echo
Simon Butcher870ee822020-02-26 15:29:40 +000087
Ronald Crona960dc92020-05-25 13:11:32 +020088print_version "make" "--version" "" "head -n 1"
89echo
90
91print_version "cmake" "--version" "" "head -n 1"
92echo
93
Gilles Peskine53038eb2018-03-21 08:35:07 +010094if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
95 : "${ARMC5_CC:=armcc}"
Simon Butcher870ee822020-02-26 15:29:40 +000096 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +010097 echo
Janos Follathb72c6782016-07-19 14:54:17 +010098
Gilles Peskine53038eb2018-03-21 08:35:07 +010099 : "${ARMC6_CC:=armclang}"
Simon Butcher870ee822020-02-26 15:29:40 +0000100 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +0100101 echo
102fi
Janos Follathb72c6782016-07-19 14:54:17 +0100103
Simon Butcher870ee822020-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 Butcher870ee822020-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 Butcher870ee822020-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 Butcher870ee822020-02-26 15:29:40 +0000113print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100114echo
115
Simon Butcher870ee822020-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 Butcher82770412020-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 Cron6872e172020-05-25 13:55:21 +0200128print_version "python3" "--version" "" "head -n 1"
129echo
130
Simon Butcher8eb64e62020-03-06 14:50:49 +0000131print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
Simon Butcher82770412020-03-05 15:18:53 +0000132echo
133
Andres AG31f9b5b2016-10-04 17:14:38 +0100134: ${OPENSSL:=openssl}
Simon Butcher870ee822020-02-26 15:29:40 +0000135print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100136echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100137
138if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000139 print_version "$OPENSSL_LEGACY" "version" "legacy"
140else
141 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100142fi
Simon Butcher870ee822020-02-26 15:29:40 +0000143echo
Janos Follathb72c6782016-07-19 14:54:17 +0100144
Andres AG31f9b5b2016-10-04 17:14:38 +0100145: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher870ee822020-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 Butcher870ee822020-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 Butcher870ee822020-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 Butcher870ee822020-02-26 15:29:40 +0000158echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100159
160if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher870ee822020-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 Butcher870ee822020-02-26 15:29:40 +0000165echo
Janos Follathb72c6782016-07-19 14:54:17 +0100166
Simon Butcher870ee822020-02-26 15:29:40 +0000167echo " * Installed asan versions:"
Simon Butcherd40e6032020-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 Butcherd40e6032020-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