1# 2# CDDL HEADER START 3# 4# The contents of this file are subject to the terms of the 5# Common Development and Distribution License (the "License"). 6# You may not use this file except in compliance with the License. 7# 8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9# or http://www.opensolaris.org/os/licensing. 10# See the License for the specific language governing permissions 11# and limitations under the License. 12# 13# When distributing Covered Code, include this CDDL HEADER in each 14# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15# If applicable, add the following below this CDDL HEADER, with the 16# fields enclosed by brackets "[]" replaced with your own identifying 17# information: Portions Copyright [yyyy] [name of copyright owner] 18# 19# CDDL HEADER END 20# 21# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 22# Copyright 2010, 2011 Nexenta Systems, Inc. All rights reserved. 23# 24 25# Configuration variables for the runtime environment of the nightly 26# build script and other tools for construction and packaging of 27# releases. 28# This example is suitable for building an illumos workspace, which 29# will contain the resulting archives. It is based off the onnv 30# release. It sets NIGHTLY_OPTIONS to make nightly do: 31# DEBUG build only (-D, -F) 32# do not bringover from the parent (-n) 33# runs 'make check' (-C) 34# runs lint in usr/src (-l plus the LINTDIRS variable) 35# sends mail on completion (-m and the MAILTO variable) 36# creates packages for PIT/RE (-p) 37# checks for changes in ELF runpaths (-r) 38# build and use this workspace's tools in $SRC/tools (-t) 39# 40# - This file is sourced by "bldenv.sh" and "nightly.sh" and should not 41# be executed directly. 42# - This script is only interpreted by ksh93 and explicitly allows the 43# use of ksh93 language extensions. 44# 45export NIGHTLY_OPTIONS='-FnCDlmprt' 46 47# 48# -- PLEASE READ THIS -- 49# 50# The variables GATE and CODEMGR_WS must always be customised to 51# match your workspace/gate location!! 52# 53# -- PLEASE READ THIS -- 54# 55 56# This is a variable for the rest of the script - GATE doesn't matter to 57# nightly itself 58export GATE='testws' 59 60# CODEMGR_WS - where is your workspace at (or what should nightly name it) 61export CODEMGR_WS="$HOME/ws/$GATE" 62 63# Maximum number of dmake jobs. The recommended number is 2 + NCPUS, 64# where NCPUS is the number of logical CPUs on your build system. 65function maxjobs 66{ 67 nameref maxjobs=$1 68 integer ncpu 69 integer -r min_mem_per_job=512 # minimum amount of memory for a job 70 71 ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN') 72 (( maxjobs=ncpu + 2 )) 73 74 # Throttle number of parallel jobs launched by dmake to a value which 75 # gurantees that all jobs have enough memory. This was added to avoid 76 # excessive paging/swapping in cases of virtual machine installations 77 # which have lots of CPUs but not enough memory assigned to handle 78 # that many parallel jobs 79 if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then 80 integer max_jobs_per_memory # parallel jobs which fit into physical memory 81 integer physical_memory # physical memory installed 82 83 # The array ".sh.match" contains the contents of capturing 84 # brackets in the last regex, .sh.match[1] will contain 85 # the value matched by ([[:digit:]]+), i.e. the amount of 86 # memory installed 87 physical_memory="10#${.sh.match[1]}" 88 89 (( 90 max_jobs_per_memory=round(physical_memory/min_mem_per_job) , 91 maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory)) 92 )) 93 fi 94 95 return 0 96} 97 98maxjobs DMAKE_MAX_JOBS # "DMAKE_MAX_JOBS" passed as ksh(1) name reference 99export DMAKE_MAX_JOBS 100 101# path to onbld tool binaries 102ONBLD_BIN='/opt/onbld/bin' 103 104# PARENT_WS is used to determine the parent of this workspace. This is 105# for the options that deal with the parent workspace (such as where the 106# proto area will go). 107export PARENT_WS='' 108 109# CLONE_WS is the workspace nightly should do a bringover from. 110export CLONE_WS='ssh://anonhg@hg.illumos.org/illumos-gate' 111 112# The bringover, if any, is done as STAFFER. 113# Set STAFFER to your own login as gatekeeper or developer 114# The point is to use group "staff" and avoid referencing the parent 115# workspace as root. 116# Some scripts optionally send mail messages to MAILTO. 117# 118export STAFFER="$LOGNAME" 119export MAILTO="$STAFFER" 120 121# The project (see project(4)) under which to run this build. If not 122# specified, the build is simply run in a new task in the current project. 123export BUILD_PROJECT='' 124 125# You should not need to change the next four lines 126export LOCKNAME="$(basename -- "$CODEMGR_WS")_nightly.lock" 127export ATLOG="$CODEMGR_WS/log" 128export LOGFILE="$ATLOG/nightly.log" 129export MACH="$(uname -p)" 130 131# 132# The following two macros are the closed/crypto binaries. Once 133# Illumos has totally freed itself, we can remove these references. 134# 135# Location of encumbered binaries. 136export ON_CLOSED_BINS="$CODEMGR_WS/closed" 137# Location of signed cryptographic binaries. 138export ON_CRYPTO_BINS="$CODEMGR_WS/on-crypto.$MACH.tar.bz2" 139 140# REF_PROTO_LIST - for comparing the list of stuff in your proto area 141# with. Generally this should be left alone, since you want to see differences 142# from your parent (the gate). 143# 144export REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH}" 145 146 147export ROOT="$CODEMGR_WS/proto/root_${MACH}" 148export SRC="$CODEMGR_WS/usr/src" 149export MULTI_PROTO="no" 150 151# 152# build environment variables, including version info for mcs, motd, 153# motd, uname and boot messages. Mostly you shouldn't change this except 154# when the release slips (nah) or you move an environment file to a new 155# release 156# 157export VERSION="$GATE" 158 159# 160# the RELEASE and RELEASE_DATE variables are set in Makefile.master; 161# there might be special reasons to override them here, but that 162# should not be the case in general 163# 164# export RELEASE='5.11' 165# export RELEASE_DATE='October 2007' 166 167# proto area in parent for optionally depositing a copy of headers and 168# libraries corresponding to the protolibs target 169# not applicable given the NIGHTLY_OPTIONS 170# 171export PARENT_ROOT="$PARENT_WS/proto/root_$MACH" 172export PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd" 173 174# Package creation variables. You probably shouldn't change these, 175# either. 176# 177# PKGARCHIVE determines where the repository will be created. 178# 179# PKGPUBLISHER_REDIST controls the publisher setting for the repository. 180# 181export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly" 182# export PKGPUBLISHER_REDIST='on-redist' 183 184# Package manifest format version. 185export PKGFMT_OUTPUT='v1' 186 187# we want make to do as much as it can, just in case there's more than 188# one problem. 189export MAKEFLAGS='k' 190 191# Magic variable to prevent the devpro compilers/teamware from sending 192# mail back to devpro on every use. 193export UT_NO_USAGE_TRACKING='1' 194 195# Build tools - don't change these unless you know what you're doing. These 196# variables allows you to get the compilers and onbld files locally or 197# through cachefs. Set BUILD_TOOLS to pull everything from one location. 198# Alternately, you can set ONBLD_TOOLS to where you keep the contents of 199# SUNWonbld and SPRO_ROOT to where you keep the compilers. SPRO_VROOT 200# exists to make it easier to test new versions of the compiler. 201export BUILD_TOOLS='/opt' 202#export ONBLD_TOOLS='/opt/onbld' 203export SPRO_ROOT='/opt/SUNWspro' 204export SPRO_VROOT="$SPRO_ROOT" 205 206# This goes along with lint - it is a series of the form "A [y|n]" which 207# means "go to directory A and run 'make lint'" Then mail me (y) the 208# difference in the lint output. 'y' should only be used if the area you're 209# linting is actually lint clean or you'll get lots of mail. 210# You shouldn't need to change this though. 211#export LINTDIRS="$SRC y" 212 213# Set this flag to 'n' to disable the automatic validation of the dmake 214# version in use. The default is to check it. 215#CHECK_DMAKE='y' 216 217# Set this flag to 'n' to disable the use of 'checkpaths'. The default, 218# if the 'N' option is not specified, is to run this test. 219#CHECK_PATHS='y' 220 221# POST_NIGHTLY can be any command to be run at the end of nightly. See 222# nightly(1) for interactions between environment variables and this command. 223#POST_NIGHTLY= 224