1cdf0c1d5Smjnelson#!/bin/ksh -p 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6cdf0c1d5Smjnelson# Common Development and Distribution License (the "License"). 7cdf0c1d5Smjnelson# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 23cdf0c1d5Smjnelson# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 277c478bd9Sstevel@tonic-gate# 287c478bd9Sstevel@tonic-gate# This script sets up the environment variables for a SunOS 297c478bd9Sstevel@tonic-gate# codemgr workspace and spawns a shell with the environment 307c478bd9Sstevel@tonic-gate# setup. 317c478bd9Sstevel@tonic-gate# 327c478bd9Sstevel@tonic-gate# The following Environment variables are set: 337c478bd9Sstevel@tonic-gate# CODEMGR_WS 347c478bd9Sstevel@tonic-gate# ONBLD_DIR 357c478bd9Sstevel@tonic-gate# SRC 367c478bd9Sstevel@tonic-gate# TSRC 377c478bd9Sstevel@tonic-gate# ROOT 387c478bd9Sstevel@tonic-gate# PARENT_ROOT 397c478bd9Sstevel@tonic-gate# MACH 407c478bd9Sstevel@tonic-gate# MAKEFLAGS 417c478bd9Sstevel@tonic-gate# ENVCPPFLAGS{1-4} 427c478bd9Sstevel@tonic-gate# ENVLDLIBS{1-3} 437c478bd9Sstevel@tonic-gate# 447c478bd9Sstevel@tonic-gate# The MAKEFLAGS environment variable is set to force make 457c478bd9Sstevel@tonic-gate# to read default make variables from the environment. 467c478bd9Sstevel@tonic-gate# 477c478bd9Sstevel@tonic-gate# Workspace names can be specified in two forms: pathname 487c478bd9Sstevel@tonic-gate# and hostname:pathname. If the hostname:pathname form is used 497c478bd9Sstevel@tonic-gate# the script accesses the environment through the /net automounter 507c478bd9Sstevel@tonic-gate# map. 517c478bd9Sstevel@tonic-gate# 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate# 547c478bd9Sstevel@tonic-gate# function to produce a pathname from a workspace name or subdirectory. 557c478bd9Sstevel@tonic-gate# The workspace name can have hostname:pathname format. 567c478bd9Sstevel@tonic-gate# 577c478bd9Sstevel@tonic-gate 58cdf0c1d5Smjnelsonfmtwsname() 59cdf0c1d5Smjnelson{ 607c478bd9Sstevel@tonic-gate awk -F: '$1 != $0 { print "/net/"$1$2 } \ 617c478bd9Sstevel@tonic-gate $1 == $0 { print $0 }' 627c478bd9Sstevel@tonic-gate} 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate# 65cdf0c1d5Smjnelson# Return a valid proto area, if one exists. 667c478bd9Sstevel@tonic-gate# 677c478bd9Sstevel@tonic-gatecheck_proto() 687c478bd9Sstevel@tonic-gate{ 69cdf0c1d5Smjnelson if [[ -z $1 ]]; then 70cdf0c1d5Smjnelson return 71cdf0c1d5Smjnelson fi 72cdf0c1d5Smjnelson 73cdf0c1d5Smjnelson if [ "$SCM_MODE" = "teamware" ]; then 747c478bd9Sstevel@tonic-gate # Check for problematic parent specification and adjust 757c478bd9Sstevel@tonic-gate proto=`echo $1|fmtwsname` 767c478bd9Sstevel@tonic-gate echo "${proto}/root_${MACH}" 77cdf0c1d5Smjnelson elif [ "$SCM_MODE" = "mercurial" ]; then 78cdf0c1d5Smjnelson proto=$1 79cdf0c1d5Smjnelson # 80cdf0c1d5Smjnelson # If the proto is a local repository then we can use it 81cdf0c1d5Smjnelson # to point to the parents proto area. Don't bother to 82cdf0c1d5Smjnelson # check if it exists or not, we never did for Teamware, 83cdf0c1d5Smjnelson # since it might appear later anyway. 84cdf0c1d5Smjnelson # 85cdf0c1d5Smjnelson if [ "${proto##ssh://}" == "$proto" -a \ 86cdf0c1d5Smjnelson "${proto##http://}" == "$proto" -a \ 87cdf0c1d5Smjnelson "${proto##https://}" == "$proto" ]; then 88cdf0c1d5Smjnelson echo "${proto}/root_${MACH}" 89cdf0c1d5Smjnelson fi 907c478bd9Sstevel@tonic-gate fi 917c478bd9Sstevel@tonic-gate} 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gatecleanup_env() 947c478bd9Sstevel@tonic-gate{ 957c478bd9Sstevel@tonic-gate # keep the env. clean when returning 967c478bd9Sstevel@tonic-gate unset setenv osbld_flag os_rev wsosdir protofile wsname ofs proto \ 977c478bd9Sstevel@tonic-gate pwd parent PROTO1 PROTO2 PROTO3 tmpwsname 987c478bd9Sstevel@tonic-gate return 0 997c478bd9Sstevel@tonic-gate} 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gateif [ "$1" = "-e" ]; then 1027c478bd9Sstevel@tonic-gate setenv=true 1037c478bd9Sstevel@tonic-gate shift 1047c478bd9Sstevel@tonic-gateelse 1057c478bd9Sstevel@tonic-gate setenv=false 1067c478bd9Sstevel@tonic-gatefi 1077c478bd9Sstevel@tonic-gate 108cdf0c1d5SmjnelsonWHICH_SCM=$(dirname $(whence $0))/which_scm 1097c478bd9Sstevel@tonic-gate 110cdf0c1d5Smjnelson# 111cdf0c1d5Smjnelson# No workspace/repository path was given, so try and detect one from our 112cdf0c1d5Smjnelson# current directory we're in 113cdf0c1d5Smjnelson# 1147c478bd9Sstevel@tonic-gateif [ $# -lt 1 ]; then 115*f7e41c80Smjnelson if env CODEMGR_WS="" $WHICH_SCM | read SCM_MODE tmpwsname && \ 116cdf0c1d5Smjnelson [[ $SCM_MODE != unknown ]]; then 117cdf0c1d5Smjnelson echo "Defaulting to $SCM_MODE repository $tmpwsname" 118cdf0c1d5Smjnelson else 1197c478bd9Sstevel@tonic-gate echo "usage: ws [-e] [workspace_name]" >&2 1207c478bd9Sstevel@tonic-gate if $setenv; then 1217c478bd9Sstevel@tonic-gate cleanup_env 1227c478bd9Sstevel@tonic-gate return 1 1237c478bd9Sstevel@tonic-gate else 1247c478bd9Sstevel@tonic-gate exit 1 1257c478bd9Sstevel@tonic-gate fi 1267c478bd9Sstevel@tonic-gate fi 127cdf0c1d5Smjnelsonelse 128cdf0c1d5Smjnelson # 129cdf0c1d5Smjnelson # A workspace/repository path was passed in, grab it and pop 130cdf0c1d5Smjnelson # it off the stack 131cdf0c1d5Smjnelson # 132cdf0c1d5Smjnelson tmpwsname=$1 133cdf0c1d5Smjnelson shift 134cdf0c1d5Smjnelsonfi 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate# 1377c478bd9Sstevel@tonic-gate# This variable displays the nested activations of workspaces. 1387c478bd9Sstevel@tonic-gate# This is done here to get the exact name the user entered. 1397c478bd9Sstevel@tonic-gate# 140cdf0c1d5SmjnelsonWS_STACK="$tmpwsname $WS_STACK"; export WS_STACK 1417c478bd9Sstevel@tonic-gate 142cdf0c1d5Smjnelson# 143cdf0c1d5Smjnelson# Set the workspace name and unset tmpwsname (as we reuse it later) 144cdf0c1d5Smjnelson# 145cdf0c1d5Smjnelsonwsname=`echo $tmpwsname|fmtwsname` 146cdf0c1d5Smjnelsonunset tmpwsname 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate# 1497c478bd9Sstevel@tonic-gate# Checking for CODEMGR_WSPATH 1507c478bd9Sstevel@tonic-gate# 1517c478bd9Sstevel@tonic-gateif [ "(" "${CODEMGR_WSPATH}x" != "x" ")" -a "(" ! -d $wsname ")" -a \ 1527c478bd9Sstevel@tonic-gate "(" `expr "$wsname" : "\/"` = "0" ")" ] 1537c478bd9Sstevel@tonic-gatethen 1547c478bd9Sstevel@tonic-gate ofs=$IFS 1557c478bd9Sstevel@tonic-gate IFS=": " 1567c478bd9Sstevel@tonic-gate for i in $CODEMGR_WSPATH 1577c478bd9Sstevel@tonic-gate do 1587c478bd9Sstevel@tonic-gate if [ -d ${i}/${wsname} ]; then 1597c478bd9Sstevel@tonic-gate wsname=${i}/${wsname} 1607c478bd9Sstevel@tonic-gate break 1617c478bd9Sstevel@tonic-gate fi 1627c478bd9Sstevel@tonic-gate done 1637c478bd9Sstevel@tonic-gate IFS=$ofs 1647c478bd9Sstevel@tonic-gatefi 1657c478bd9Sstevel@tonic-gate 166cdf0c1d5Smjnelson# 1677c478bd9Sstevel@tonic-gate# to translate it to an absolute pathname. We need an 1687c478bd9Sstevel@tonic-gate# absolute pathname in order to set CODEMGR_WS. 1697c478bd9Sstevel@tonic-gate# 1707c478bd9Sstevel@tonic-gateif [ `expr "$wsname" : "\/"` = "0" ] 1717c478bd9Sstevel@tonic-gatethen 1727c478bd9Sstevel@tonic-gate pwd=`pwd` 1737c478bd9Sstevel@tonic-gate wsname="$pwd/$wsname" 1747c478bd9Sstevel@tonic-gatefi 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate# 1777c478bd9Sstevel@tonic-gate# Check to see if this is a valid workspace 1787c478bd9Sstevel@tonic-gate# 1797c478bd9Sstevel@tonic-gateif [ ! -d $wsname ]; then 1807c478bd9Sstevel@tonic-gate echo "$wsname . . . no such directory" >&2 1817c478bd9Sstevel@tonic-gate if $setenv; then 1827c478bd9Sstevel@tonic-gate cleanup_env 1837c478bd9Sstevel@tonic-gate return 1 1847c478bd9Sstevel@tonic-gate else 1857c478bd9Sstevel@tonic-gate exit 1 1867c478bd9Sstevel@tonic-gate fi 1877c478bd9Sstevel@tonic-gatefi 188cdf0c1d5Smjnelson 189cdf0c1d5Smjnelson# 190cdf0c1d5Smjnelson# This catches the case of a passed in workspace path 191cdf0c1d5Smjnelson# Check which type of SCM is in use by $wsname. 192cdf0c1d5Smjnelson# 193*f7e41c80Smjnelson(cd $wsname && env CODEMGR_WS="" $WHICH_SCM) | read SCM_MODE tmpwsname 194cdf0c1d5Smjnelsonif [[ $? != 0 || "$SCM_MODE" == unknown ]]; then 195cdf0c1d5Smjnelson echo "Error: Unable to detect a supported SCM repository in $wsname" 1967c478bd9Sstevel@tonic-gate if $setenv; then 1977c478bd9Sstevel@tonic-gate cleanup_env 1987c478bd9Sstevel@tonic-gate return 1 1997c478bd9Sstevel@tonic-gate else 2007c478bd9Sstevel@tonic-gate exit 1 2017c478bd9Sstevel@tonic-gate fi 2027c478bd9Sstevel@tonic-gatefi 2037c478bd9Sstevel@tonic-gate 204cdf0c1d5Smjnelsonwsname=$tmpwsname 2057c478bd9Sstevel@tonic-gateCODEMGR_WS=$wsname ; export CODEMGR_WS 206cdf0c1d5SmjnelsonSRC=$wsname/usr/src; export SRC 207cdf0c1d5SmjnelsonTSRC=$wsname/usr/ontest; export TSRC 2087c478bd9Sstevel@tonic-gate 209cdf0c1d5Smjnelsonif [ "$SCM_MODE" = "teamware" -a -d ${wsname}/Codemgr_wsdata ]; then 210cdf0c1d5Smjnelson CM_DATA="Codemgr_wsdata" 2117c478bd9Sstevel@tonic-gate wsosdir=$CODEMGR_WS/$CM_DATA/sunos 2127c478bd9Sstevel@tonic-gate protofile=$wsosdir/protodefs 213cdf0c1d5Smjnelsonelif [ "$SCM_MODE" = "mercurial" -a -d ${wsname}/.hg ]; then 214cdf0c1d5Smjnelson CM_DATA=".hg" 215cdf0c1d5Smjnelson wsosdir=$CODEMGR_WS/$CM_DATA 216cdf0c1d5Smjnelson protofile=$wsosdir/org.opensolaris.protodefs 217cdf0c1d5Smjnelsonelse 218cdf0c1d5Smjnelson echo "$wsname is not a supported workspace; type is $SCM_MODE" >&2 219cdf0c1d5Smjnelson if $setenv; then 220cdf0c1d5Smjnelson cleanup_env 221cdf0c1d5Smjnelson return 1 222cdf0c1d5Smjnelson else 223cdf0c1d5Smjnelson exit 1 224cdf0c1d5Smjnelson fi 225cdf0c1d5Smjnelsonfi 2267c478bd9Sstevel@tonic-gate 227*f7e41c80SmjnelsonMACH=`uname -p` 228*f7e41c80Smjnelson 2297c478bd9Sstevel@tonic-gateif [ ! -f $protofile ]; then 2307c478bd9Sstevel@tonic-gate if [ ! -w $CODEMGR_WS/$CM_DATA ]; then 2317c478bd9Sstevel@tonic-gate # 2327c478bd9Sstevel@tonic-gate # The workspace doesn't have a protodefs file and I am 2337c478bd9Sstevel@tonic-gate # unable to create one. Tell user and use /tmp instead. 2347c478bd9Sstevel@tonic-gate # 2357c478bd9Sstevel@tonic-gate echo "Unable to create the proto defaults file ($protofile)." 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate # Just make one in /tmp 2387c478bd9Sstevel@tonic-gate wsosdir=/tmp 2397c478bd9Sstevel@tonic-gate protofile=$wsosdir/protodefs 2407c478bd9Sstevel@tonic-gate fi 2417c478bd9Sstevel@tonic-gate 2427c478bd9Sstevel@tonic-gate if [ ! -d $wsosdir ]; then 2437c478bd9Sstevel@tonic-gate mkdir $wsosdir 2447c478bd9Sstevel@tonic-gate fi 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate cat << PROTOFILE_EoF > $protofile 2477c478bd9Sstevel@tonic-gate#!/bin/sh 2487c478bd9Sstevel@tonic-gate# 2497c478bd9Sstevel@tonic-gate# Set default proto areas for this workspace 2507c478bd9Sstevel@tonic-gate# NOTE: This file was initially automatically generated. 2517c478bd9Sstevel@tonic-gate# 2527c478bd9Sstevel@tonic-gate# Feel free to edit this file. If this file is removed 2537c478bd9Sstevel@tonic-gate# it will be rebuilt containing default values. 2547c478bd9Sstevel@tonic-gate# 2557c478bd9Sstevel@tonic-gate# The variable CODEMGR_WS is available to this script. 2567c478bd9Sstevel@tonic-gate# 2577c478bd9Sstevel@tonic-gate# PROTO1 is the first proto area searched and is typically set 2587c478bd9Sstevel@tonic-gate# to a proto area associated with the workspace. The ROOT 2597c478bd9Sstevel@tonic-gate# environment variable is set to the same as PROTO1. If you 2607c478bd9Sstevel@tonic-gate# will be doing make installs this proto area needs to be writable. 2617c478bd9Sstevel@tonic-gate# 2627c478bd9Sstevel@tonic-gate# PROTO2 and PROTO3 are set to proto areas to search before the 2637c478bd9Sstevel@tonic-gate# search proceeds to the local machine or the proto area specified by 2647c478bd9Sstevel@tonic-gate# TERMPROTO. 2657c478bd9Sstevel@tonic-gate# 2667c478bd9Sstevel@tonic-gate# TERMPROTO (if specified) is the last place searched. If 2677c478bd9Sstevel@tonic-gate# TERMPROTO is not specified the search will end at the local 2687c478bd9Sstevel@tonic-gate# machine. 2697c478bd9Sstevel@tonic-gate# 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gatePROTO1=\$CODEMGR_WS/proto 272cdf0c1d5SmjnelsonPROTOFILE_EoF 2737c478bd9Sstevel@tonic-gate 274cdf0c1d5Smjnelson if [ "$SCM_MODE" = "teamware" ]; then 275cdf0c1d5Smjnelson cat << PROTOFILE_EoF >> $protofile 2767c478bd9Sstevel@tonic-gateif [ -f "\$CODEMGR_WS/Codemgr_wsdata/parent" ]; then 2777c478bd9Sstevel@tonic-gate # 2787c478bd9Sstevel@tonic-gate # If this workspace has an codemgr parent then set PROTO2 to 2797c478bd9Sstevel@tonic-gate # point to the parents proto space. 2807c478bd9Sstevel@tonic-gate # 2817c478bd9Sstevel@tonic-gate parent=\`workspace parent \$CODEMGR_WS\` 282cdf0c1d5Smjnelson if [[ -n \$parent ]]; then 2837c478bd9Sstevel@tonic-gate PROTO2=\$parent/proto 2847c478bd9Sstevel@tonic-gate fi 2857c478bd9Sstevel@tonic-gatefi 2867c478bd9Sstevel@tonic-gatePROTOFILE_EoF 287cdf0c1d5Smjnelson elif [ "$SCM_MODE" = "mercurial" ]; then 288cdf0c1d5Smjnelson cat << PROTOFILE_EoF >> $protofile 289cdf0c1d5Smjnelsonparent=\`(cd \$CODEMGR_WS && hg path default 2>/dev/null)\` 290cdf0c1d5Smjnelsonif [[ \$? -eq 0 && -n \$parent ]]; then 291*f7e41c80Smjnelson [[ -n \$(check_proto \$parent/proto) ]] && PROTO2=\$parent/proto 292cdf0c1d5Smjnelsonfi 293cdf0c1d5SmjnelsonPROTOFILE_EoF 294cdf0c1d5Smjnelson fi 2957c478bd9Sstevel@tonic-gatefi 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate. $protofile 2987c478bd9Sstevel@tonic-gate 2997c478bd9Sstevel@tonic-gate# This means you don't have to type make -e all of the time 3007c478bd9Sstevel@tonic-gate 3017c478bd9Sstevel@tonic-gateMAKEFLAGS=e; export MAKEFLAGS 3027c478bd9Sstevel@tonic-gate 3037c478bd9Sstevel@tonic-gate# 3047c478bd9Sstevel@tonic-gate# Set up the environment variables 3057c478bd9Sstevel@tonic-gate# 3067c478bd9Sstevel@tonic-gateROOT=/proto/root_${MACH} # default 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 3097c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 3107c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 3117c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 3127c478bd9Sstevel@tonic-gateENVLDLIBS1= 3137c478bd9Sstevel@tonic-gateENVLDLIBS2= 3147c478bd9Sstevel@tonic-gateENVLDLIBS3= 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gatePROTO1=`check_proto $PROTO1` 317cdf0c1d5Smjnelsonif [[ -n "$PROTO1" ]]; then # first proto area specifed 3187c478bd9Sstevel@tonic-gate ROOT=$PROTO1 3197c478bd9Sstevel@tonic-gate ENVCPPFLAGS1=-I$ROOT/usr/include 3207c478bd9Sstevel@tonic-gate export ENVCPPFLAGS1 3217c478bd9Sstevel@tonic-gate ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 3227c478bd9Sstevel@tonic-gate export ENVLDLIBS1 3237c478bd9Sstevel@tonic-gate 3247c478bd9Sstevel@tonic-gate PROTO2=`check_proto $PROTO2` 325cdf0c1d5Smjnelson if [[ -n "$PROTO2" ]]; then # second proto area specifed 3267c478bd9Sstevel@tonic-gate ENVCPPFLAGS2=-I$PROTO2/usr/include 3277c478bd9Sstevel@tonic-gate export ENVCPPFLAGS2 3287c478bd9Sstevel@tonic-gate ENVLDLIBS2="-L$PROTO2/lib -L$PROTO2/usr/lib" 3297c478bd9Sstevel@tonic-gate export ENVLDLIBS2 3307c478bd9Sstevel@tonic-gate 331cdf0c1d5Smjnelson PROTO3=`check_proto $PROTO3` 332cdf0c1d5Smjnelson if [[ -n "$PROTO3" ]]; then # third proto area specifed 3337c478bd9Sstevel@tonic-gate ENVCPPFLAGS3=-I$PROTO3/usr/include 3347c478bd9Sstevel@tonic-gate export ENVCPPFLAGS3 3357c478bd9Sstevel@tonic-gate ENVLDLIBS3="-L$PROTO3/lib -L$PROTO3/usr/lib" 3367c478bd9Sstevel@tonic-gate export ENVLDLIBS3 3377c478bd9Sstevel@tonic-gate fi 3387c478bd9Sstevel@tonic-gate fi 3397c478bd9Sstevel@tonic-gatefi 3407c478bd9Sstevel@tonic-gate 3417c478bd9Sstevel@tonic-gateexport ROOT 3427c478bd9Sstevel@tonic-gate 343cdf0c1d5Smjnelsonif [[ -n "$TERMPROTO" ]]; then # fallback area specifed 3447c478bd9Sstevel@tonic-gate TERMPROTO=`check_proto $TERMPROTO` 3457c478bd9Sstevel@tonic-gate ENVCPPFLAGS4="-Y I,$TERMPROTO/usr/include" 3467c478bd9Sstevel@tonic-gate export ENVCPPFLAGS4 3477c478bd9Sstevel@tonic-gate ENVLDLIBS3="$ENVLDLIBS3 -Y P,$TERMPROTO/lib:$TERMPROTO/usr/lib" 3487c478bd9Sstevel@tonic-gate export ENVLDLIBS3 3497c478bd9Sstevel@tonic-gatefi 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gateosbld_flag=0 3527c478bd9Sstevel@tonic-gate 353cdf0c1d5Smjnelsonif [[ -z "$ONBLD_DIR" ]]; then 354cdf0c1d5Smjnelson ONBLD_DIR=$(dirname $(whence $0)) 3557c478bd9Sstevel@tonic-gatefi 356cdf0c1d5Smjnelson 357cdf0c1d5Smjnelsonif ! echo ":$PATH:" | grep ":${ONBLD_DIR}:" > /dev/null; then 358cdf0c1d5Smjnelson PATH="${ONBLD_DIR}:${ONBLD_DIR}/${MACH}:${PATH}" 3597c478bd9Sstevel@tonic-gate osbld_flag=1 3607c478bd9Sstevel@tonic-gatefi 361cdf0c1d5Smjnelson 362cdf0c1d5Smjnelsonexport PATH 363cdf0c1d5Smjnelson 364cdf0c1d5Smjnelsonif [[ -n "$PROTO2" ]]; then 3657c478bd9Sstevel@tonic-gate # This should point to the parent's proto 3667c478bd9Sstevel@tonic-gate PARENT_ROOT=$PROTO2 3677c478bd9Sstevel@tonic-gate export PARENT_ROOT 3687c478bd9Sstevel@tonic-gateelse 3697c478bd9Sstevel@tonic-gate # Clear it in case it's already in the env. 3707c478bd9Sstevel@tonic-gate PARENT_ROOT= 3717c478bd9Sstevel@tonic-gatefi 3727c478bd9Sstevel@tonic-gateexport ONBLD_DIR 3737c478bd9Sstevel@tonic-gateexport MACH 374cdf0c1d5Smjnelson 375cdf0c1d5Smjnelsonos_rev=`uname -r` 376cdf0c1d5Smjnelsonos_name=`uname -s` 377cdf0c1d5Smjnelson 378cdf0c1d5Smjnelsonif [[ $os_name != "SunOS" || `expr $os_rev : "5\."` != "2" ]]; then 3797c478bd9Sstevel@tonic-gate # 380cdf0c1d5Smjnelson # This is not a SunOS 5.x machine - something is wrong 3817c478bd9Sstevel@tonic-gate # 382cdf0c1d5Smjnelson echo "***WARNING: this script is meant to be run on SunOS 5.x." 383cdf0c1d5Smjnelson echo " This machine appears to be running: $os_name $os_rev" 3847c478bd9Sstevel@tonic-gatefi 3857c478bd9Sstevel@tonic-gate 3867c478bd9Sstevel@tonic-gateecho "" 387cdf0c1d5Smjnelsonecho "Workspace : $wsname" 3887c478bd9Sstevel@tonic-gateif [ -n "$parent" ]; then 3897c478bd9Sstevel@tonic-gate echo "Workspace Parent : $parent" 3907c478bd9Sstevel@tonic-gatefi 3917c478bd9Sstevel@tonic-gateecho "Proto area (\$ROOT) : $ROOT" 3927c478bd9Sstevel@tonic-gateif [ -n "$PARENT_ROOT" ]; then 3937c478bd9Sstevel@tonic-gate echo "Parent proto area (\$PARENT_ROOT) : $PARENT_ROOT" 3947c478bd9Sstevel@tonic-gatefi 3957c478bd9Sstevel@tonic-gateecho "Root of source (\$SRC) : $SRC" 3967c478bd9Sstevel@tonic-gateecho "Root of test source (\$TSRC) : $TSRC" 3977c478bd9Sstevel@tonic-gateif [ $osbld_flag = "1" ]; then 3987c478bd9Sstevel@tonic-gate echo "Prepended to PATH : $ONBLD_DIR" 3997c478bd9Sstevel@tonic-gatefi 400cdf0c1d5Smjnelsonecho "Current directory (\$PWD) : $wsname" 4017c478bd9Sstevel@tonic-gateecho "" 4027c478bd9Sstevel@tonic-gate 403cdf0c1d5Smjnelsoncd $wsname 4047c478bd9Sstevel@tonic-gate 4057c478bd9Sstevel@tonic-gateif $setenv; then 4067c478bd9Sstevel@tonic-gate cleanup_env 4077c478bd9Sstevel@tonic-gateelse 4087c478bd9Sstevel@tonic-gate exec ${SHELL:-sh} "$@" 4097c478bd9Sstevel@tonic-gatefi 410