Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | #! /bin/sh -f |
2 | # ========== Copyright Header Begin ========================================== | |
3 | # | |
4 | # OpenSPARC T1 Processor File: makeinfo | |
5 | # Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | # | |
8 | # The above named program is free software; you can redistribute it and/or | |
9 | # modify it under the terms of the GNU General Public | |
10 | # License version 2 as published by the Free Software Foundation. | |
11 | # | |
12 | # The above named program is distributed in the hope that it will be | |
13 | # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | # General Public License for more details. | |
16 | # | |
17 | # You should have received a copy of the GNU General Public | |
18 | # License along with this work; if not, write to the Free Software | |
19 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | # | |
21 | # ========== Copyright Header End ============================================ | |
22 | # | |
23 | ##################################################################### | |
24 | ## | |
25 | ## Description : .gnu_tool_wrapper | |
26 | ## | |
27 | ####################################################################### | |
28 | ||
29 | ||
30 | die () { | |
31 | message="$1" | |
32 | echo "$tool-> $message Exiting ..." | |
33 | exit 1 | |
34 | } | |
35 | ############################ main ############################## | |
36 | ||
37 | tool=`basename $0` | |
38 | ARGV="$*" | |
39 | GNU_ROOT=/freetools/local | |
40 | GNU_TOOL2PKG=${GNU_TOOL2PKG:=$GNU_ROOT/.tool2pkg} | |
41 | ||
42 | ### Get GNU package name from the "tool2pkg" file | |
43 | ||
44 | pkg=`/bin/awk '{if($1 == var)print $2}' var=$tool $GNU_TOOL2PKG` | |
45 | if [ -z "$pkg" ] ; then | |
46 | die "gnu package not found!" | |
47 | fi | |
48 | ||
49 | version=`configsrch $tool 2> /dev/null` | |
50 | ||
51 | if [ $? != 0 ] ; then | |
52 | version=`gnusrch $tool` | |
53 | if [ $? != 0 ] ; then | |
54 | gnusrch_version=$version | |
55 | #die "gnusrch returned error code: $version" | |
56 | version=latest | |
57 | fi | |
58 | fi | |
59 | ||
60 | version=`echo $version |/bin/awk '{print $1}'` | |
61 | if [ -z "$version" ] ; then | |
62 | die "No version set for $tool in $pkg." | |
63 | fi | |
64 | ||
65 | ### Assemble to exe path | |
66 | ||
67 | exe=$GNU_ROOT/$pkg/$version/bin/$tool | |
68 | ||
69 | if [ -x $exe ] ; then | |
70 | exec $exe "$@" | |
71 | elif [ $version -eq latest ] ; then | |
72 | die "gnusrch returned error code: $gnusrch_version" | |
73 | else | |
74 | die "Executable $exe not found!" | |
75 | fi |