Print this page
1575 untangle libmlrpc from SMB server (fix bldenv)
NEX-9559 remove nza-closed cruft
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
5773 Extra pointless steps in kernel module builds
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Josef Sipek <jeffpc@josefsipek.net>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Rich Lowe <richlowe@richlowe.net>
re #8813 rb3805 Failed to set DHCP on bnx0 network interface
8226 nza-kernel needs to be buildable by itself
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/tools/scripts/bldenv.sh
+++ new/usr/src/tools/scripts/bldenv.sh
1 1 #!/usr/bin/ksh93
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 26 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
27 27 #
28 28 # Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables
29 29 # before spawning a shell for doing a release-style builds interactively
30 30 # and incrementally.
31 31 #
32 32
33 33 function fatal_error
34 34 {
35 35 print -u2 "${progname}: $*"
36 36 exit 1
37 37 }
38 38
39 39 function usage
40 40 {
41 41 OPTIND=0
42 42 getopts -a "${progname}" "${USAGE}" OPT '-?'
43 43 exit 2
44 44 }
45 45
46 46 typeset -r USAGE=$'+
47 47 [-?\n@(#)\$Id: bldenv (OS/Net) 2008-04-06 \$\n]
48 48 [-author?OS/Net community <tools-discuss@opensolaris.org>]
49 49 [+NAME?bldenv - spawn shell for interactive incremental OS-Net
50 50 consolidation builds]
51 51 [+DESCRIPTION?bldenv is a useful companion to the nightly(1) script for
52 52 doing interactive and incremental builds in a workspace
53 53 already built with nightly(1). bldenv spawns a shell set up
54 54 with the same environment variables taken from an env_file,
55 55 as prepared for use with nightly(1).]
56 56 [+?In addition to running a shell for interactive use, bldenv
57 57 can optionally run a single command in the given environment,
58 58 in the vein of sh -c or su -c. This is useful for
59 59 scripting, when an interactive shell would not be. If the
60 60 command is composed of multiple shell words or contains
61 61 other shell metacharacters, it must be quoted appropriately.]
62 62 [+?bldenv is particularly useful for testing Makefile targets
63 63 like clobber, install and _msg, which otherwise require digging
64 64 through large build logs to figure out what is being
65 65 done.]
66 66 [+?By default, bldenv will invoke the shell specified in
67 67 $SHELL. If $SHELL is not set or is invalid, csh will be
68 68 used.]
69 69 [c?force the use of csh, regardless of the value of $SHELL.]
70 70 [f?invoke csh with the -f (fast-start) option. This option is valid
71 71 only if $SHELL is unset or if it points to csh.]
72 72 [d?set up environment for doing DEBUG builds (default is non-DEBUG)]
73 73 [t?set up environment to use the tools in usr/src/tools (this is the
74 74 default, use +t to use the tools from /opt/onbld)]
75 75
76 76 <env_file> [command]
77 77
78 78 [+EXAMPLES]{
79 79 [+?Example 1: Interactive use]{
80 80 [+?Use bldenv to spawn a shell to perform a DEBUG build and
81 81 testing of the Makefile targets clobber and install for
82 82 usr/src/cmd/true.]
83 83 [+\n% rlogin wopr-2 -l gk
84 84 {root::wopr-2::49} bldenv -d /export0/jg/on10-se.env
85 85 Build type is DEBUG
86 86 RELEASE is 5.10
87 87 VERSION is wopr-2::on10-se::11/01/2001
88 88 RELEASE_DATE is May 2004
89 89 The top-level `setup\' target is available to build headers
90 90 and tools.
91 91 Using /usr/bin/tcsh as shell.
92 92 {root::wopr-2::49}
93 93 {root::wopr-2::49} cd $SRC/cmd/true
94 94 {root::wopr-2::50} make
95 95 {root::wopr-2::51} make clobber
96 96 /usr/bin/rm -f true true.po
97 97 {root::wopr-2::52} make
98 98 /usr/bin/rm -f true
99 99 cat true.sh > true
100 100 chmod +x true
101 101 {root::wopr-2::53} make install
102 102 install -s -m 0555 -u root -g bin -f /export0/jg/on10-se/proto/root_sparc/usr/bin true
103 103 `install\' is up to date.]
104 104 }
105 105 [+?Example 2: Non-interactive use]{
106 106 [+?Invoke bldenv to create SUNWonbld with a single command:]
107 107 [+\nexample% bldenv onnv_06 \'cd $SRC/tools && make pkg\']
108 108 }
109 109 }
110 110 [+SEE ALSO?\bnightly\b(1)]
111 111 '
112 112
113 113 # main
114 114 builtin basename
115 115
116 116 # boolean flags (true/false)
117 117 typeset flags=(
118 118 typeset c=false
119 119 typeset f=false
120 120 typeset d=false
121 121 typeset O=false
122 122 typeset o=false
123 123 typeset t=true
124 124 typeset s=(
125 125 typeset e=false
126 126 typeset h=false
127 127 typeset d=false
128 128 typeset o=false
129 129 )
130 130 )
131 131
132 132 typeset progname="$(basename -- "${0}")"
133 133
134 134 OPTIND=1
135 135 SUFFIX="-nd"
136 136
137 137 while getopts -a "${progname}" "${USAGE}" OPT ; do
138 138 case ${OPT} in
139 139 c) flags.c=true ;;
140 140 +c) flags.c=false ;;
141 141 f) flags.f=true ;;
142 142 +f) flags.f=false ;;
143 143 d) flags.d=true SUFFIX="" ;;
144 144 +d) flags.d=false SUFFIX="-nd" ;;
145 145 t) flags.t=true ;;
146 146 +t) flags.t=false ;;
147 147 \?) usage ;;
148 148 esac
149 149 done
150 150 shift $((OPTIND-1))
151 151
152 152 # test that the path to the environment-setting file was given
153 153 if (( $# < 1 )) ; then
154 154 usage
155 155 fi
156 156
157 157 # force locale to C
158 158 export \
159 159 LANG=C \
160 160 LC_ALL=C \
161 161 LC_COLLATE=C \
162 162 LC_CTYPE=C \
163 163 LC_MESSAGES=C \
164 164 LC_MONETARY=C \
165 165 LC_NUMERIC=C \
166 166 LC_TIME=C
167 167
168 168 # clear environment variables we know to be bad for the build
169 169 unset \
170 170 LD_OPTIONS \
171 171 LD_LIBRARY_PATH \
172 172 LD_AUDIT \
173 173 LD_BIND_NOW \
174 174 LD_BREADTH \
175 175 LD_CONFIG \
176 176 LD_DEBUG \
177 177 LD_FLAGS \
178 178 LD_LIBRARY_PATH_64 \
179 179 LD_NOVERSION \
180 180 LD_ORIGIN \
181 181 LD_LOADFLTR \
182 182 LD_NOAUXFLTR \
183 183 LD_NOCONFIG \
184 184 LD_NODIRCONFIG \
185 185 LD_NOOBJALTER \
186 186 LD_PRELOAD \
187 187 LD_PROFILE \
188 188 CONFIG \
189 189 GROUP \
190 190 OWNER \
191 191 REMOTE \
192 192 ENV \
193 193 ARCH \
194 194 CLASSPATH
195 195
196 196 #
197 197 # Setup environment variables
198 198 #
199 199 if [[ -f /etc/nightly.conf ]]; then
200 200 source /etc/nightly.conf
201 201 fi
202 202
203 203 if [[ -f "$1" ]]; then
204 204 if [[ "$1" == */* ]]; then
205 205 source "$1"
206 206 else
207 207 source "./$1"
208 208 fi
209 209 else
210 210 if [[ -f "/opt/onbld/env/$1" ]]; then
211 211 source "/opt/onbld/env/$1"
212 212 else
213 213 printf \
214 214 'Cannot find env file as either %s or /opt/onbld/env/%s\n' \
215 215 "$1" "$1"
216 216 exit 1
217 217 fi
218 218 fi
219 219 shift
220 220
221 221 # contents of stdenv.sh inserted after next line:
222 222 # STDENV_START
223 223 # STDENV_END
224 224
225 225 # Check if we have sufficient data to continue...
226 226 [[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set."
227 227 [[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory."
228 228 [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
229 229
230 230 # must match the getopts in nightly.sh
231 231 OPTIND=1
232 232 NIGHTLY_OPTIONS="-${NIGHTLY_OPTIONS#-}"
233 233 while getopts '+0ABCDdFfGIilMmNnpRrtUuwW' FLAG $NIGHTLY_OPTIONS
234 234 do
235 235 case "$FLAG" in
236 236 t) flags.t=true ;;
237 237 +t) flags.t=false ;;
238 238 *) ;;
239 239 esac
240 240 done
241 241
242 242 POUND_SIGN="#"
243 243 # have we set RELEASE_DATE in our env file?
244 244 if [ -z "$RELEASE_DATE" ]; then
245 245 RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
246 246 fi
247 247 BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
248 248 BASEWSDIR=$(basename -- "${CODEMGR_WS}")
249 249 DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
250 250 export DEV_CM RELEASE_DATE POUND_SIGN
251 251
252 252 print 'Build type is \c'
253 253 if ${flags.d} ; then
254 254 print 'DEBUG'
255 255 unset RELEASE_BUILD
256 256 unset EXTRA_OPTIONS
257 257 unset EXTRA_CFLAGS
258 258 else
259 259 # default is a non-DEBUG build
260 260 print 'non-DEBUG'
261 261 export RELEASE_BUILD=
262 262 unset EXTRA_OPTIONS
263 263 unset EXTRA_CFLAGS
264 264 fi
265 265
266 266 # update build-type variables
267 267 PKGARCHIVE="${PKGARCHIVE}${SUFFIX}"
268 268
269 269 # Set PATH for a build
270 270 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:."
271 271 if [[ "${SUNWSPRO}" != "" ]]; then
272 272 export PATH="${SUNWSPRO}/bin:$PATH"
273 273 fi
274 274
275 275 if [[ -n "${MAKE}" ]]; then
276 276 if [[ -x "${MAKE}" ]]; then
277 277 export PATH="$(dirname -- "${MAKE}"):$PATH"
278 278 else
279 279 print "\$MAKE (${MAKE}) is not a valid executible"
280 280 exit 1
281 281 fi
282 282 fi
283 283
284 284 TOOLS="${SRC}/tools"
285 285 TOOLS_PROTO="${TOOLS}/proto/root_${MACH}-nd" ; export TOOLS_PROTO
|
↓ open down ↓ |
285 lines elided |
↑ open up ↑ |
286 286
287 287 if "${flags.t}" ; then
288 288 export ONBLD_TOOLS="${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld}"
289 289
290 290 export STABS="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/stabs"
291 291 export CTFSTABS="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfstabs"
292 292 export GENOFFSETS="${TOOLS_PROTO}/opt/onbld/bin/genoffsets"
293 293
294 294 export CTFCONVERT="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfconvert"
295 295 export CTFMERGE="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfmerge"
296 + export NDRGEN="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ndrgen"
296 297
297 298 PATH="${TOOLS_PROTO}/opt/onbld/bin/${MACH}:${PATH}"
298 299 PATH="${TOOLS_PROTO}/opt/onbld/bin:${PATH}"
299 300 export PATH
300 301 fi
301 302
302 303 export DMAKE_MODE=${DMAKE_MODE:-parallel}
303 304
304 305 DEF_STRIPFLAG="-s"
305 306
306 307 TMPDIR="/tmp"
307 308
308 309 export \
309 310 PATH TMPDIR \
310 311 POUND_SIGN \
311 312 DEF_STRIPFLAG \
312 313 RELEASE_DATE
313 314 unset \
314 315 CFLAGS \
315 316 LD_LIBRARY_PATH
316 317
317 318 # a la ws
318 319 ENVLDLIBS1=
319 320 ENVLDLIBS2=
320 321 ENVLDLIBS3=
321 322 ENVCPPFLAGS1=
322 323 ENVCPPFLAGS2=
323 324 ENVCPPFLAGS3=
324 325 ENVCPPFLAGS4=
325 326 PARENT_ROOT=
326 327 PARENT_TOOLS_ROOT=
327 328
328 329 if [[ "$MULTI_PROTO" != "yes" && "$MULTI_PROTO" != "no" ]]; then
329 330 printf \
330 331 'WARNING: invalid value for MULTI_PROTO (%s); setting to "no".\n' \
331 332 "$MULTI_PROTO"
332 333 export MULTI_PROTO="no"
333 334 fi
334 335
335 336 [[ "$MULTI_PROTO" == "yes" ]] && export ROOT="${ROOT}${SUFFIX}"
336 337
337 338 ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib"
338 339 ENVCPPFLAGS1="-I$ROOT/usr/include"
339 340 MAKEFLAGS=e
340 341
341 342 export \
342 343 ENVLDLIBS1 \
343 344 ENVLDLIBS2 \
344 345 ENVLDLIBS3 \
345 346 ENVCPPFLAGS1 \
346 347 ENVCPPFLAGS2 \
347 348 ENVCPPFLAGS3 \
348 349 ENVCPPFLAGS4 \
349 350 MAKEFLAGS \
350 351 PARENT_ROOT \
351 352 PARENT_TOOLS_ROOT
352 353
353 354 printf 'RELEASE is %s\n' "$RELEASE"
354 355 printf 'VERSION is %s\n' "$VERSION"
355 356 printf 'RELEASE_DATE is %s\n\n' "$RELEASE_DATE"
356 357
357 358 if [[ -f "$SRC/Makefile" ]] && egrep -s '^setup:' "$SRC/Makefile" ; then
358 359 print "The top-level 'setup' target is available \c"
359 360 print "to build headers and tools."
360 361 print ""
361 362
362 363 elif "${flags.t}" ; then
363 364 printf \
364 365 'The tools can be (re)built with the install target in %s.\n\n' \
365 366 "${TOOLS}"
366 367 fi
367 368
368 369 #
369 370 # place ourselves in a new task, respecting BUILD_PROJECT if set.
370 371 #
371 372 /usr/bin/newtask -c $$ ${BUILD_PROJECT:+-p$BUILD_PROJECT}
372 373
373 374 if [[ "${flags.c}" == "false" && -x "$SHELL" && \
374 375 "$(basename -- "${SHELL}")" != "csh" ]]; then
375 376 # $SHELL is set, and it's not csh.
376 377
377 378 if "${flags.f}" ; then
378 379 print 'WARNING: -f is ignored when $SHELL is not csh'
379 380 fi
380 381
381 382 printf 'Using %s as shell.\n' "$SHELL"
382 383 exec "$SHELL" ${@:+-c "$@"}
383 384
384 385 elif "${flags.f}" ; then
385 386 print 'Using csh -f as shell.'
386 387 exec csh -f ${@:+-c "$@"}
387 388
388 389 else
389 390 print 'Using csh as shell.'
390 391 exec csh ${@:+-c "$@"}
391 392 fi
392 393
393 394 # not reached
|
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX