xref: /titanic_44/usr/src/tools/env/illumos.sh (revision 10d63b7db37a83b39c7f511cf9426c9d03ea0760)
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.
22d7693b08SRoland Mainz# Copyright 2010, 2011 Nexenta Systems, Inc.  All rights reserved.
233cb00cf1SJoshua M. Clulow# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
241f2ca518SDan McDonald# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
25eb8f03cdSGarrett D'Amore#
26eb8f03cdSGarrett D'Amore
27eb8f03cdSGarrett D'Amore# Configuration variables for the runtime environment of the nightly
28d7693b08SRoland Mainz# build script and other tools for construction and packaging of
29d7693b08SRoland Mainz# releases.
30d7693b08SRoland Mainz# This example is suitable for building an illumos workspace, which
31d7693b08SRoland Mainz# will contain the resulting archives. It is based off the onnv
32d7693b08SRoland Mainz# release. It sets NIGHTLY_OPTIONS to make nightly do:
33eb8f03cdSGarrett D'Amore#       DEBUG build only (-D, -F)
34eb8f03cdSGarrett D'Amore#       do not bringover from the parent (-n)
35eb8f03cdSGarrett D'Amore#       runs 'make check' (-C)
362c2a4b29SRichard Lowe#       checks for new interfaces in libraries (-A)
37eb8f03cdSGarrett D'Amore#       runs lint in usr/src (-l plus the LINTDIRS variable)
38eb8f03cdSGarrett D'Amore#       sends mail on completion (-m and the MAILTO variable)
39eb8f03cdSGarrett D'Amore#       creates packages for PIT/RE (-p)
40eb8f03cdSGarrett D'Amore#       checks for changes in ELF runpaths (-r)
41eb8f03cdSGarrett D'Amore#       build and use this workspace's tools in $SRC/tools (-t)
42eb8f03cdSGarrett D'Amore#
43d7693b08SRoland Mainz# - This file is sourced by "bldenv.sh" and "nightly.sh" and should not
44d7693b08SRoland Mainz#   be executed directly.
45d7693b08SRoland Mainz# - This script is only interpreted by ksh93 and explicitly allows the
46d7693b08SRoland Mainz#   use of ksh93 language extensions.
47d7693b08SRoland Mainz#
482c2a4b29SRichard Loweexport NIGHTLY_OPTIONS='-FnCDAlmprt'
49d7693b08SRoland Mainz
50d7693b08SRoland Mainz#
51d7693b08SRoland Mainz# -- PLEASE READ THIS --
52d7693b08SRoland Mainz#
53d7693b08SRoland Mainz# The variables  GATE and CODEMGR_WS must always be customised to
54d7693b08SRoland Mainz# match your workspace/gate location!!
55d7693b08SRoland Mainz#
56d7693b08SRoland Mainz# -- PLEASE READ THIS --
57d7693b08SRoland Mainz#
58eb8f03cdSGarrett D'Amore
59eb8f03cdSGarrett D'Amore# This is a variable for the rest of the script - GATE doesn't matter to
60eb8f03cdSGarrett D'Amore# nightly itself
61d7693b08SRoland Mainzexport GATE='testws'
62eb8f03cdSGarrett D'Amore
63eb8f03cdSGarrett D'Amore# CODEMGR_WS - where is your workspace at (or what should nightly name it)
64d7693b08SRoland Mainzexport CODEMGR_WS="$HOME/ws/$GATE"
65eb8f03cdSGarrett D'Amore
66d43a4e79SJeppe Toustrup# Maximum number of dmake jobs.  The recommended number is 2 + NCPUS,
67d43a4e79SJeppe Toustrup# where NCPUS is the number of logical CPUs on your build system.
68d7693b08SRoland Mainzfunction maxjobs
69d7693b08SRoland Mainz{
70d7693b08SRoland Mainz	nameref maxjobs=$1
71d7693b08SRoland Mainz	integer ncpu
72d7693b08SRoland Mainz	integer -r min_mem_per_job=512 # minimum amount of memory for a job
73d7693b08SRoland Mainz
74d7693b08SRoland Mainz	ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
75d7693b08SRoland Mainz	(( maxjobs=ncpu + 2 ))
76d7693b08SRoland Mainz
77d7693b08SRoland Mainz	# Throttle number of parallel jobs launched by dmake to a value which
78d7693b08SRoland Mainz	# gurantees that all jobs have enough memory. This was added to avoid
79d7693b08SRoland Mainz	# excessive paging/swapping in cases of virtual machine installations
80d7693b08SRoland Mainz	# which have lots of CPUs but not enough memory assigned to handle
81d7693b08SRoland Mainz	# that many parallel jobs
82d7693b08SRoland Mainz	if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
83d7693b08SRoland Mainz		integer max_jobs_per_memory # parallel jobs which fit into physical memory
84d7693b08SRoland Mainz		integer physical_memory # physical memory installed
85d7693b08SRoland Mainz
86d7693b08SRoland Mainz		# The array ".sh.match" contains the contents of capturing
87d7693b08SRoland Mainz		# brackets in the last regex, .sh.match[1] will contain
88d7693b08SRoland Mainz		# the value matched by ([[:digit:]]+), i.e. the amount of
89d7693b08SRoland Mainz		# memory installed
90d7693b08SRoland Mainz		physical_memory="10#${.sh.match[1]}"
91d7693b08SRoland Mainz
92d7693b08SRoland Mainz		((
93d7693b08SRoland Mainz			max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
94d7693b08SRoland Mainz			maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
95d7693b08SRoland Mainz		))
96d7693b08SRoland Mainz	fi
97d7693b08SRoland Mainz
98d7693b08SRoland Mainz	return 0
99eb8f03cdSGarrett D'Amore}
100d7693b08SRoland Mainz
101d7693b08SRoland Mainzmaxjobs DMAKE_MAX_JOBS # "DMAKE_MAX_JOBS" passed as ksh(1) name reference
102d7693b08SRoland Mainzexport DMAKE_MAX_JOBS
103eb8f03cdSGarrett D'Amore
104eb8f03cdSGarrett D'Amore# path to onbld tool binaries
105d7693b08SRoland MainzONBLD_BIN='/opt/onbld/bin'
106eb8f03cdSGarrett D'Amore
107eb8f03cdSGarrett D'Amore# PARENT_WS is used to determine the parent of this workspace. This is
108eb8f03cdSGarrett D'Amore# for the options that deal with the parent workspace (such as where the
109eb8f03cdSGarrett D'Amore# proto area will go).
110d7693b08SRoland Mainzexport PARENT_WS=''
111eb8f03cdSGarrett D'Amore
112eb8f03cdSGarrett D'Amore# CLONE_WS is the workspace nightly should do a bringover from.
113d7693b08SRoland Mainzexport CLONE_WS='ssh://anonhg@hg.illumos.org/illumos-gate'
114eb8f03cdSGarrett D'Amore
115eb8f03cdSGarrett D'Amore# The bringover, if any, is done as STAFFER.
116eb8f03cdSGarrett D'Amore# Set STAFFER to your own login as gatekeeper or developer
117eb8f03cdSGarrett D'Amore# The point is to use group "staff" and avoid referencing the parent
118eb8f03cdSGarrett D'Amore# workspace as root.
119eb8f03cdSGarrett D'Amore# Some scripts optionally send mail messages to MAILTO.
120eb8f03cdSGarrett D'Amore#
121d7693b08SRoland Mainzexport STAFFER="$LOGNAME"
122d7693b08SRoland Mainzexport MAILTO="$STAFFER"
123eb8f03cdSGarrett D'Amore
1243cb00cf1SJoshua M. Clulow# If you wish the mail messages to be From: an arbitrary address, export
1253cb00cf1SJoshua M. Clulow# MAILFROM.
1263cb00cf1SJoshua M. Clulow#export MAILFROM="user@example.com"
1273cb00cf1SJoshua M. Clulow
128eb8f03cdSGarrett D'Amore# The project (see project(4)) under which to run this build.  If not
129eb8f03cdSGarrett D'Amore# specified, the build is simply run in a new task in the current project.
130d7693b08SRoland Mainzexport BUILD_PROJECT=''
131eb8f03cdSGarrett D'Amore
13260a61f7aSJosef 'Jeff' Sipek# You should not need to change the next three lines
133d7693b08SRoland Mainzexport ATLOG="$CODEMGR_WS/log"
134d7693b08SRoland Mainzexport LOGFILE="$ATLOG/nightly.log"
135d7693b08SRoland Mainzexport MACH="$(uname -p)"
136eb8f03cdSGarrett D'Amore
137081d8c97SJeppe Toustrup#
138081d8c97SJeppe Toustrup#  The following two macros are the closed/crypto binaries.  Once
139081d8c97SJeppe Toustrup#  Illumos has totally freed itself, we can remove these references.
140081d8c97SJeppe Toustrup#
141081d8c97SJeppe Toustrup# Location of encumbered binaries.
142d7693b08SRoland Mainzexport ON_CLOSED_BINS="$CODEMGR_WS/closed"
143081d8c97SJeppe Toustrup# Location of signed cryptographic binaries.
144d7693b08SRoland Mainzexport ON_CRYPTO_BINS="$CODEMGR_WS/on-crypto.$MACH.tar.bz2"
145081d8c97SJeppe Toustrup
146eb8f03cdSGarrett D'Amore# REF_PROTO_LIST - for comparing the list of stuff in your proto area
147eb8f03cdSGarrett D'Amore# with. Generally this should be left alone, since you want to see differences
148eb8f03cdSGarrett D'Amore# from your parent (the gate).
149eb8f03cdSGarrett D'Amore#
150d7693b08SRoland Mainzexport REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH}"
151eb8f03cdSGarrett D'Amore
15286dc0e00SRichard Lowe
15386dc0e00SRichard Loweexport ROOT="$CODEMGR_WS/proto/root_${MACH}"
15486dc0e00SRichard Loweexport SRC="$CODEMGR_WS/usr/src"
15586dc0e00SRichard Loweexport MULTI_PROTO="no"
15686dc0e00SRichard Lowe
157eb8f03cdSGarrett D'Amore#
158eb8f03cdSGarrett D'Amore#	build environment variables, including version info for mcs, motd,
159eb8f03cdSGarrett D'Amore# motd, uname and boot messages. Mostly you shouldn't change this except
160eb8f03cdSGarrett D'Amore# when the release slips (nah) or you move an environment file to a new
161eb8f03cdSGarrett D'Amore# release
162eb8f03cdSGarrett D'Amore#
163d7693b08SRoland Mainzexport VERSION="$GATE"
164eb8f03cdSGarrett D'Amore
165eb8f03cdSGarrett D'Amore#
166eb8f03cdSGarrett D'Amore# the RELEASE and RELEASE_DATE variables are set in Makefile.master;
167eb8f03cdSGarrett D'Amore# there might be special reasons to override them here, but that
168eb8f03cdSGarrett D'Amore# should not be the case in general
169eb8f03cdSGarrett D'Amore#
170d7693b08SRoland Mainz# export RELEASE='5.11'
171d7693b08SRoland Mainz# export RELEASE_DATE='October 2007'
172eb8f03cdSGarrett D'Amore
173eb8f03cdSGarrett D'Amore# proto area in parent for optionally depositing a copy of headers and
174eb8f03cdSGarrett D'Amore# libraries corresponding to the protolibs target
175eb8f03cdSGarrett D'Amore# not applicable given the NIGHTLY_OPTIONS
176eb8f03cdSGarrett D'Amore#
177d7693b08SRoland Mainzexport PARENT_ROOT="$PARENT_WS/proto/root_$MACH"
178d7693b08SRoland Mainzexport PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd"
179eb8f03cdSGarrett D'Amore
180eb8f03cdSGarrett D'Amore# Package creation variables.  You probably shouldn't change these,
181eb8f03cdSGarrett D'Amore# either.
182eb8f03cdSGarrett D'Amore#
183eb8f03cdSGarrett D'Amore# PKGARCHIVE determines where the repository will be created.
184eb8f03cdSGarrett D'Amore#
185eb8f03cdSGarrett D'Amore# PKGPUBLISHER_REDIST controls the publisher setting for the repository.
186eb8f03cdSGarrett D'Amore#
187d7693b08SRoland Mainzexport PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
188d7693b08SRoland Mainz# export PKGPUBLISHER_REDIST='on-redist'
189eb8f03cdSGarrett D'Amore
190efcb7078SYuri Pankov# Package manifest format version.
191efcb7078SYuri Pankovexport PKGFMT_OUTPUT='v1'
192efcb7078SYuri Pankov
193eb8f03cdSGarrett D'Amore# we want make to do as much as it can, just in case there's more than
194eb8f03cdSGarrett D'Amore# one problem.
195d7693b08SRoland Mainzexport MAKEFLAGS='k'
196eb8f03cdSGarrett D'Amore
197eb8f03cdSGarrett D'Amore# Magic variable to prevent the devpro compilers/teamware from sending
198eb8f03cdSGarrett D'Amore# mail back to devpro on every use.
199d7693b08SRoland Mainzexport UT_NO_USAGE_TRACKING='1'
200eb8f03cdSGarrett D'Amore
201eb8f03cdSGarrett D'Amore# Build tools - don't change these unless you know what you're doing.  These
202eb8f03cdSGarrett D'Amore# variables allows you to get the compilers and onbld files locally or
203eb8f03cdSGarrett D'Amore# through cachefs.  Set BUILD_TOOLS to pull everything from one location.
204eb8f03cdSGarrett D'Amore# Alternately, you can set ONBLD_TOOLS to where you keep the contents of
205eb8f03cdSGarrett D'Amore# SUNWonbld and SPRO_ROOT to where you keep the compilers.  SPRO_VROOT
206eb8f03cdSGarrett D'Amore# exists to make it easier to test new versions of the compiler.
207d7693b08SRoland Mainzexport BUILD_TOOLS='/opt'
208d7693b08SRoland Mainz#export ONBLD_TOOLS='/opt/onbld'
209d7693b08SRoland Mainzexport SPRO_ROOT='/opt/SUNWspro'
210d7693b08SRoland Mainzexport SPRO_VROOT="$SPRO_ROOT"
211eb8f03cdSGarrett D'Amore
212eb8f03cdSGarrett D'Amore# This goes along with lint - it is a series of the form "A [y|n]" which
213eb8f03cdSGarrett D'Amore# means "go to directory A and run 'make lint'" Then mail me (y) the
214eb8f03cdSGarrett D'Amore# difference in the lint output. 'y' should only be used if the area you're
215eb8f03cdSGarrett D'Amore# linting is actually lint clean or you'll get lots of mail.
216eb8f03cdSGarrett D'Amore# You shouldn't need to change this though.
217d7693b08SRoland Mainz#export LINTDIRS="$SRC y"
218eb8f03cdSGarrett D'Amore
219eb8f03cdSGarrett D'Amore# Set this flag to 'n' to disable the use of 'checkpaths'.  The default,
220eb8f03cdSGarrett D'Amore# if the 'N' option is not specified, is to run this test.
221d7693b08SRoland Mainz#CHECK_PATHS='y'
222eb8f03cdSGarrett D'Amore
223eb8f03cdSGarrett D'Amore# POST_NIGHTLY can be any command to be run at the end of nightly.  See
224eb8f03cdSGarrett D'Amore# nightly(1) for interactions between environment variables and this command.
225eb8f03cdSGarrett D'Amore#POST_NIGHTLY=
22686d7016bSGordon Ross
227*14c3be39SGordon Ross# Comment this out to disable support for IPP printing, i.e. if you
228*14c3be39SGordon Ross# don't want to bother providing the Apache headers this needs.
229*14c3be39SGordon Rossexport ENABLE_IPP_PRINTING=
230*14c3be39SGordon Ross
231*14c3be39SGordon Ross# Comment this out to disable support for SMB printing, i.e. if you
232*14c3be39SGordon Ross# don't want to bother providing the CUPS headers this needs.
233*14c3be39SGordon Rossexport ENABLE_SMB_PRINTING=
2341f2ca518SDan McDonald
2351f2ca518SDan McDonald# If your distro uses certain versions of Perl, make sure either Makefile.master
2361f2ca518SDan McDonald# contains your new defaults OR your .env file sets them.
2371f2ca518SDan McDonald# These are how you would override for building on OmniOS r151012, for example.
2381f2ca518SDan McDonald#export PERL_VERSION=5.16.1
2391f2ca518SDan McDonald#export PERL_ARCH=i86pc-solaris-thread-multi-64int
2401f2ca518SDan McDonald#export PERL_PKGVERS=-5161
241