jjb: Add C++ to print.sh
[lttng-ci.git] / scripts / common / print.sh
CommitLineData
51c9c62d
MJ
1#!/bin/bash
2#
3# Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
4#
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18set -exu
19
20COLOR_BLUE='\033[0;34m'
21COLOR_NONE='\033[0m' # No Color
22
23print_blue() {
24 echo -e "${COLOR_BLUE}$1${COLOR_NONE}"
25}
26
27print_os() {
28 set +ex
29
30 print_blue "Operating System Details"
31
32 if [ -f "/etc/os-release" ]; then
33 (. "/etc/os-release"; echo "Version: $NAME $VERSION")
34 elif [ -f "/etc/release" ]; then
35 echo "Version: $(head -n1 /etc/release)"
36 elif command -v sw_vers >/dev/null 2>&1; then
37 # For MacOS
38 echo "Version: $(sw_vers -productName) $(sw_vers -productVersion)"
39 fi
40
41 echo -n "Kernel: "
42 uname -a
43
44 set -ex
45}
46
47print_pkgconfig_mod() {
48 local mod=$1
49 if pkg-config --exists "${mod}"; then
50 print_blue "$mod version"
51 pkg-config --modversion "${mod}"
52 fi
53}
54
55print_tooling() {
56 set +ex
57
58 print_blue "Selected CC version"
59 ${CC:-cc} --version | head -n1
60
61 print_blue "Default gcc version"
62 gcc --version | head -n1
63 gcc -dumpmachine
64
0a4d9865
MJ
65 print_blue "Selected CXX version"
66 ${CXX:-c++} --version | head -n1
67
68 print_blue "Default g++ version"
69 g++ --version | head -n1
70 g++ -dumpmachine
71
51c9c62d
MJ
72 if command -v clang >/dev/null 2>&1; then
73 print_blue "Default clang version"
74 clang --version
75 fi
76
0a4d9865
MJ
77 if command -v clang++ >/dev/null 2>&1; then
78 print_blue "Default clang++ version"
79 clang++ --version
80 fi
81
51c9c62d
MJ
82 print_blue "git version"
83 git --version
84
85 print_blue "bash version"
86 bash --version | head -n1
87
88 print_blue "make version"
89 ${MAKE:-make} --version | head -n1
90
91 if command -v cmake >/dev/null 2>&1; then
92 print_blue "cmake version"
93 cmake --version
94 fi
95
96 print_blue "automake version"
97 automake --version | head -n1
98
99 print_blue "autoconf version"
100 autoconf --version | head -n1
101
102 print_blue "libtool version"
103 if libtool --version >/dev/null 2>&1; then
104 libtool --version | head -n1
105 else
106 # Thanks Apple!
107 libtool -V
108 fi
109
110 print_blue "bison version"
111 ${BISON:-bison} --version | head -n1
112
113 print_blue "flex version"
114 ${FLEX:-flex} --version
115
116 print_blue "swig version"
117 swig -version | ${GREP:-grep} SWIG
118
119 print_blue "tar version"
120 ${TAR:-tar} --version | head -n1
121
122 print_blue "Selected python version"
4688a6cd 123 ${PYTHON:-python} --version
51c9c62d
MJ
124
125 if command -v "${PYTHON2:-python2}" >/dev/null 2>&1; then
126 print_blue "python2 version"
127 ${PYTHON2:-python2} --version
128 fi
129
130 if command -v "${PYTHON3:-python3}" >/dev/null 2>&1; then
131 print_blue "python3 version"
132 ${PYTHON3:-python3} --version
133 fi
134
135 print_blue "java version"
136 java -version
137
138 print_blue "javac version"
139 javac -version
140
141 if command -v asciidoc >/dev/null 2>&1; then
142 print_blue "asciidoc version"
143 asciidoc --version
144 fi
145
146 if command -v xmlto >/dev/null 2>&1; then
147 print_blue "xmlto version"
148 xmlto --version
149 fi
150
151 if command -v openssl >/dev/null 2>&1; then
152 print_blue "openssl version"
153 openssl version
154 fi
155
156 if command -v pkg-config >/dev/null 2>&1; then
157 print_blue "pkg-config version"
158 pkg-config --version
159
160 #print_blue "pkg-config modules installed"
161 #pkg-config --list-all
162
163 print_pkgconfig_mod glib-2.0
164 print_pkgconfig_mod libdw
165 print_pkgconfig_mod libelf
166 print_pkgconfig_mod libxml-2.0
167 print_pkgconfig_mod msgpack
168 print_pkgconfig_mod popt
169 print_pkgconfig_mod uuid
170 print_pkgconfig_mod zlib
171 fi
172
173 set -ex
174}
This page took 0.032513 seconds and 4 git commands to generate.