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