blob: c9a131d210df0aebfce9039fa1b5ddfeef1663d6 [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úti44bfbe32020-08-19 16:54:51 +02005# Copyright The Mbed TLS Contributors
Bence Szépkúti4e9f7122020-06-05 13:02:18 +02006# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
7#
8# This file is provided under the Apache License 2.0, or the
9# GNU General Public License v2.0 or later.
10#
11# **********
12# Apache License 2.0:
Bence Szépkúti09b4f192020-05-26 01:54:15 +020013#
14# Licensed under the Apache License, Version 2.0 (the "License"); you may
15# not use this file except in compliance with the License.
16# You may obtain a copy of the License at
17#
18# http://www.apache.org/licenses/LICENSE-2.0
19#
20# Unless required by applicable law or agreed to in writing, software
21# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23# See the License for the specific language governing permissions and
24# limitations under the License.
25#
Bence Szépkúti4e9f7122020-06-05 13:02:18 +020026# **********
27#
28# **********
29# GNU General Public License v2.0 or later:
30#
31# This program is free software; you can redistribute it and/or modify
32# it under the terms of the GNU General Public License as published by
33# the Free Software Foundation; either version 2 of the License, or
34# (at your option) any later version.
35#
36# This program is distributed in the hope that it will be useful,
37# but WITHOUT ANY WARRANTY; without even the implied warranty of
38# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39# GNU General Public License for more details.
40#
41# You should have received a copy of the GNU General Public License along
42# with this program; if not, write to the Free Software Foundation, Inc.,
43# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
44#
45# **********
46#
Janos Follathb72c6782016-07-19 14:54:17 +010047# Purpose
48#
49# To print out all the relevant information about the development environment.
50#
51# This includes:
52# - architecture of the system
53# - type and version of the operating system
Ronald Crona960dc92020-05-25 13:11:32 +020054# - version of make and cmake
Simon Butcher3ac07672016-09-04 14:28:44 +030055# - version of armcc, clang, gcc-arm and gcc compilers
56# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010057# - version of gnuTLS and OpenSSL
58
Andres AG31f9b5b2016-10-04 17:14:38 +010059print_version()
60{
61 BIN="$1"
62 shift
63 ARGS="$1"
64 shift
Simon Butcher82770412020-03-05 15:18:53 +000065 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010066 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010067
Simon Butcherd40e6032020-02-27 12:58:27 +000068 if [ -n "$VARIANT" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000069 VARIANT=" ($VARIANT)"
70 fi
71
Simon Butcherd40e6032020-02-27 12:58:27 +000072 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher870ee822020-02-26 15:29:40 +000073 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010074 return 0
Andres AG87bb5772016-09-27 15:05:15 +010075 fi
Andres AG87bb5772016-09-27 15:05:15 +010076
Andres AG31f9b5b2016-10-04 17:14:38 +010077 BIN=`which "$BIN"`
78 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010079
Andres AG31f9b5b2016-10-04 17:14:38 +010080 # Apply all filters
81 while [ $# -gt 0 ]; do
82 FILTER="$1"
83 shift
84 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
85 done
86
Simon Butcher82770412020-03-05 15:18:53 +000087 if [ -z "$VERSION_STR" ]; then
88 VERSION_STR="Version could not be determined."
89 fi
90
Simon Butcher870ee822020-02-26 15:29:40 +000091 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010092}
93
Simon Butcherd40e6032020-02-27 12:58:27 +000094echo "** Platform:"
95echo
96
97if [ `uname -s` = "Linux" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +000098 echo "Linux variant"
99 lsb_release -d -c
100else
101 echo "Unknown Unix variant"
102fi
103
Janos Follathb72c6782016-07-19 14:54:17 +0100104echo
Janos Follathb72c6782016-07-19 14:54:17 +0100105
Simon Butcher870ee822020-02-26 15:29:40 +0000106print_version "uname" "-a" ""
Simon Butcher82770412020-03-05 15:18:53 +0000107
Simon Butcherd40e6032020-02-27 12:58:27 +0000108echo
109echo
110echo "** Tool Versions:"
111echo
Simon Butcher870ee822020-02-26 15:29:40 +0000112
Ronald Crona960dc92020-05-25 13:11:32 +0200113print_version "make" "--version" "" "head -n 1"
114echo
115
116print_version "cmake" "--version" "" "head -n 1"
117echo
118
Gilles Peskine53038eb2018-03-21 08:35:07 +0100119if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
120 : "${ARMC5_CC:=armcc}"
Simon Butcher870ee822020-02-26 15:29:40 +0000121 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +0100122 echo
Janos Follathb72c6782016-07-19 14:54:17 +0100123
Gilles Peskine53038eb2018-03-21 08:35:07 +0100124 : "${ARMC6_CC:=armclang}"
Simon Butcher870ee822020-02-26 15:29:40 +0000125 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine53038eb2018-03-21 08:35:07 +0100126 echo
127fi
Janos Follathb72c6782016-07-19 14:54:17 +0100128
Simon Butcher870ee822020-02-26 15:29:40 +0000129print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100130echo
Janos Follathb72c6782016-07-19 14:54:17 +0100131
Simon Butcher870ee822020-02-26 15:29:40 +0000132print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100133echo
Janos Follathb72c6782016-07-19 14:54:17 +0100134
Simon Butcher870ee822020-02-26 15:29:40 +0000135print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +0100136echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100137
Simon Butcher870ee822020-02-26 15:29:40 +0000138print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100139echo
140
Simon Butcher870ee822020-02-26 15:29:40 +0000141print_version "valgrind" "--version" ""
142echo
143
144print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100145echo
146
Simon Butcher82770412020-03-05 15:18:53 +0000147print_version "perl" "--version" "" "head -n 2" "grep ."
148echo
149
150print_version "python" "--version" "" "head -n 1"
151echo
152
Ronald Cron6872e172020-05-25 13:55:21 +0200153print_version "python3" "--version" "" "head -n 1"
154echo
155
Simon Butcher8eb64e62020-03-06 14:50:49 +0000156print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
Simon Butcher82770412020-03-05 15:18:53 +0000157echo
158
Andres AG31f9b5b2016-10-04 17:14:38 +0100159: ${OPENSSL:=openssl}
Simon Butcher870ee822020-02-26 15:29:40 +0000160print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100161echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100162
163if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000164 print_version "$OPENSSL_LEGACY" "version" "legacy"
165else
166 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100167fi
Simon Butcher870ee822020-02-26 15:29:40 +0000168echo
Janos Follathb72c6782016-07-19 14:54:17 +0100169
Andres AG31f9b5b2016-10-04 17:14:38 +0100170: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher870ee822020-02-26 15:29:40 +0000171print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100172echo
Janos Follathb72c6782016-07-19 14:54:17 +0100173
Andres AG31f9b5b2016-10-04 17:14:38 +0100174: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher870ee822020-02-26 15:29:40 +0000175print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100176echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100177
178if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000179 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
180else
181 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100182fi
Simon Butcher870ee822020-02-26 15:29:40 +0000183echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100184
185if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher870ee822020-02-26 15:29:40 +0000186 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
187else
188 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100189fi
Simon Butcher870ee822020-02-26 15:29:40 +0000190echo
Janos Follathb72c6782016-07-19 14:54:17 +0100191
Simon Butcher870ee822020-02-26 15:29:40 +0000192echo " * Installed asan versions:"
Simon Butcherd40e6032020-02-27 12:58:27 +0000193if type dpkg-query >/dev/null 2>/dev/null; then
194 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
195 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
196 grep .
197 then
198 echo " No asan versions installed."
199 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100200else
Simon Butcherd40e6032020-02-27 12:58:27 +0000201 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100202fi
Janos Follathb72c6782016-07-19 14:54:17 +0100203echo