author | gadams |
Tue, 09 Jan 2018 13:58:30 -0500 | |
changeset 48629 | a58c1924e037 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
2 | 1 |
#!echo "This is not a shell script" |
2 |
############################################################################# |
|
5506 | 3 |
# Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
# |
|
5506 | 20 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 |
# or visit www.oracle.com if you need additional information or have any |
|
22 |
# questions. |
|
2 | 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 |
|
42 |
error() # message |
|
43 |
{ |
|
44 |
echo "ERROR: $1" |
|
45 |
exit 6 |
|
46 |
} |
|
47 |
# Directory must exist |
|
48 |
dirMustExist() # dir name |
|
49 |
{ |
|
50 |
if [ ! -d "$1" ] ; then |
|
51 |
error "Directory for $2 does not exist: $1" |
|
52 |
fi |
|
53 |
} |
|
54 |
# File must exist |
|
55 |
fileMustExist() # 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 |
|
64 |
slashjava="${ALT_SLASH_JAVA}" |
|
65 |
if [ "${slashjava}" = "" ] ; then |
|
66 |
slashjava=/java |
|
67 |
fi |
|
68 |
||
69 |
# Check input |
|
70 |
dirMustExist "${slashjava}" ALT_SLASH_JAVA |
|
71 |
||
72 |
# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise. |
|
73 |
osname=`uname -s` |
|
74 |
if [ "${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 |
|
41107
567f832618d7
8165161: Solaris: /usr/ccs /opt/sfw and /opt/csw are dead, references should be expunged
alanbur
parents:
5506
diff
changeset
|
85 |
path4sdk=/usr/bin:/usr/gnu/bin |
2 | 86 |
|
87 |
# Find GNU make |
|
41107
567f832618d7
8165161: Solaris: /usr/ccs /opt/sfw and /opt/csw are dead, references should be expunged
alanbur
parents:
5506
diff
changeset
|
88 |
make=/usr/bin/gmake |
2 | 89 |
if [ ! -f ${make} ] ; then |
41107
567f832618d7
8165161: Solaris: /usr/ccs /opt/sfw and /opt/csw are dead, references should be expunged
alanbur
parents:
5506
diff
changeset
|
90 |
make=${slashjava}/devtools/${solaris_arch}/bin/gnumake |
2 | 91 |
fi |
92 |
fileMustExist "${make}" make |
|
93 |
||
94 |
# File creation mask |
|
95 |
umask 002 |
|
96 |
||
97 |
elif [ "${osname}" = Linux ] ; then |
|
98 |
||
99 |
# Add basic paths |
|
100 |
path4sdk=/usr/bin:/bin:/usr/sbin:/sbin |
|
101 |
||
102 |
# Find GNU make |
|
103 |
make=/usr/bin/make |
|
104 |
fileMustExist "${make}" make |
|
105 |
||
106 |
umask 002 |
|
107 |
||
108 |
else |
|
109 |
||
110 |
# Windows: Differs on CYGWIN vs. MKS. |
|
111 |
||
112 |
# We need to determine if we are running a CYGWIN shell or an MKS shell |
|
113 |
# (if uname isn't available, then it will be unix_toolset=unknown) |
|
114 |
unix_toolset=unknown |
|
115 |
if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then |
|
116 |
# We kind of assume ROOTDIR is where MKS is and it's ok |
|
117 |
unix_toolset=MKS |
|
118 |
mkshome=`dosname -s "${ROOTDIR}"` |
|
119 |
# Most unix utilities are in the mksnt directory of ROOTDIR |
|
120 |
unixcommand_path="${mkshome}/mksnt" |
|
121 |
path4sdk="${unixcommand_path}" |
|
122 |
devtools_path="${slashjava}/devtools/win32/bin" |
|
123 |
path4sdk="${devtools_path};${path4sdk}" |
|
124 |
# Find GNU make |
|
125 |
make="${devtools_path}/gnumake.exe" |
|
126 |
fileMustExist "${make}" make |
|
127 |
elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then |
|
128 |
# For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist |
|
129 |
unix_toolset=CYGWIN |
|
130 |
# Most unix utilities are in the /usr/bin |
|
131 |
unixcommand_path="/usr/bin" |
|
132 |
path4sdk="${unixcommand_path}" |
|
133 |
# Find GNU make |
|
134 |
make="${unixcommand_path}/make.exe" |
|
135 |
fileMustExist "${make}" make |
|
136 |
else |
|
137 |
echo "WARNING: Cannot figure out if this is MKS or CYGWIN" |
|
138 |
fi |
|
139 |
||
140 |
||
141 |
# For windows, it's hard to know where the system is, so we just add this |
|
142 |
# to PATH. |
|
143 |
slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`" |
|
144 |
path4sdk="${slash_path};${PATH}" |
|
145 |
||
146 |
# Convert path4sdk to cygwin style |
|
147 |
if [ "${unix_toolset}" = CYGWIN ] ; then |
|
148 |
path4sdk="`/usr/bin/cygpath -p ${path4sdk}`" |
|
149 |
fi |
|
150 |
||
151 |
fi |
|
152 |
||
153 |
# Export PATH setting |
|
154 |
PATH="${path4sdk}" |
|
155 |
export PATH |
|
156 |