source: mainline/contrib/tools/toolchain_check.sh@ be913d78

Last change on this file since be913d78 was be913d78, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago

Whittle down further

  • Property mode set to 100755
File size: 1.2 KB
Line 
1#!/bin/sh
2#
3# SPDX-FileCopyrightText: 2022 HelenOS Project
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8[ -z "$CROSS_HELENOS_PREFIX" ] && CROSS_HELENOS_PREFIX="/usr/local/cross-helenos"
9
10get_define() {
11 echo "$2" | "$1" -E -P -
12}
13
14print_error() {
15 echo " ERROR:" "$@"
16}
17
18check_define() {
19 def_value=`get_define "$1" "$2"`
20 if [ "$def_value" = "$3" ]; then
21 return 0
22 else
23 print_error "Macro $1 not defined (expected '$3', got '$def_value')."
24 return 1
25 fi
26}
27
28print_version() {
29 if [ -x "$1" ]; then
30 echo " " `$1 --version 2>/dev/null | head -n 1` "@ $1"
31 else
32 print_error "$2";
33 return 1
34 fi
35}
36
37for arch_path in "$CROSS_HELENOS_PREFIX"/*; do
38 arch=`echo "$arch_path" | sed -e 's#/$##' -e 's#.*/\([^/]*\)#\1#'`
39 echo "Checking $arch..."
40
41 gcc_path=`echo "$arch_path"/bin/*-gcc`
42 ld_path=`echo "$arch_path"/bin/*-ld`
43 objcopy_path=`echo "$arch_path"/bin/*-objcopy`
44 gdb_path=`echo "$arch_path"/bin/*-gdb`
45
46 print_version "$ld_path" "Linker not found!" || continue
47
48 print_version "$objcopy_path" "objcopy not found!" || continue
49
50 print_version "$gcc_path" "GCC not found!" || continue
51 check_define "$gcc_path" "__helenos__" 1 || continue
52 check_define "$gcc_path" "helenos_uarch" "$arch" || continue
53
54 print_version "$gdb_path" "GDB not found!" || continue
55done
Note: See TracBrowser for help on using the repository browser.