blob: 6e49688fe36af2e8aadd790dc6311f24ff33f43b [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001#!echo "This is not a shell script"
2#############################################################################
3# Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5#
6# This code is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License version 2 only, as
8# published by the Free Software Foundation.
9#
10# This code is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13# version 2 for more details (a copy is included in the LICENSE file that
14# accompanied this code).
15#
16# You should have received a copy of the GNU General Public License version
17# 2 along with this work; if not, write to the Free Software Foundation,
18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21# CA 95054 USA or visit www.sun.com if you need additional information or
22# have any questions.
23#############################################################################
24#
25# JPRT shell configuration for testing.
26#
27# Input environment variables:
28# Windows Only:
29# PATH
30# ROOTDIR
31#
32# Output variable settings:
33# make Full path to GNU make
34#
35# Output environment variables:
36# PATH
37#
38#############################################################################
39
40#############################################################################
41# Error
42error() # message
43{
44 echo "ERROR: $1"
45 exit 6
46}
47# Directory must exist
48dirMustExist() # dir name
49{
50 if [ ! -d "$1" ] ; then
51 error "Directory for $2 does not exist: $1"
52 fi
53}
54# File must exist
55fileMustExist() # dir name
56{
57 if [ ! -f "$1" ] ; then
58 error "File for $2 does not exist: $1"
59 fi
60}
61#############################################################################
62
63# Should be set by JPRT as the 3 basic inputs
64slashjava="${ALT_SLASH_JAVA}"
65if [ "${slashjava}" = "" ] ; then
66 slashjava=/java
67fi
68
69# Check input
70dirMustExist "${slashjava}" ALT_SLASH_JAVA
71
72# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
73osname=`uname -s`
74if [ "${osname}" = SunOS ] ; then
75
76 # SOLARIS: Sparc or X86
77 osarch=`uname -p`
78 if [ "${osarch}" = sparc ] ; then
79 solaris_arch=sparc
80 else
81 solaris_arch=i386
82 fi
83
84 # Add basic solaris system paths
85 path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
86
87 # Find GNU make
88 make=/usr/sfw/bin/gmake
89 if [ ! -f ${make} ] ; then
90 make=/opt/sfw/bin/gmake
91 if [ ! -f ${make} ] ; then
92 make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
93 fi
94 fi
95 fileMustExist "${make}" make
96
97 # File creation mask
98 umask 002
99
100elif [ "${osname}" = Linux ] ; then
101
102 # Add basic paths
103 path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
104
105 # Find GNU make
106 make=/usr/bin/make
107 fileMustExist "${make}" make
108
109 umask 002
110
111else
112
113 # Windows: Differs on CYGWIN vs. MKS.
114
115 # We need to determine if we are running a CYGWIN shell or an MKS shell
116 # (if uname isn't available, then it will be unix_toolset=unknown)
117 unix_toolset=unknown
118 if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
119 # We kind of assume ROOTDIR is where MKS is and it's ok
120 unix_toolset=MKS
121 mkshome=`dosname -s "${ROOTDIR}"`
122 # Most unix utilities are in the mksnt directory of ROOTDIR
123 unixcommand_path="${mkshome}/mksnt"
124 path4sdk="${unixcommand_path}"
125 devtools_path="${slashjava}/devtools/win32/bin"
126 path4sdk="${devtools_path};${path4sdk}"
127 # Find GNU make
128 make="${devtools_path}/gnumake.exe"
129 fileMustExist "${make}" make
130 elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
131 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
132 unix_toolset=CYGWIN
133 # Most unix utilities are in the /usr/bin
134 unixcommand_path="/usr/bin"
135 path4sdk="${unixcommand_path}"
136 # Find GNU make
137 make="${unixcommand_path}/make.exe"
138 fileMustExist "${make}" make
139 else
140 echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
141 fi
142
143
144 # For windows, it's hard to know where the system is, so we just add this
145 # to PATH.
146 slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
147 path4sdk="${slash_path};${PATH}"
148
149 # Convert path4sdk to cygwin style
150 if [ "${unix_toolset}" = CYGWIN ] ; then
151 path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
152 fi
153
154fi
155
156# Export PATH setting
157PATH="${path4sdk}"
158export PATH
159