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