5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
28 # Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables
29 # before spawning a shell for doing a release-style builds interactively
35 print
-u2 "${progname}: $*"
41 print
-u2 "usage: ${progname} [-cfd] env_file"
45 # boolean flags (true/false)
50 progname
="$(basename -- "${0}")"
54 while getopts cfd OPT
; do
67 # test that the path to the environment-setting file was given
83 # clear environment variables we know to be bad for the build
112 # Setup environment variables
115 if [[ -f "$1" ]]; then
116 if [[ "$1" == */* ]]; then
123 'Cannot find env file "%s"\n' "$1"
128 # Check if we have sufficient data to continue...
129 [[ -n "${SRCTOP}" ]] || fatal_error
"Error: Variable SRCTOP not set."
130 [[ -d "${SRCTOP}" ]] || fatal_error
"Error: ${SRCTOP} is not a directory."
131 [[ -f "${SRCTOP}/usr/src/Makefile" ]] || fatal_error
"Error: ${SRCTOP}/usr/src/Makefile not found."
134 # have we set RELEASE_DATE in our env file?
135 if [ -z "$RELEASE_DATE" ]; then
136 RELEASE_DATE
=$
(LC_ALL
=C
date +"%B %Y")
138 BUILD_DATE
=$
(LC_ALL
=C
date +%Y-
%b-
%d
)
139 BASEWSDIR
=$
(basename -- "${SRCTOP}")
140 export RELEASE_DATE POUND_SIGN
142 print
'Build type is \c'
149 # default is a non-DEBUG build
151 export RELEASE_BUILD
=
156 # update build-type variables
157 PKGARCHIVE
="${PKGARCHIVE}"
159 # Set PATH for a build
160 PATH
="/opt/onbld/bin:/opt/onbld/bin/${MACH}:/usr/bin:/usr/sbin:/usr/ucb:/usr/etc:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:.:/opt/SUNWspro/bin"
162 if [[ -n "${MAKE}" ]]; then
163 if [[ -x "${MAKE}" ]]; then
164 export PATH
="$(dirname -- "${MAKE}"):$PATH"
166 print
"\$MAKE (${MAKE}) is not a valid executible"
172 TOOLS_PROTO
="${TOOLS}/proto/root_${MACH}-nd" ; export TOOLS_PROTO
174 export ONBLD_TOOLS
="${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld}"
176 export STABS
="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/stabs"
177 export CTFSTABS
="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfstabs"
178 export GENOFFSETS
="${TOOLS_PROTO}/opt/onbld/bin/genoffsets"
180 PATH
="${TOOLS_PROTO}/opt/onbld/bin/${MACH}:${PATH}"
181 PATH
="${TOOLS_PROTO}/opt/onbld/bin:${PATH}"
184 export DMAKE_MODE
=${DMAKE_MODE:-parallel}
208 ENVLDLIBS1
="-L$ROOT/lib -L$ROOT/usr/lib"
209 ENVCPPFLAGS1
="-I$ROOT/usr/include"
222 printf 'RELEASE is %s\n' "$RELEASE"
223 printf 'VERSION is %s\n' "$VERSION"
224 printf 'RELEASE_DATE is %s\n\n' "$RELEASE_DATE"
226 print
"Use 'bmake gen-config' target to generate config makefiles/headers."
227 print
"Use 'dmake setup' target to build legacy headers and tools."
231 # place ourselves in a new task, respecting BUILD_PROJECT if set.
233 /usr
/bin
/newtask
-c $$
${BUILD_PROJECT:+-p$BUILD_PROJECT}
237 if [[ "${flags_c}" == "false" && -x "$SHELL" && \
238 "$(basename -- "${SHELL}")" != "csh" ]]; then
239 # $SHELL is set, and it's not csh.
241 if "${flags_f}" ; then
242 print
'WARNING: -f is ignored when $SHELL is not csh'
245 printf 'Using %s as shell.\n' "$SHELL"
246 exec "$SHELL" ${@:+-c "$@"}
248 elif "${flags_f}" ; then
249 print
'Using csh -f as shell.'
250 exec csh
-f ${@:+-c "$@"}
253 print
'Using csh as shell.'
254 exec csh
${@:+-c "$@"}