make/jprt.config

changeset 1
9a66ca7c79fa
equal deleted inserted replaced
-1:000000000000 1:9a66ca7c79fa
1 #!echo "This is not a shell script"
2 #############################################################################
3 #
4 # Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
5 # 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. Sun designates this
10 # particular file as subject to the "Classpath" exception as provided
11 # by Sun in the LICENSE file that accompanied this code.
12 #
13 # This code is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # version 2 for more details (a copy is included in the LICENSE file that
17 # accompanied this code).
18 #
19 # You should have received a copy of the GNU General Public License version
20 # 2 along with this work; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 #
23 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
24 # CA 95054 USA or visit www.sun.com if you need additional information or
25 # have any questions.
26 #
27 #############################################################################
28 #
29 # JPRT shell configuration for building.
30 #
31 # Input environment variables:
32 # ALT_BOOTDIR
33 # ALT_SLASH_JAVA
34 # ALT_JDK_IMPORT_PATH
35 # Windows Only:
36 # PATH
37 # PROCESSOR_IDENTIFIER
38 # ROOTDIR
39 #
40 # Output variable settings:
41 # make Full path to GNU make
42 #
43 # Output environment variables:
44 # PATH
45 # Windows Only:
46 # ALT_DEVTOOLS_PATH (To avoid the C:/UTILS default)
47 #
48 # After JDK6, most settings will be found via ALT_SLASH_JAVA or
49 # by way of other system environment variables. If this was JDK5
50 # or an older JDK, you might need to export more ALT_* variables.
51 #
52 #############################################################################
53
54 #############################################################################
55 # Error
56 error() # message
57 {
58 echo "ERROR: $1"
59 exit 6
60 }
61 # Directory must exist
62 dirMustExist() # dir name
63 {
64 if [ ! -d "$1" ] ; then
65 error "Directory for $2 does not exist: $1"
66 fi
67 }
68 # File must exist
69 fileMustExist() # dir name
70 {
71 if [ ! -f "$1" ] ; then
72 error "File for $2 does not exist: $1"
73 fi
74 }
75 #############################################################################
76
77 # Should be set by JPRT as the 3 basic inputs
78 bootdir="${ALT_BOOTDIR}"
79 slashjava="${ALT_SLASH_JAVA}"
80 jdk_import="${ALT_JDK_IMPORT_PATH}"
81
82 # Check input
83 dirMustExist "${bootdir}" ALT_BOOTDIR
84 dirMustExist "${slashjava}" ALT_SLASH_JAVA
85 dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH
86
87 # Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
88 osname=`uname -s`
89 if [ "${osname}" = SunOS ] ; then
90
91 # SOLARIS: Sparc or X86
92 osarch=`uname -p`
93 if [ "${osarch}" = sparc ] ; then
94 solaris_arch=sparc
95 else
96 solaris_arch=i386
97 fi
98
99 # Add basic solaris system paths
100 path4sdk=/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
101
102 # Get the previous JDK to be used to bootstrap the build
103 path4sdk=${bootdir}/bin:${path4sdk}
104
105 # Ant
106 ANT_HOME=${slashjava}/devtools/share/ant/1.7.0
107 export ANT_HOME
108 antbindir=${ANT_HOME}/bin
109 fileMustExist "${antbindir}/ant" ant
110 path4sdk=${antbindir}:${path4sdk}
111
112 # Find GNU make
113 make=/usr/sfw/bin/gmake
114 if [ ! -f ${make} ] ; then
115 make=/opt/sfw/bin/gmake
116 if [ ! -f ${make} ] ; then
117 make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
118 fi
119 fi
120 fileMustExist "${make}" make
121
122 # File creation mask
123 umask 002
124
125 elif [ "${osname}" = Linux ] ; then
126
127 # LINUX: X86, AMD64
128 osarch=`uname -m`
129 if [ "${osarch}" = i686 ] ; then
130 linux_arch=i586
131 elif [ "${osarch}" = x86_64 ] ; then
132 linux_arch=amd64
133 fi
134
135 # Add basic paths
136 path4sdk=/usr/bin:/bin:/usr/sbin:/sbin
137
138 # Get the previous JDK to be used to bootstrap the build
139 path4sdk=${bootdir}/bin:${path4sdk}
140
141 # Ant
142 ANT_HOME=${slashjava}/devtools/share/ant/1.7.0
143 export ANT_HOME
144 antbindir=${ANT_HOME}/bin
145 fileMustExist "${antbindir}/ant" ant
146 path4sdk=${antbindir}:${path4sdk}
147
148 # Find GNU make
149 make=/usr/bin/make
150 fileMustExist "${make}" make
151
152 umask 002
153
154 else
155
156 # Windows: Differs on CYGWIN vs. MKS
157 # Also, blanks in pathnames gives GNU make headaches, so anything placed
158 # in any ALT_* variable should be the short windows dosname.
159
160 # WINDOWS: Install and use MKS or CYGWIN (should have already been done)
161 # Assumption here is that you are in a shell window via MKS or cygwin.
162 # MKS install should have defined the environment variable ROOTDIR.
163 # We also need to figure out which one we have: X86, AMD64
164 if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
165 windows_arch=amd64
166 else
167 windows_arch=i586
168 fi
169
170 # We need to determine if we are running a CYGWIN shell or an MKS shell
171 # (if uname isn't available, then it will be unix_toolset=unknown)
172 unix_toolset=unknown
173 if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
174 # We kind of assume ROOTDIR is where MKS is and it's ok
175 unix_toolset=MKS
176 mkshome=`dosname -s "${ROOTDIR}"`
177 # Utility to convert to short pathnames without spaces
178 dosname="${mkshome}/mksnt/dosname -s"
179 # Most unix utilities are in the mksnt directory of ROOTDIR
180 unixcommand_path="${mkshome}/mksnt"
181 path4sdk="${unixcommand_path}"
182 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
183 devtools_path="${slashjava}/devtools/win32/bin"
184 path4sdk="${devtools_path};${path4sdk}"
185 # Normally this need not be set, but on Windows it's default is C:/UTILS
186 ALT_DEVTOOLS_PATH="${devtools_path}"
187 export ALT_DEVTOOLS_PATH
188 dirMustExist "${devtools_path}" ALT_DEVTOOLS_PATH
189 # Find GNU make
190 make="${devtools_path}/gnumake.exe"
191 fileMustExist "${make}" make
192 elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
193 # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
194 unix_toolset=CYGWIN
195 # Utility to convert to short pathnames without spaces
196 dosname="/usr/bin/cygpath -a -m -s"
197 # Most unix utilities are in the /usr/bin
198 unixcommand_path="/usr/bin"
199 path4sdk="${unixcommand_path}"
200 dirMustExist "${unixcommand_path}" ALT_UNIXCOMMAND_PATH
201 # Find GNU make
202 make="${unixcommand_path}/make.exe"
203 fileMustExist "${make}" make
204 else
205 echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
206 fi
207
208 # WINDOWS: Get the previous JDK to be used to bootstrap the build
209 path4sdk="${bootdir}/bin;${path4sdk}"
210
211 # Ant
212 ANT_HOME=${slashjava}/devtools/share/ant/1.7.0
213 export ANT_HOME
214 antbindir=${ANT_HOME}/bin
215 fileMustExist "${antbindir}/ant" ant
216 path4sdk="${antbindir};${path4sdk}"
217
218 # Turn all \\ into /, remove duplicates and trailing /
219 slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
220
221 # For windows, it's hard to know where the system is, so we just add this
222 # to PATH.
223 path4sdk="${slash_path};${PATH}"
224
225 # Convert path4sdk to cygwin style
226 if [ "${unix_toolset}" = CYGWIN ] ; then
227 path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
228 fi
229
230 fi
231
232 # Export PATH setting
233 PATH="${path4sdk}"
234 export PATH
235
236 # Things we need to unset
237 unset LD_LIBRARY_PATH
238 unset LD_LIBRARY_PATH_32
239 unset LD_LIBRARY_PATH_64
240 unset JAVA_HOME
241

mercurial