Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / bin / midas
CommitLineData
86530b38
AT
1#! /bin/sh
2#
3# .local_perlmod_wrapper
4#
5
6
7die () {
8 message="$1"
9 echo "$tool -> .local_perlmod_wrapper: $message Exiting ..."
10 exit 1
11}
12
13############################ main ##############################
14
15tool=`basename $0`
16ARGV="$*"
17TRE_ROOT=$DV_ROOT/tools/perlmod
18TRE_TOOL2TOOLSET=${TRE_TOOL2TOOLSET:=$TRE_ROOT/tool2toolset}
19
20### Get toolset (a.k.a. package) name from the "tool2toolset" file
21
22toolset=`awk '{if($1 == var)print $2}' var=$tool $TRE_TOOL2TOOLSET`
23if [ -z "$toolset" ] ; then
24 die "flow not found!"
25else
26 TOOLSET=`echo $toolset |tr '[a-z]' '[A-Z]'`
27fi
28
29### Version may be set either by TRE or by environment variable
30### 'VERSION_$TOOLSET', if case TRE_ENTRY is set to '/'.
31### Either way, the version MUST be set.
32
33eval vers=\$VERSION_$TOOLSET
34
35if [ ! -z "$vers" ] && [ "$TRE_ENTRY" = '/' ] ; then
36 version=$vers
37elif [ ! -z "$TRE_SEARCH" ] && [ ! -z "$TRE_ENTRY" ] ; then
38if [ `uname -s` = "Linux" ]; then
39 version=`$DV_ROOT/tools/Linux/x86_64/configsrch $toolset $TRE_ENTRY` || die "configsrch failed!"
40fi
41if [ `uname -s` = "SunOS" ]; then
42 version=`$DV_ROOT/tools/bin/configsrch $toolset $TRE_ENTRY` || die "configsrch failed!"
43fi
44 version=`echo $version |awk '{print $1}'`
45 eval VERSION_$TOOLSET=\$version
46 eval export VERSION_$TOOLSET
47else
48 die "TRE_SEARCH & TRE_ENTRY are not set."
49fi
50
51### VERSION_$TOOLSET **MUST** be set, even if TRE is not used.
52
53if [ -z "$version" ] ; then
54 die "No version set for flow '$toolset'."
55fi
56
57### try to execute the toolset member tool
58### (the version is passed in VERSION_$TOOLSET)
59
60# necessary for the moment
61tool=midas
62
63# For versions at or before 3.09, use DiagBuild as the toolset
64major=`echo $version | sed 's/\..*//'`
65minor=`echo $version | sed 's/^.*\.//'`
66if [ $major -le 3 ] && [ $minor -le 9 ] ; then
67 toolset='DiagBuild'
68fi
69
70version=3.32
71
72exe=$TRE_ROOT/$toolset/$version/bin/$tool
73libpath=$TRE_ROOT/$toolset/$version/lib/site_perl/5.8.0
74
75if [ -z "$PERL5LIB" ] ; then
76 PERL5LIB=$libpath
77else
78 PERL5LIB=$libpath:$PERL5LIB
79fi
80export PERL5LIB
81
82if [ -x $exe ] ; then
83 exec $exe "$@"
84else
85 die "Executable $exe not found!"
86fi