jprt.config revision 2721:f08d439fab8c
1256949Sganbold#!echo "This is not a shell script"
2266337Sian#############################################################################
3256949Sganbold# 
4256949Sganbold# Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
5256949Sganbold# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6256949Sganbold#
7256949Sganbold# This code is free software; you can redistribute it and/or modify it
8256949Sganbold# under the terms of the GNU General Public License version 2 only, as
9256949Sganbold# published by the Free Software Foundation.
10256949Sganbold#
11256949Sganbold# This code is distributed in the hope that it will be useful, but WITHOUT
12256949Sganbold# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13256949Sganbold# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14256949Sganbold# version 2 for more details (a copy is included in the LICENSE file that
15256949Sganbold# accompanied this code).
16256949Sganbold#
17256949Sganbold# You should have received a copy of the GNU General Public License version
18256949Sganbold# 2 along with this work; if not, write to the Free Software Foundation,
19256949Sganbold# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20256949Sganbold#
21256949Sganbold# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22256949Sganbold# or visit www.oracle.com if you need additional information or have any
23256949Sganbold# questions.
24256949Sganbold# 
25256949Sganbold#############################################################################
26256949Sganbold
27256949Sganbold#############################################################################
28256949Sganbold#
29256949Sganbold# JPRT shell configuration for testing.
30256949Sganbold#
31256949Sganbold# Input environment variables:
32256949Sganbold#    Windows Only:
33256949Sganbold#      PATH
34256949Sganbold#      ROOTDIR
35256949Sganbold#
36256949Sganbold# Output variable settings:
37256949Sganbold#    make    Full path to GNU make
38256949Sganbold#
39256949Sganbold# Output environment variables:
40256949Sganbold#    PATH
41256949Sganbold#
42256949Sganbold#############################################################################
43256949Sganbold
44256949Sganbold#############################################################################
45256949Sganbold# Error
46256949Sganbolderror() # message
47256949Sganbold{
48256949Sganbold  echo "ERROR: $1"
49256949Sganbold  exit 6
50256949Sganbold}
51256949Sganbold# Directory must exist
52256949SganbolddirMustExist() # dir name
53256949Sganbold{
54256949Sganbold  if [ ! -d "$1" ] ; then
55256949Sganbold    error "Directory for $2 does not exist: $1"
56256949Sganbold  fi
57256949Sganbold}
58256949Sganbold# File must exist
59256949SganboldfileMustExist() # dir name
60256949Sganbold{
61256949Sganbold  if [ ! -f "$1" ] ; then
62256949Sganbold    error "File for $2 does not exist: $1"
63256949Sganbold  fi
64256949Sganbold}
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`
78case "${osname}" in
79  SunOS )
80    # 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
103    ;;
104
105  Linux | Darwin )
106    # 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
114    ;;
115
116  FreeBSD | OpenBSD )
117    # Add basic paths
118    path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
119
120    # 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  * )
139    # 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
179    ;;
180esac
181
182# Export PATH setting
183PATH="${path4sdk}"
184export PATH
185
186