blob: af8d1cbd719a576f3fd9fe67c1d9457ef0516e74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables
# before spawning a shell for doing a release-style builds interactively
# and incrementally.
#
USAGE='Usage: bldenv [-fdt] [ -S E|D|H|O ] <env_file> [ command ]
Where:
-c Force the use of csh - ignore $SHELL
-f Invoke csh with -f
-d Setup a DEBUG build (default: non-DEBUG)
-t use the tools in $SRC/tools
-S Build a variant of the source product
E - build exportable source
D - build domestic source (exportable + crypt)
H - build hybrid source (binaries + deleted source)
O - simulate OpenSolaris build
'
c_FLAG=n
f_FLAG=n
d_FLAG=n
O_FLAG=n
o_FLAG=n
t_FLAG=n
SE_FLAG=n
SH_FLAG=n
SD_FLAG=n
SO_FLAG=n
is_source_build() {
[ "$SE_FLAG" = "y" -o "$SD_FLAG" = "y" -o \
"$SH_FLAG" = "y" -o "$SO_FLAG" = "y" ]
return $?
}
#
# single function for setting -S flag and doing error checking.
# usage: set_S_flag <type>
# where <type> is the source build type ("E", "D", ...).
#
set_S_flag() {
if is_source_build; then
echo "Can only build one source variant at a time."
exit 1
fi
if [ "$1" = "E" ]; then
SE_FLAG=y
elif [ "$1" = "D" ]; then
SD_FLAG=y
elif [ "$1" = "H" ]; then
SH_FLAG=y
elif [ "$1" = "O" ]; then
SO_FLAG=y
else
echo "$USAGE"
exit 1
fi
}
OPTIND=1
SUFFIX="-nd"
while getopts cdfS:t FLAG
do
case $FLAG in
c ) c_FLAG=y
;;
f ) f_FLAG=y
;;
d ) d_FLAG=y
SUFFIX=""
;;
t ) t_FLAG=y
;;
S )
set_S_flag $OPTARG
;;
\?) echo "$USAGE"
exit 1
;;
esac
done
# correct argument count after options
shift `expr $OPTIND - 1`
# test that the path to the environment-setting file was given
if [ $# -lt 1 ]
then
echo "$USAGE"
exit 1
fi
# force locale to C
LC_COLLATE=C; export LC_COLLATE
LC_CTYPE=C; export LC_CTYPE
LC_MESSAGES=C; export LC_MESSAGES
LC_MONETARY=C; export LC_MONETARY
LC_NUMERIC=C; export LC_NUMERIC
LC_TIME=C; export LC_TIME
# clear environment variables we know to be bad for the build
unset LD_OPTIONS LD_LIBRARY_PATH LD_AUDIT LD_BIND_NOW LD_BREADTH LD_CONFIG
unset LD_DEBUG LD_FLAGS LD_LIBRARY_PATH_64 LD_NOVERSION LD_ORIGIN
unset LD_LOADFLTR LD_NOAUXFLTR LD_NOCONFIG LD_NODIRCONFIG LD_NOOBJALTER
unset LD_PRELOAD LD_PROFILE
unset CONFIG
unset GROUP
unset OWNER
unset REMOTE
unset ENV
unset ARCH
unset CLASSPATH
# setup environmental variables
if [ -f $1 ]; then
if [[ $1 = */* ]]; then
. $1
else
. ./$1
fi
else
if [ -f /opt/onbld/env/$1 ]; then
. /opt/onbld/env/$1
else
echo "Cannot find env file as either $1 or /opt/onbld/env/$1"
exit 1
fi
fi
shift
# contents of stdenv.sh inserted after next line:
# STDENV_START
# STDENV_END
#MACH=`uname -p`
# must match the getopts in nightly.sh
OPTIND=1
NIGHTLY_OPTIONS=-${NIGHTLY_OPTIONS#-}
while getopts AaBCDdFfGIilMmNnOopRrS:tUuWwXxz FLAG $NIGHTLY_OPTIONS
do
case $FLAG in
O) O_FLAG=y
;;
o) o_FLAG=y
;;
t ) t_FLAG=y
;;
S )
set_S_flag $OPTARG
;;
*) ;;
esac
done
echo "Build type is \c"
if [ ${d_FLAG} = "y" ]; then
echo "DEBUG"
export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
unset RELEASE_BUILD
unset EXTRA_OPTIONS
unset EXTRA_CFLAGS
else
# default is a non-DEBUG build
echo "non-DEBUG"
export INTERNAL_RELEASE_BUILD ; INTERNAL_RELEASE_BUILD=
export RELEASE_BUILD ; RELEASE_BUILD=
unset EXTRA_OPTIONS
unset EXTRA_CFLAGS
fi
if [ $O_FLAG = "y" ]; then
export MULTI_PROTO=yes
if [ "$CLOSED_IS_PRESENT" = "yes" ]; then
echo "CLOSED_IS_PRESENT is 'no' (because of '-O')"
fi
export CLOSED_IS_PRESENT=no
export ON_CLOSED_BINS=$CODEMGR_WS/closed.skel
fi
# update build-type variables
CPIODIR=${CPIODIR}${SUFFIX}
PKGARCHIVE=${PKGARCHIVE}${SUFFIX}
# Append source version
if [ "$SE_FLAG" = "y" ]; then
VERSION="${VERSION}:EXPORT"
SRC=${EXPORT_SRC}/usr/src
fi
if [ "$SD_FLAG" = "y" ]; then
VERSION="${VERSION}:DOMESTIC"
SRC=${EXPORT_SRC}/usr/src
fi
if [ "$SH_FLAG" = "y" ]; then
VERSION="${VERSION}:HYBRID"
SRC=${EXPORT_SRC}/usr/src
fi
if [ "$SO_FLAG" = "y" ]; then
VERSION="${VERSION}:OPEN_ONLY"
SRC=${OPEN_SRCDIR}/usr/src
fi
# Set PATH for a build
PATH="/opt/onbld/bin:/opt/onbld/bin/${MACH}:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/etc:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:."
if [ "${SUNWSPRO}" != "" ]; then
PATH="${SUNWSPRO}/bin:$PATH"
export PATH
fi
if [ -z "$CLOSED_IS_PRESENT" ]; then
if [ -d $SRC/../closed ]; then
CLOSED_IS_PRESENT="yes"
else
CLOSED_IS_PRESENT="no"
fi
export CLOSED_IS_PRESENT
fi
TOOLS=${SRC}/tools
TOOLS_PROTO=${TOOLS}/proto
if [ "$t_FLAG" = "y" ]; then
export ONBLD_TOOLS=${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld}
STABS=${TOOLS_PROTO}/opt/onbld/bin/${MACH}/stabs
export STABS
CTFSTABS=${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfstabs
export CTFSTABS
GENOFFSETS=${TOOLS_PROTO}/opt/onbld/bin/genoffsets
export GENOFFSETS
CTFCONVERT=${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfconvert
export CTFCONVERT
CTFMERGE=${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfmerge
export CTFMERGE
CTFCVTPTBL=${TOOLS_PROTO}/opt/onbld/bin/ctfcvtptbl
export CTFCVTPTBL
CTFFINDMOD=${TOOLS_PROTO}/opt/onbld/bin/ctffindmod
export CTFFINDMOD
PATH="${TOOLS_PROTO}/opt/onbld/bin/${MACH}:${PATH}"
PATH="${TOOLS_PROTO}/opt/onbld/bin:${PATH}"
export PATH
fi
unset CH
if [ "$o_FLAG" = "y" ]; then
CH=
export CH
fi
POUND_SIGN="#"
DEF_STRIPFLAG="-s"
TMPDIR="/tmp"
export PATH TMPDIR o_FLAG POUND_SIGN DEF_STRIPFLAG
unset CFLAGS LD_LIBRARY_PATH
# a la ws
ENVLDLIBS1=
ENVLDLIBS2=
ENVLDLIBS3=
ENVCPPFLAGS1=
ENVCPPFLAGS2=
ENVCPPFLAGS3=
ENVCPPFLAGS4=
PARENT_ROOT=
[ "$O_FLAG" = "y" ] && export ROOT=$ROOT-open
if [ "$MULTI_PROTO" != "yes" -a "$MULTI_PROTO" != "no" ]; then
echo "WARNING: invalid value for MULTI_PROTO ($MULTI_PROTO);" \
"setting to \"no\"."
export MULTI_PROTO=no
fi
[ "$MULTI_PROTO" = "yes" ] && export ROOT=$ROOT$SUFFIX
ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib"
ENVCPPFLAGS1="-I$ROOT/usr/include"
MAKEFLAGS=e
export ENVLDLIBS1 ENVLDLIBS2 ENVLDLIBS3 \
ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 \
ENVCPPFLAGS4 MAKEFLAGS PARENT_ROOT
echo "RELEASE is $RELEASE"
echo "VERSION is $VERSION"
echo "RELEASE_DATE is $RELEASE_DATE"
echo ""
if [[ -f $SRC/Makefile ]] && egrep -s '^setup:' $SRC/Makefile; then
echo "The top-level 'setup' target is available \c"
echo "to build headers and tools."
echo ""
elif [[ "$t_FLAG" = "y" ]]; then
echo "The tools can be (re)built with the install target in ${TOOLS}."
echo ""
fi
if [[ "$c_FLAG" = "n" && -x "$SHELL" && `basename $SHELL` != "csh" ]]; then
# $SHELL is set, and it's not csh.
if [[ "$f_FLAG" != "n" ]]; then
echo "WARNING: -f is ignored when \$SHELL is not csh"
fi
echo "Using $SHELL as shell."
exec $SHELL ${@:+-c "$@"}
elif [[ "$f_FLAG" = "y" ]]; then
echo "Using csh -f as shell."
exec csh -f ${@:+-c "$@"}
else
echo "Using csh as shell."
exec csh ${@:+-c "$@"}
fi
|