xref: /titanic_52/usr/src/tools/env/illumos.sh (revision 4d40e39c66a331aefef24083480939f0e78a9045)
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 2015 Nexenta Systems, Inc.  All rights reserved.
23# Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
24# Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
25# Copyright 2016 RackTop Systems.
26# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
27# Copyright 2020 Joyent, Inc.
28#
29
30# Configuration variables for the runtime environment of the nightly
31# build script and other tools for construction and packaging of
32# releases.
33# This example is suitable for building an illumos workspace, which
34# will contain the resulting archives. It is based off the onnv
35# release. It sets NIGHTLY_OPTIONS to make nightly do:
36#       DEBUG build only (-D, -F)
37#       do not bringover from the parent (-n)
38#       runs 'make check' (-C)
39#       checks for new interfaces in libraries (-A)
40#       runs lint in usr/src (-l plus the LINTDIRS variable)
41#       sends mail on completion (-m and the MAILTO variable)
42#       creates packages for PIT/RE (-p)
43#       checks for changes in ELF runpaths (-r)
44#       build and use this workspace's tools in $SRC/tools (-t)
45#
46# - This file is sourced by "bldenv" and "nightly" and should not
47#   be executed directly.
48# - This script is only interpreted by ksh93 and explicitly allows the
49#   use of ksh93 language extensions.
50#
51export NIGHTLY_OPTIONS='-FnCDAlmprt'
52
53# CODEMGR_WS - where is your workspace at
54#export CODEMGR_WS="$HOME/ws/illumos-gate"
55export CODEMGR_WS="`git rev-parse --show-toplevel`"
56
57# Maximum number of dmake jobs.  The recommended number is 2 + NCPUS,
58# where NCPUS is the number of logical CPUs on your build system.
59function maxjobs
60{
61	nameref maxjobs=$1
62	integer ncpu
63	integer -r min_mem_per_job=512 # minimum amount of memory for a job
64
65	ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
66	(( maxjobs=ncpu + 2 ))
67
68	# Throttle number of parallel jobs launched by dmake to a value which
69	# gurantees that all jobs have enough memory. This was added to avoid
70	# excessive paging/swapping in cases of virtual machine installations
71	# which have lots of CPUs but not enough memory assigned to handle
72	# that many parallel jobs
73	if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
74		integer max_jobs_per_memory # parallel jobs which fit into physical memory
75		integer physical_memory # physical memory installed
76
77		# The array ".sh.match" contains the contents of capturing
78		# brackets in the last regex, .sh.match[1] will contain
79		# the value matched by ([[:digit:]]+), i.e. the amount of
80		# memory installed
81		physical_memory="10#${.sh.match[1]}"
82
83		((
84			max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
85			maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
86		))
87	fi
88
89	return 0
90}
91
92maxjobs DMAKE_MAX_JOBS # "DMAKE_MAX_JOBS" passed as ksh(1) name reference
93export DMAKE_MAX_JOBS
94
95# path to onbld tool binaries
96ONBLD_BIN='/opt/onbld/bin'
97
98# PARENT_WS is used to determine the parent of this workspace. This is
99# for the options that deal with the parent workspace (such as where the
100# proto area will go).
101export PARENT_WS=''
102
103# CLONE_WS is the workspace nightly should do a bringover from.
104export CLONE_WS='ssh://anonhg@hg.illumos.org/illumos-gate'
105
106# The bringover, if any, is done as STAFFER.
107# Set STAFFER to your own login as gatekeeper or developer
108# The point is to use group "staff" and avoid referencing the parent
109# workspace as root.
110# Some scripts optionally send mail messages to MAILTO.
111#
112export STAFFER="$LOGNAME"
113export MAILTO="$STAFFER"
114
115# If you wish the mail messages to be From: an arbitrary address, export
116# MAILFROM.
117#export MAILFROM="user@example.com"
118
119# The project (see project(4)) under which to run this build.  If not
120# specified, the build is simply run in a new task in the current project.
121export BUILD_PROJECT=''
122
123# You should not need to change the next three lines
124export ATLOG="$CODEMGR_WS/log"
125export LOGFILE="$ATLOG/nightly.log"
126export MACH="$(uname -p)"
127
128#
129#  The following macro points to the closed binaries.  Once illumos has
130#  totally freed itself, we can remove this reference.
131#
132# Location of encumbered binaries.
133export ON_CLOSED_BINS="$CODEMGR_WS/closed"
134
135# REF_PROTO_LIST - for comparing the list of stuff in your proto area
136# with. Generally this should be left alone, since you want to see differences
137# from your parent (the gate).
138#
139export REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH}"
140
141
142export ROOT="$CODEMGR_WS/proto/root_${MACH}"
143export SRC="$CODEMGR_WS/usr/src"
144export MULTI_PROTO="no"
145
146#
147#	build environment variables, including version info for mcs, motd,
148# motd, uname and boot messages. Mostly you shouldn't change this except
149# when the release slips (nah) or you move an environment file to a new
150# release
151#
152export VERSION="`git describe --long --all HEAD | cut -d/ -f2-`"
153
154#
155# the RELEASE and RELEASE_DATE variables are set in Makefile.master;
156# there might be special reasons to override them here, but that
157# should not be the case in general
158#
159# export RELEASE='5.11'
160# export RELEASE_DATE='October 2007'
161
162# proto area in parent for optionally depositing a copy of headers and
163# libraries corresponding to the protolibs target
164# not applicable given the NIGHTLY_OPTIONS
165#
166export PARENT_ROOT="$PARENT_WS/proto/root_$MACH"
167export PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd"
168
169# Package creation variables.  You probably shouldn't change these,
170# either.
171#
172# PKGARCHIVE determines where the repository will be created.
173#
174# PKGPUBLISHER_REDIST controls the publisher setting for the repository.
175#
176export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
177# export PKGPUBLISHER_REDIST='on-redist'
178
179# Package manifest format version.
180export PKGFMT_OUTPUT='v1'
181
182# we want make to do as much as it can, just in case there's more than
183# one problem.
184export MAKEFLAGS='k'
185
186# Magic variable to prevent the devpro compilers/teamware from sending
187# mail back to devpro on every use.
188export UT_NO_USAGE_TRACKING='1'
189
190# Build tools - don't change these unless you know what you're doing.  These
191# variables allows you to get the compilers and onbld files locally.
192# Set BUILD_TOOLS to pull everything from one location.
193# Alternately, you can set ONBLD_TOOLS to where you keep the contents of
194# SUNWonbld and SPRO_ROOT to where you keep the compilers.  SPRO_VROOT
195# exists to make it easier to test new versions of the compiler.
196export BUILD_TOOLS='/opt'
197#export ONBLD_TOOLS='/opt/onbld'
198export SPRO_ROOT='/opt/SUNWspro'
199export SPRO_VROOT="$SPRO_ROOT"
200
201# Disable shadow compilation by default.
202export CW_NO_SHADOW='1'
203
204# This goes along with lint - it is a series of the form "A [y|n]" which
205# means "go to directory A and run 'make lint'" Then mail me (y) the
206# difference in the lint output. 'y' should only be used if the area you're
207# linting is actually lint clean or you'll get lots of mail.
208# You shouldn't need to change this though.
209#export LINTDIRS="$SRC y"
210
211# Set this flag to 'n' to disable the use of 'checkpaths'.  The default,
212# if the 'N' option is not specified, is to run this test.
213#CHECK_PATHS='y'
214
215# POST_NIGHTLY can be any command to be run at the end of nightly.  See
216# nightly(1) for interactions between environment variables and this command.
217#POST_NIGHTLY=
218
219# Comment this out to disable support for SMB printing, i.e. if you
220# don't want to bother providing the CUPS headers this needs.
221export ENABLE_SMB_PRINTING=
222
223# If your distro uses certain versions of Perl, make sure either Makefile.master
224# contains your new defaults OR your .env file sets them.
225# These are how you would override for building on OmniOS r151028, for example.
226#export PERL_VERSION=5.28
227#export PERL_VARIANT=-thread-multi
228#export PERL_PKGVERS=
229
230# To disable building of the 32-bit or 64-bit perl modules (or both),
231# uncomment these lines:
232#export BUILDPERL32='#'
233#export BUILDPERL64='#'
234
235# If your distro uses certain versions of Python, make sure either
236# Makefile.master contains your new defaults OR your .env file sets them.
237#export PYTHON_VERSION=2.7
238#export PYTHON_PKGVERS=-27
239#export PYTHON_SUFFIX=
240#export PYTHON3_VERSION=3.5
241#export PYTHON3_PKGVERS=-35
242#export PYTHON3_SUFFIX=m
243
244# To disable building with either Python2 or Python 3 (or both), uncomment
245# these lines:
246#export BUILDPY2='#'
247#export BUILDPY3='#'
248
249# To disable building this workspace's tools in $SRC/tools with either Python2
250# or Python3 (but not both!), uncomment either of these lines:
251#export BUILDPY2TOOLS='#'
252#export BUILDPY3TOOLS='#'
253