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# 261fb95e48SDan McDonald# Copyright 2011 Nexenta Systems, Inc. All rights reserved. 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 738bcea973SRichard Lowe 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}" 778bcea973SRichard Lowe 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 # 85*0d121444SRichard Lowe if [[ "${proto##ssh://}" == "$proto" && \ 86*0d121444SRichard Lowe "${proto##http://}" == "$proto" && \ 878bcea973SRichard Lowe "${proto##https://}" == "$proto" ]]; then 88cdf0c1d5Smjnelson echo "${proto}/root_${MACH}" 89cdf0c1d5Smjnelson fi 908bcea973SRichard Lowe elif [[ "$SCM_MODE" = "git" ]]; then 918bcea973SRichard Lowe # 928bcea973SRichard Lowe # For git, we make no attempt to deal with the possibility of 938bcea973SRichard Lowe # remote parent workspaces because, in the protodefs file, we 948bcea973SRichard Lowe # don't actually acknowledge the concept of a parent workspace 958bcea973SRichard Lowe # at all, in keeping with the rest of our git support. 968bcea973SRichard Lowe # 978bcea973SRichard Lowe echo "${1}/root_${MACH}" 987c478bd9Sstevel@tonic-gate fi 997c478bd9Sstevel@tonic-gate} 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gatecleanup_env() 1027c478bd9Sstevel@tonic-gate{ 1037c478bd9Sstevel@tonic-gate # keep the env. clean when returning 1047c478bd9Sstevel@tonic-gate unset setenv osbld_flag os_rev wsosdir protofile wsname ofs proto \ 1057c478bd9Sstevel@tonic-gate pwd parent PROTO1 PROTO2 PROTO3 tmpwsname 1067c478bd9Sstevel@tonic-gate return 0 1077c478bd9Sstevel@tonic-gate} 1087c478bd9Sstevel@tonic-gate 1098bcea973SRichard Loweif [[ "$1" = "-e" ]]; then 1107c478bd9Sstevel@tonic-gate setenv=true 1117c478bd9Sstevel@tonic-gate shift 1127c478bd9Sstevel@tonic-gateelse 1137c478bd9Sstevel@tonic-gate setenv=false 1147c478bd9Sstevel@tonic-gatefi 1157c478bd9Sstevel@tonic-gate 1168bcea973SRichard LoweWHICH_SCM=$(/bin/dirname $(whence $0))/which_scm 117916d673dSmjnelsonif [[ ! -x $WHICH_SCM ]]; then 118916d673dSmjnelson WHICH_SCM=which_scm 119916d673dSmjnelsonfi 1207c478bd9Sstevel@tonic-gate 121cdf0c1d5Smjnelson# 122cdf0c1d5Smjnelson# No workspace/repository path was given, so try and detect one from our 123cdf0c1d5Smjnelson# current directory we're in 124cdf0c1d5Smjnelson# 1258bcea973SRichard Loweif [[ $# -lt 1 ]]; then 126f7e41c80Smjnelson if env CODEMGR_WS="" $WHICH_SCM | read SCM_MODE tmpwsname && \ 127cdf0c1d5Smjnelson [[ $SCM_MODE != unknown ]]; then 128cdf0c1d5Smjnelson echo "Defaulting to $SCM_MODE repository $tmpwsname" 129cdf0c1d5Smjnelson else 1307c478bd9Sstevel@tonic-gate echo "usage: ws [-e] [workspace_name]" >&2 1317c478bd9Sstevel@tonic-gate if $setenv; then 1327c478bd9Sstevel@tonic-gate cleanup_env 1337c478bd9Sstevel@tonic-gate return 1 1347c478bd9Sstevel@tonic-gate else 1357c478bd9Sstevel@tonic-gate exit 1 1367c478bd9Sstevel@tonic-gate fi 1377c478bd9Sstevel@tonic-gate fi 138cdf0c1d5Smjnelsonelse 139cdf0c1d5Smjnelson # 140cdf0c1d5Smjnelson # A workspace/repository path was passed in, grab it and pop 141cdf0c1d5Smjnelson # it off the stack 142cdf0c1d5Smjnelson # 143cdf0c1d5Smjnelson tmpwsname=$1 144cdf0c1d5Smjnelson shift 145cdf0c1d5Smjnelsonfi 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate# 1487c478bd9Sstevel@tonic-gate# This variable displays the nested activations of workspaces. 1497c478bd9Sstevel@tonic-gate# This is done here to get the exact name the user entered. 1507c478bd9Sstevel@tonic-gate# 151cdf0c1d5SmjnelsonWS_STACK="$tmpwsname $WS_STACK"; export WS_STACK 1527c478bd9Sstevel@tonic-gate 153cdf0c1d5Smjnelson# 154cdf0c1d5Smjnelson# Set the workspace name and unset tmpwsname (as we reuse it later) 155cdf0c1d5Smjnelson# 156cdf0c1d5Smjnelsonwsname=`echo $tmpwsname|fmtwsname` 157cdf0c1d5Smjnelsonunset tmpwsname 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate# 1607c478bd9Sstevel@tonic-gate# Checking for CODEMGR_WSPATH 1617c478bd9Sstevel@tonic-gate# 162*0d121444SRichard Loweif [[ -n ${CODEMGR_WSPATH} && ( ! -d $wsname ) && \ 163*0d121444SRichard Lowe ( `expr "$wsname" : "\/"` = "0" ) ]] 1647c478bd9Sstevel@tonic-gatethen 1657c478bd9Sstevel@tonic-gate ofs=$IFS 1667c478bd9Sstevel@tonic-gate IFS=": " 1677c478bd9Sstevel@tonic-gate for i in $CODEMGR_WSPATH 1687c478bd9Sstevel@tonic-gate do 1698bcea973SRichard Lowe if [[ -d ${i}/${wsname} ]]; then 1707c478bd9Sstevel@tonic-gate wsname=${i}/${wsname} 1717c478bd9Sstevel@tonic-gate break 1727c478bd9Sstevel@tonic-gate fi 1737c478bd9Sstevel@tonic-gate done 1747c478bd9Sstevel@tonic-gate IFS=$ofs 1757c478bd9Sstevel@tonic-gatefi 1767c478bd9Sstevel@tonic-gate 177cdf0c1d5Smjnelson# 1787c478bd9Sstevel@tonic-gate# to translate it to an absolute pathname. We need an 1797c478bd9Sstevel@tonic-gate# absolute pathname in order to set CODEMGR_WS. 1807c478bd9Sstevel@tonic-gate# 1818bcea973SRichard Loweif [[ `expr "$wsname" : "\/"` = "0" ]] 1827c478bd9Sstevel@tonic-gatethen 1837c478bd9Sstevel@tonic-gate pwd=`pwd` 1847c478bd9Sstevel@tonic-gate wsname="$pwd/$wsname" 1857c478bd9Sstevel@tonic-gatefi 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate# 1887c478bd9Sstevel@tonic-gate# Check to see if this is a valid workspace 1897c478bd9Sstevel@tonic-gate# 1908bcea973SRichard Loweif [[ ! -d $wsname ]]; then 1917c478bd9Sstevel@tonic-gate echo "$wsname . . . no such directory" >&2 1927c478bd9Sstevel@tonic-gate if $setenv; then 1937c478bd9Sstevel@tonic-gate cleanup_env 1947c478bd9Sstevel@tonic-gate return 1 1957c478bd9Sstevel@tonic-gate else 1967c478bd9Sstevel@tonic-gate exit 1 1977c478bd9Sstevel@tonic-gate fi 1987c478bd9Sstevel@tonic-gatefi 199cdf0c1d5Smjnelson 200cdf0c1d5Smjnelson# 201cdf0c1d5Smjnelson# This catches the case of a passed in workspace path 202cdf0c1d5Smjnelson# Check which type of SCM is in use by $wsname. 203cdf0c1d5Smjnelson# 204f7e41c80Smjnelson(cd $wsname && env CODEMGR_WS="" $WHICH_SCM) | read SCM_MODE tmpwsname 205cdf0c1d5Smjnelsonif [[ $? != 0 || "$SCM_MODE" == unknown ]]; then 206cdf0c1d5Smjnelson echo "Error: Unable to detect a supported SCM repository in $wsname" 2077c478bd9Sstevel@tonic-gate if $setenv; then 2087c478bd9Sstevel@tonic-gate cleanup_env 2097c478bd9Sstevel@tonic-gate return 1 2107c478bd9Sstevel@tonic-gate else 2117c478bd9Sstevel@tonic-gate exit 1 2127c478bd9Sstevel@tonic-gate fi 2137c478bd9Sstevel@tonic-gatefi 2147c478bd9Sstevel@tonic-gate 215cdf0c1d5Smjnelsonwsname=$tmpwsname 2167c478bd9Sstevel@tonic-gateCODEMGR_WS=$wsname ; export CODEMGR_WS 217cdf0c1d5SmjnelsonSRC=$wsname/usr/src; export SRC 218cdf0c1d5SmjnelsonTSRC=$wsname/usr/ontest; export TSRC 2197c478bd9Sstevel@tonic-gate 220*0d121444SRichard Loweif [[ "$SCM_MODE" = "teamware" && -d ${wsname}/Codemgr_wsdata ]]; then 221cdf0c1d5Smjnelson CM_DATA="Codemgr_wsdata" 2227c478bd9Sstevel@tonic-gate wsosdir=$CODEMGR_WS/$CM_DATA/sunos 2237c478bd9Sstevel@tonic-gate protofile=$wsosdir/protodefs 224*0d121444SRichard Loweelif [[ "$SCM_MODE" = "mercurial" && -d ${wsname}/.hg ]]; then 225cdf0c1d5Smjnelson CM_DATA=".hg" 226cdf0c1d5Smjnelson wsosdir=$CODEMGR_WS/$CM_DATA 227cdf0c1d5Smjnelson protofile=$wsosdir/org.opensolaris.protodefs 228*0d121444SRichard Loweelif [[ "$SCM_MODE" = "git" && -d ${wsname}/.git ]]; then 2298bcea973SRichard Lowe CM_DATA=".git" 2308bcea973SRichard Lowe wsosdir=$CODEMGR_WS/$CM_DATA 2318bcea973SRichard Lowe protofile=$wsosdir/org.opensolaris.protodefs 232cdf0c1d5Smjnelsonelse 233cdf0c1d5Smjnelson echo "$wsname is not a supported workspace; type is $SCM_MODE" >&2 234cdf0c1d5Smjnelson if $setenv; then 235cdf0c1d5Smjnelson cleanup_env 236cdf0c1d5Smjnelson return 1 237cdf0c1d5Smjnelson else 238cdf0c1d5Smjnelson exit 1 239cdf0c1d5Smjnelson fi 240cdf0c1d5Smjnelsonfi 2417c478bd9Sstevel@tonic-gate 242f7e41c80SmjnelsonMACH=`uname -p` 243f7e41c80Smjnelson 2448bcea973SRichard Loweif [[ ! -f $protofile ]]; then 2458bcea973SRichard Lowe if [[ ! -w $CODEMGR_WS/$CM_DATA ]]; then 2467c478bd9Sstevel@tonic-gate # 2477c478bd9Sstevel@tonic-gate # The workspace doesn't have a protodefs file and I am 2487c478bd9Sstevel@tonic-gate # unable to create one. Tell user and use /tmp instead. 2497c478bd9Sstevel@tonic-gate # 2507c478bd9Sstevel@tonic-gate echo "Unable to create the proto defaults file ($protofile)." 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate # Just make one in /tmp 2537c478bd9Sstevel@tonic-gate wsosdir=/tmp 2547c478bd9Sstevel@tonic-gate protofile=$wsosdir/protodefs 2557c478bd9Sstevel@tonic-gate fi 2567c478bd9Sstevel@tonic-gate 2578bcea973SRichard Lowe if [[ ! -d $wsosdir ]]; then 2587c478bd9Sstevel@tonic-gate mkdir $wsosdir 2597c478bd9Sstevel@tonic-gate fi 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate cat << PROTOFILE_EoF > $protofile 2627c478bd9Sstevel@tonic-gate#!/bin/sh 2637c478bd9Sstevel@tonic-gate# 2647c478bd9Sstevel@tonic-gate# Set default proto areas for this workspace 2657c478bd9Sstevel@tonic-gate# NOTE: This file was initially automatically generated. 2667c478bd9Sstevel@tonic-gate# 2677c478bd9Sstevel@tonic-gate# Feel free to edit this file. If this file is removed 2687c478bd9Sstevel@tonic-gate# it will be rebuilt containing default values. 2697c478bd9Sstevel@tonic-gate# 2707c478bd9Sstevel@tonic-gate# The variable CODEMGR_WS is available to this script. 2717c478bd9Sstevel@tonic-gate# 2727c478bd9Sstevel@tonic-gate# PROTO1 is the first proto area searched and is typically set 2737c478bd9Sstevel@tonic-gate# to a proto area associated with the workspace. The ROOT 2747c478bd9Sstevel@tonic-gate# environment variable is set to the same as PROTO1. If you 2757c478bd9Sstevel@tonic-gate# will be doing make installs this proto area needs to be writable. 2767c478bd9Sstevel@tonic-gate# 2777c478bd9Sstevel@tonic-gate# PROTO2 and PROTO3 are set to proto areas to search before the 2787c478bd9Sstevel@tonic-gate# search proceeds to the local machine or the proto area specified by 2797c478bd9Sstevel@tonic-gate# TERMPROTO. 2807c478bd9Sstevel@tonic-gate# 2817c478bd9Sstevel@tonic-gate# TERMPROTO (if specified) is the last place searched. If 2827c478bd9Sstevel@tonic-gate# TERMPROTO is not specified the search will end at the local 2837c478bd9Sstevel@tonic-gate# machine. 2847c478bd9Sstevel@tonic-gate# 2857c478bd9Sstevel@tonic-gate 2867c478bd9Sstevel@tonic-gatePROTO1=\$CODEMGR_WS/proto 287cdf0c1d5SmjnelsonPROTOFILE_EoF 2887c478bd9Sstevel@tonic-gate 2898bcea973SRichard Lowe if [[ "$SCM_MODE" = "teamware" ]]; then 290cdf0c1d5Smjnelson cat << PROTOFILE_EoF >> $protofile 2918bcea973SRichard Loweif [[ -f "\$CODEMGR_WS/Codemgr_wsdata/parent" ]]; then 2927c478bd9Sstevel@tonic-gate # 2937c478bd9Sstevel@tonic-gate # If this workspace has an codemgr parent then set PROTO2 to 2947c478bd9Sstevel@tonic-gate # point to the parents proto space. 2957c478bd9Sstevel@tonic-gate # 2967c478bd9Sstevel@tonic-gate parent=\`workspace parent \$CODEMGR_WS\` 297cdf0c1d5Smjnelson if [[ -n \$parent ]]; then 2987c478bd9Sstevel@tonic-gate PROTO2=\$parent/proto 2997c478bd9Sstevel@tonic-gate fi 3007c478bd9Sstevel@tonic-gatefi 3017c478bd9Sstevel@tonic-gatePROTOFILE_EoF 3028bcea973SRichard Lowe elif [[ "$SCM_MODE" = "mercurial" ]]; then 303cdf0c1d5Smjnelson cat << PROTOFILE_EoF >> $protofile 304cdf0c1d5Smjnelsonparent=\`(cd \$CODEMGR_WS && hg path default 2>/dev/null)\` 305cdf0c1d5Smjnelsonif [[ \$? -eq 0 && -n \$parent ]]; then 306f7e41c80Smjnelson [[ -n \$(check_proto \$parent/proto) ]] && PROTO2=\$parent/proto 307cdf0c1d5Smjnelsonfi 308cdf0c1d5SmjnelsonPROTOFILE_EoF 309cdf0c1d5Smjnelson fi 3107c478bd9Sstevel@tonic-gatefi 3117c478bd9Sstevel@tonic-gate 3127c478bd9Sstevel@tonic-gate. $protofile 3137c478bd9Sstevel@tonic-gate 3147c478bd9Sstevel@tonic-gate# This means you don't have to type make -e all of the time 3157c478bd9Sstevel@tonic-gate 3167c478bd9Sstevel@tonic-gateMAKEFLAGS=e; export MAKEFLAGS 3177c478bd9Sstevel@tonic-gate 3187c478bd9Sstevel@tonic-gate# 3197c478bd9Sstevel@tonic-gate# Set up the environment variables 3207c478bd9Sstevel@tonic-gate# 3217c478bd9Sstevel@tonic-gateROOT=/proto/root_${MACH} # default 3227c478bd9Sstevel@tonic-gate 3237c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 3247c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 3257c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 3267c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 3277c478bd9Sstevel@tonic-gateENVLDLIBS1= 3287c478bd9Sstevel@tonic-gateENVLDLIBS2= 3297c478bd9Sstevel@tonic-gateENVLDLIBS3= 3307c478bd9Sstevel@tonic-gate 3317c478bd9Sstevel@tonic-gatePROTO1=`check_proto $PROTO1` 332cdf0c1d5Smjnelsonif [[ -n "$PROTO1" ]]; then # first proto area specifed 3337c478bd9Sstevel@tonic-gate ROOT=$PROTO1 3347c478bd9Sstevel@tonic-gate ENVCPPFLAGS1=-I$ROOT/usr/include 3357c478bd9Sstevel@tonic-gate export ENVCPPFLAGS1 3367c478bd9Sstevel@tonic-gate ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 3377c478bd9Sstevel@tonic-gate export ENVLDLIBS1 3387c478bd9Sstevel@tonic-gate 3397c478bd9Sstevel@tonic-gate PROTO2=`check_proto $PROTO2` 340cdf0c1d5Smjnelson if [[ -n "$PROTO2" ]]; then # second proto area specifed 3417c478bd9Sstevel@tonic-gate ENVCPPFLAGS2=-I$PROTO2/usr/include 3427c478bd9Sstevel@tonic-gate export ENVCPPFLAGS2 3437c478bd9Sstevel@tonic-gate ENVLDLIBS2="-L$PROTO2/lib -L$PROTO2/usr/lib" 3447c478bd9Sstevel@tonic-gate export ENVLDLIBS2 3457c478bd9Sstevel@tonic-gate 346cdf0c1d5Smjnelson PROTO3=`check_proto $PROTO3` 347cdf0c1d5Smjnelson if [[ -n "$PROTO3" ]]; then # third proto area specifed 3487c478bd9Sstevel@tonic-gate ENVCPPFLAGS3=-I$PROTO3/usr/include 3497c478bd9Sstevel@tonic-gate export ENVCPPFLAGS3 3507c478bd9Sstevel@tonic-gate ENVLDLIBS3="-L$PROTO3/lib -L$PROTO3/usr/lib" 3517c478bd9Sstevel@tonic-gate export ENVLDLIBS3 3527c478bd9Sstevel@tonic-gate fi 3537c478bd9Sstevel@tonic-gate fi 3547c478bd9Sstevel@tonic-gatefi 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gateexport ROOT 3577c478bd9Sstevel@tonic-gate 358cdf0c1d5Smjnelsonif [[ -n "$TERMPROTO" ]]; then # fallback area specifed 3597c478bd9Sstevel@tonic-gate TERMPROTO=`check_proto $TERMPROTO` 3607c478bd9Sstevel@tonic-gate ENVCPPFLAGS4="-Y I,$TERMPROTO/usr/include" 3617c478bd9Sstevel@tonic-gate export ENVCPPFLAGS4 3627c478bd9Sstevel@tonic-gate ENVLDLIBS3="$ENVLDLIBS3 -Y P,$TERMPROTO/lib:$TERMPROTO/usr/lib" 3637c478bd9Sstevel@tonic-gate export ENVLDLIBS3 3647c478bd9Sstevel@tonic-gatefi 3657c478bd9Sstevel@tonic-gate 3667c478bd9Sstevel@tonic-gateosbld_flag=0 3677c478bd9Sstevel@tonic-gate 368cdf0c1d5Smjnelsonif [[ -z "$ONBLD_DIR" ]]; then 3698bcea973SRichard Lowe ONBLD_DIR=$(/bin/dirname $(whence $0)) 3707c478bd9Sstevel@tonic-gatefi 371cdf0c1d5Smjnelson 372cdf0c1d5Smjnelsonif ! echo ":$PATH:" | grep ":${ONBLD_DIR}:" > /dev/null; then 373cdf0c1d5Smjnelson PATH="${ONBLD_DIR}:${ONBLD_DIR}/${MACH}:${PATH}" 3747c478bd9Sstevel@tonic-gate osbld_flag=1 3757c478bd9Sstevel@tonic-gatefi 376cdf0c1d5Smjnelson 377cdf0c1d5Smjnelsonexport PATH 378cdf0c1d5Smjnelson 379cdf0c1d5Smjnelsonif [[ -n "$PROTO2" ]]; then 3807c478bd9Sstevel@tonic-gate # This should point to the parent's proto 3817c478bd9Sstevel@tonic-gate PARENT_ROOT=$PROTO2 3827c478bd9Sstevel@tonic-gate export PARENT_ROOT 3837c478bd9Sstevel@tonic-gateelse 3847c478bd9Sstevel@tonic-gate # Clear it in case it's already in the env. 3857c478bd9Sstevel@tonic-gate PARENT_ROOT= 3867c478bd9Sstevel@tonic-gatefi 3877c478bd9Sstevel@tonic-gateexport ONBLD_DIR 3887c478bd9Sstevel@tonic-gateexport MACH 389cdf0c1d5Smjnelson 390cdf0c1d5Smjnelsonos_rev=`uname -r` 391cdf0c1d5Smjnelsonos_name=`uname -s` 392cdf0c1d5Smjnelson 393cdf0c1d5Smjnelsonif [[ $os_name != "SunOS" || `expr $os_rev : "5\."` != "2" ]]; then 3947c478bd9Sstevel@tonic-gate # 395cdf0c1d5Smjnelson # This is not a SunOS 5.x machine - something is wrong 3967c478bd9Sstevel@tonic-gate # 397cdf0c1d5Smjnelson echo "***WARNING: this script is meant to be run on SunOS 5.x." 398cdf0c1d5Smjnelson echo " This machine appears to be running: $os_name $os_rev" 3997c478bd9Sstevel@tonic-gatefi 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gateecho "" 402cdf0c1d5Smjnelsonecho "Workspace : $wsname" 4038bcea973SRichard Loweif [[ -n "$parent" ]]; then 4047c478bd9Sstevel@tonic-gate echo "Workspace Parent : $parent" 4057c478bd9Sstevel@tonic-gatefi 4067c478bd9Sstevel@tonic-gateecho "Proto area (\$ROOT) : $ROOT" 4078bcea973SRichard Loweif [[ -n "$PARENT_ROOT" ]]; then 4087c478bd9Sstevel@tonic-gate echo "Parent proto area (\$PARENT_ROOT) : $PARENT_ROOT" 4097c478bd9Sstevel@tonic-gatefi 4107c478bd9Sstevel@tonic-gateecho "Root of source (\$SRC) : $SRC" 4117c478bd9Sstevel@tonic-gateecho "Root of test source (\$TSRC) : $TSRC" 4128bcea973SRichard Loweif [[ $osbld_flag = "1" ]]; then 4137c478bd9Sstevel@tonic-gate echo "Prepended to PATH : $ONBLD_DIR" 4147c478bd9Sstevel@tonic-gatefi 415cdf0c1d5Smjnelsonecho "Current directory (\$PWD) : $wsname" 4167c478bd9Sstevel@tonic-gateecho "" 4177c478bd9Sstevel@tonic-gate 418cdf0c1d5Smjnelsoncd $wsname 4197c478bd9Sstevel@tonic-gate 4207c478bd9Sstevel@tonic-gateif $setenv; then 4217c478bd9Sstevel@tonic-gate cleanup_env 4227c478bd9Sstevel@tonic-gateelse 4237c478bd9Sstevel@tonic-gate exec ${SHELL:-sh} "$@" 4247c478bd9Sstevel@tonic-gatefi 425