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