test/jprt.config

changeset 1227
08a3425f39f8
parent 554
9d9f26857129
equal deleted inserted replaced
1214:a1af4b95c287 1227:08a3425f39f8
1 #!echo "This is not a shell script"
2 #############################################################################
3 # Copyright (c) 2006, 2007, Oracle and/or its affiliates. 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 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.
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
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
100 elif [ "${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
111 else
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
154 fi
155
156 # Export PATH setting
157 PATH="${path4sdk}"
158 export PATH
159

mercurial