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