Home | History | Annotate | Download | only in scripts
 " CDDL HEADER START
"
" The contents of this file are subject to the terms of the
" Common Development and Distribution License (the "License").
" You may not use this file except in compliance with the License.
"
" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
" or http://www.opensolaris.org/os/licensing.
" See the License for the specific language governing permissions
" and limitations under the License.
"
" When distributing Covered Code, include this CDDL HEADER in each
" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
" If applicable, add the following below this CDDL HEADER, with the
" fields enclosed by brackets "[]" replaced with your own identifying
" information: Portions Copyright [yyyy] [name of copyright owner]
"
" CDDL HEADER END
"
"Copyright 2009 Sun Microsystems, Inc. All rights reserved."
"Use is subject to license terms."
nightly 1 "08 Sep 2009"
NAME
nightly - build an OS-Net consolidation overnight
SYNOPSIS
nightly [-in] [-V VERS] <env_file>

DESCRIPTION
"OS-Net build tools" "nightly" "" "nightly"

nightly, the mother of all build scripts, can bringover, build, archive, package, error check, and generally do everything it takes to turn OS/Net consolidation source code into useful stuff. It is customizable to permit you to run anything from a simple build to all of the cross-checking a gatekeeper needs. The advantage to using nightly is that you build things correctly, consistently and automatically, with the best practices; building with nightly can mean never having to say you're sorry to your gatekeeper.

More specifically, nightly performs the following tasks, in order, if all these things are desired:

perform a "make clobber" to clean up old binaries

bringover from the identified parent gate/clone

perform non-DEBUG and DEBUG builds

list proto area files and compare with previous list

copy updated proto area to parent

list shared lib interface and compare with previous list

perform a "make lint" of the kernel and report errors

perform a "make check" to report hdrchk/cstyle errors

report the presence of any core files

check the ELF runtime attributes of all dynamic objects

check for unreferenced files

report on which proto area objects have changed (since the last build)

report the total build time

save a detailed log file for reference

mail the user a summary of the completed build

The actions of the script are almost completely determined by the environment variables in the env file, the only necessary argument. Ths only thing you really need to use nightly is an env file that does what you want.

Like most of the other build tools in usr/src/tools, this script tends to change on a fairly regular basis; do not expect to be able to build OS/Net with a version of nightly significantly older than your source tree. It has what is effectively a Consolidation Private relationship to other build tools and with many parts of the OS/Net makefiles, although it may also be used to build other consolidations.

NIGHTLY_OPTIONS
The environment variable NIGHTLY_OPTIONS controls the actions nightly will take as it proceeds. The -i, -n, +t and -V options may also be used from the command line to control the actions without editing your environment file. The -i and -n options complete the build more quickly by bypassing some actions. If NIGHTLY_OPTIONS is not set, then "-aBmt" build options will be used. Basic action options

10 -D Do a build with DEBUG on (non-DEBUG is built by default)

-F Do _not_ do a non-DEBUG build (use with -D to get just a DEBUG build)

-M Do not run pmodes (safe file permission checker)

-i Do an incremental build, suppressing the "make clobber" that by default removes all existing binaries and derived files. From the command line, -i also suppresses the lint pass and the cstyle/hdrchk pass

-n Suppress the bringover so that the build will start immediately with current source code

-o Do an "old style" (pre-S10) build using root privileges to set OWNER and GROUP from the Makefiles.

-0 Create a globalization package. Requires that G11N_PKGDIR be set in the build environment. See ENVIRONMENT VARIABLES below.

-a Create BFU archives

-z Compress cpio archives with gzip

-p Create packages for regular install

-U Update proto area in the parent workspace

-u Copy proto_list_${MACH} and friends to usr/src in the parent workspace. When used with -f, also build a usr/src/unrefmaster.out in the parent by merging all the usr/src/unref-${MACH}.out files in the parent.

-m Send mail to $MAILTO at end of build

-t Build and use the tools in $SRC/tools (default setting).

\+t Use the build tools in "$ONBLD_TOOLS/bin".

Code checking options

10 -A Check for ABI discrepancies in .so files. It is only required for shared object developers when there is an addition, deletion or change of interface in the .so files.

-C Check for cstyle/hdrchk errors

-f Check for unreferenced files. Since the full workspace must be built in order to accurately identify unreferenced files, -f is ignored for incremental (-i) builds, or builds that do not include -l, and -p. In addition, -f implies -0.

-r Check the ELF runtime attributes of all dynamic objects

-l Do "make lint" in $LINTDIRS (default: $SRC n)

-N Do not run protocmp or checkpaths (note: this option is not recommended, especially in conjunction with the -p option)

-W Do not report warnings (for freeware gate ONLY)

-w Report which proto area objects differ between this and the last build. See wsdiff(1) for details. Note that the proto areas used for comparison are the last ones constructed as part of the build. As an example, if both a non-debug and debug build are performed (in that order), then the debug proto area will be used for comparison (which might not be what you want).

Groups of options

10 -G Gate keeper default group of options (-0au)

-I Integration engineer default group of options (-ampu)

-R Default group of options for building a release (-mp)

Source Build options

10 -S E | D | H Build the Export, Domestic, or Hybrid source product. Only Export and Domestic are truly buildable at this time.

10 -S O Simulate an OpenSolaris build on a full tree. This can be used by internal developers to ensure that they haven't broken the build for external developers.

Source build options only make sense for a full internal tree (open and closed source). Only one source build option can be specified at a time.

Miscellaneous options

10 -O generate deliverables for OpenSolaris. Tarballs containing a source snapshot, binaries of closed-source components, compiled ON tools (SUNWonbld), and BFU archives are put in $CODEMGR_WS.

10 -V VERS set the build version string to VERS, overriding VERSION

-X Copies the proto area and packages from the IHV and IHV-bin gates into the nightly proto and package areas. This is only available on i386. See REALMODE ENVIRONMENT VARIABLES and BUILDING THE IHV WORKSPACE below.

ENVIRONMENT VARIABLES

Here is a list of prominent environment variables that nightly references and the meaning of each variable.

CODEMGR_WS The root of your workspace, including whatever metadata is kept by the source code management system. This is the workspace in which the build will be done.

PARENT_WS The root of the workspace that is the parent of the one being built. This is particularly relevant for configurations with a main workspace and build workspaces underneath it; see the -u and -U options, and the CPIODIR and PKGARCHIVE environment variables, for more information.

BRINGOVER_WS This is the workspace from which nightly will fetch sources to either populate or update your workspace; it defaults to $CLONE_WS.

CLOSED_BRINGOVER_WS A full Mercurial workspace has two repositories: one for open source and one for closed source. If this variable is non-null, nightly will pull from the repository that it names to get the closed source. It defaults to $CLOSED_CLONE_WS.

If $CODEMGR_WS already exists and contains only the open repository, nightly will ignore this variable; you'll need to pull the closed repository by hand if you want it.

CLONE_WS This is the workspace from which nightly will fetch sources by default. This is often distinct from the parent, particularly if the parent is a gate.

CLOSED_CLONE_WS This is the default closed-source Mercurial repository that nightly might pull from (see CLOSED_BRINGOVER_WS for details).

SRC Root of OS-Net source code, referenced by the Makefiles. It is the starting point of build activity. It should be expressed in terms of $CODEMGR_WS.

G11N_PKGDIR The location of the globalization package directory. It should be expressed in terms of $CODEMGR_WS. If this is not set, then the -0 option will be ignored, whether it was set explicitly in NIGHTLY_OPTIONS or implicitly via the -f option. If this is set, but the diretory does not exist, the -0 option will have no effect.

ROOT Root of the proto area for the build. The makefiles direct the installation of header files and libraries to this area and direct references to these files by builds of commands and other targets. It should be expressed in terms of $CODEMGR_WS.

If $MULTI_PROTO is "no", $ROOT may contain a DEBUG or non-DEBUG build. If $MULTI_PROTO is "yes", $ROOT contains the DEBUG build and $ROOT-nd contains the non-DEBUG build.

For OpenSolaris deliveries (-O), $ROOT-open contains the DEBUG build of just the open source tree, and $ROOT-open-nd contains the non-DEBUG build.

MACH The instruction set architecture of the build machine as given by uname -p, e.g. sparc, i386.

LOCKNAME The name of the file used to lock out multiple runs of nightly. This should generally be left to the default setting.

ATLOG The location of the log directory maintained by nightly This should generally be left to the default setting.

LOGFILE The name of the log file in the $ATLOG directory maintained by nightly This should generally be left to the default setting.

STAFFER The non-root account to use on the build machine for the bringover from the clone or parent workspace. This may not be the same identify used by the SCM.

MAILTO The address to be used to send completion e-mail at the end of the build (for the -m option).

REF_PROTO_LIST Name of file used with protocmp to compare proto area contents.

CPIODIR The destination for cpio archives. This may be relative to $CODEMGR_WS for private archives or relative to $PARENT_WS if you have different workspaces for different architectures but want one hierarchy of BFU archives.

PARENT_ROOT The parent root, which is the destination for updated headers and libraries when using the -U option.

RELEASE The release version number to be used; e.g., 5.10.1 (Note: this is set in Makefile.master and should not normally be overridden).

VERSION The version text string to be used; e.g., "onnv:`date '+%Y-%m-%d'`".

RELEASE_DATE The release date text to be used; e.g., October 2009. If not set in your environment file, then this text defaults to the output from $(LC_ALL=C date +"%B %Y"); e.g., "October 2009".

INTERNAL_RELEASE_BUILD See Makefile.master - but it mostly controls id strings. Generally, let nightly set this for you.

RELEASE_BUILD Define this to build a release with a non-DEBUG is reserved for per-build-machine customizations and should be set only in /etc/nightly.conf

PRE_NIGHTLY Run just after SYS_PRE_NIGHTLY.

PRE_BRINGOVER Run just before bringover is started; not run if no bringover is done.

POST_BRINGOVER Run just after bringover completes; not run if no bringover is done.

POST_NIGHTLY Run after the build completes, with the return status of nightly - one of "Completed", "Interrupted", or "Failed" - available in the environment variable NIGHTLY_STATUS.

SYS_POST_NIGHTLY This is reserved for per-build-machine customizations, and runs immedately after POST_NIGHTLY.

REALMODE ENVIRONMENT VARIABLES

The following environment variables referenced by nightly are only required when the -X option is used.

IA32_IHV_WS Reference to the IHV workspace containing IHV driver binaries. The IHV workspace must be fully built before starting the ON realmode build.

IA32_IHV_ROOT Reference to the IHV workspace proto area. The IHV workspace must be fully built before starting the ON realmode build.

IA32_IHV_PKGS Reference to the IHV workspace packages. If this is empty or the directory is non-existent, then nightly will skip copying the packages.

IA32_IHV_BINARY_PKGS Reference to binary-only IHV packages. If this is empty or the directory is non-existent, then nightly will skip copying the packages.

SPARC_RM_PKGARCHIVE Destination for sparc realmode package SUNWrmodu. Yes, this sparc package really is built on x86.

FILES

/etc/nightly.conf

If present, nightly executes this file just prior to executing the env file.

BUILDING THE IHV WORKSPACE

The IHV workspace can be built with nightly. The recommended options are:

NIGHTLY_OPTIONS="-pmWN"

None of the realmode environment variables needed for ON realmode builds are required to build the IHV workspace.

EXAMPLES

Start with the example file in usr/src/tools/env/developer.sh (or gatekeeper.sh), copy to myenv and make your changes.

0 # grep NIGHTLY_OPTIONS myenv

NIGHTLY_OPTIONS="-ACrlapDm"

export NIGHTLY_OPTIONS

# /opt/onbld/bin/nightly -i myenv

SEE ALSO
bldenv (1)