Print this page
9831 bldenv should adapt to nightly debug settings

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/scripts/bldenv.sh
          +++ new/usr/src/tools/scripts/bldenv.sh
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17  # fields enclosed by brackets "[]" replaced with your own identifying
  18   18  # information: Portions Copyright [yyyy] [name of copyright owner]
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  25   25  # Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  26   26  # Copyright 2014 Garrett D'Amore <garrett@damore.org>
       27 +# Copyright 2018 Joyent, Inc.
  27   28  #
  28   29  # Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables
  29   30  # before spawning a shell for doing a release-style builds interactively
  30   31  # and incrementally.
  31   32  #
  32   33  
  33   34  function fatal_error
  34   35  {
  35   36          print -u2 "${progname}: $*"
  36   37          exit 1
↓ open down ↓ 25 lines elided ↑ open up ↑
  62   63  [+?bldenv is particularly useful for testing Makefile targets
  63   64      like clobber, install and _msg, which otherwise require digging
  64   65      through large build logs to figure out what is being
  65   66      done.]
  66   67  [+?By default, bldenv will invoke the shell specified in
  67   68      $SHELL. If $SHELL is not set or is invalid, csh will be
  68   69      used.]
  69   70  [c?force the use of csh, regardless of the  value  of $SHELL.]
  70   71  [f?invoke csh with the -f (fast-start) option. This option is valid
  71   72      only if $SHELL is unset or if it points to csh.]
  72      -[d?set up environment for doing DEBUG builds (default is non-DEBUG)]
       73 +[d?set up environment for doing DEBUG builds. The default is non-DEBUG,
       74 +    unless the -F flag is specified in the nightly file.]
  73   75  [t?set up environment to use the tools in usr/src/tools (this is the
  74   76      default, use +t to use the tools from /opt/onbld)]
  75   77  
  76   78  <env_file> [command]
  77   79  
  78   80  [+EXAMPLES]{
  79   81      [+?Example 1: Interactive use]{
  80   82          [+?Use bldenv to spawn a shell to perform  a  DEBUG  build  and
  81   83              testing of the  Makefile  targets  clobber and install for
  82   84              usr/src/cmd/true.]
↓ open down ↓ 37 lines elided ↑ open up ↑
 120  122          typeset d=false
 121  123          typeset O=false
 122  124          typeset o=false
 123  125          typeset t=true
 124  126          typeset s=(
 125  127                  typeset e=false
 126  128                  typeset h=false
 127  129                  typeset d=false
 128  130                  typeset o=false
 129  131          )
      132 +        typeset d_set=false
      133 +        typeset DF_build=false
 130  134  )
 131  135  
 132  136  typeset progname="$(basename -- "${0}")"
 133  137  
 134  138  OPTIND=1
 135      -SUFFIX="-nd"
 136  139  
 137      -while getopts -a "${progname}" "${USAGE}" OPT ; do 
      140 +while getopts -a "${progname}" "${USAGE}" OPT ; do
 138  141      case ${OPT} in
 139  142            c)    flags.c=true  ;;
 140  143            +c)   flags.c=false ;;
 141  144            f)    flags.f=true  ;;
 142  145            +f)   flags.f=false ;;
 143      -          d)    flags.d=true  SUFFIX=""    ;;
 144      -          +d)   flags.d=false SUFFIX="-nd" ;;
      146 +          d)    flags.d=true ; flags.d_set=true ;;
      147 +          +d)   flags.d=false ; flags.d_set=true ;;
 145  148            t)    flags.t=true  ;;
 146  149            +t)   flags.t=false ;;
 147  150            \?)   usage ;;
 148  151      esac
 149  152  done
 150  153  shift $((OPTIND-1))
 151  154  
 152  155  # test that the path to the environment-setting file was given
 153  156  if (( $# < 1 )) ; then
 154  157          usage
↓ open down ↓ 73 lines elided ↑ open up ↑
 228  231  [[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found."
 229  232  
 230  233  # must match the getopts in nightly.sh
 231  234  OPTIND=1
 232  235  NIGHTLY_OPTIONS="-${NIGHTLY_OPTIONS#-}"
 233  236  while getopts '+0ABCDdFfGIilMmNnpRrtUuwW' FLAG $NIGHTLY_OPTIONS
 234  237  do
 235  238          case "$FLAG" in
 236  239            t)    flags.t=true  ;;
 237  240            +t)   flags.t=false ;;
      241 +          F)    flags.DF_build=true ;;
 238  242            *)    ;;
 239  243          esac
 240  244  done
 241  245  
      246 +# DEBUG is a little bit complicated.  First, bldenv -d/+d over-rides
      247 +# the env file.  Otherwise, we'll default to DEBUG iff we are *not*
      248 +# building non-DEBUG bits at all.
      249 +if [ "${flags.d_set}" != "true" ] && "${flags.DF_build}"; then
      250 +        flags.d=true
      251 +fi
      252 +
 242  253  POUND_SIGN="#"
 243  254  # have we set RELEASE_DATE in our env file?
 244  255  if [ -z "$RELEASE_DATE" ]; then
 245  256          RELEASE_DATE=$(LC_ALL=C date +"%B %Y")
 246  257  fi
 247  258  BUILD_DATE=$(LC_ALL=C date +%Y-%b-%d)
 248  259  BASEWSDIR=$(basename -- "${CODEMGR_WS}")
 249  260  DEV_CM="\"@(#)SunOS Internal Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
 250  261  export DEV_CM RELEASE_DATE POUND_SIGN
 251  262  
 252  263  print 'Build type   is  \c'
 253  264  if ${flags.d} ; then
 254  265          print 'DEBUG'
      266 +        SUFFIX=""
 255  267          unset RELEASE_BUILD
 256  268          unset EXTRA_OPTIONS
 257  269          unset EXTRA_CFLAGS
 258  270  else
 259  271          # default is a non-DEBUG build
 260  272          print 'non-DEBUG'
      273 +        SUFFIX="-nd"
 261  274          export RELEASE_BUILD=
 262  275          unset EXTRA_OPTIONS
 263  276          unset EXTRA_CFLAGS
 264  277  fi
 265  278  
 266  279  # update build-type variables
 267  280  PKGARCHIVE="${PKGARCHIVE}${SUFFIX}"
 268  281  
 269      -#       Set PATH for a build
      282 +#       Set PATH for a build
 270  283  PATH="/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:."
 271      -if [[ "${SUNWSPRO}" != "" ]]; then 
 272      -        export PATH="${SUNWSPRO}/bin:$PATH" 
 273      -fi 
      284 +if [[ "${SUNWSPRO}" != "" ]]; then
      285 +        export PATH="${SUNWSPRO}/bin:$PATH"
      286 +fi
 274  287  
 275  288  if [[ -n "${MAKE}" ]]; then
 276  289          if [[ -x "${MAKE}" ]]; then
 277  290                  export PATH="$(dirname -- "${MAKE}"):$PATH"
 278  291          else
 279  292                  print "\$MAKE (${MAKE}) is not a valid executible"
 280      -                exit 1  
      293 +                exit 1
 281  294          fi
 282  295  fi
 283  296  
 284  297  TOOLS="${SRC}/tools"
 285  298  TOOLS_PROTO="${TOOLS}/proto/root_${MACH}-nd" ; export TOOLS_PROTO
 286  299  
 287  300  if "${flags.t}" ; then
 288  301          export ONBLD_TOOLS="${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld}"
 289  302  
 290  303          export STABS="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/stabs"
↓ open down ↓ 114 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX