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