xref: /titanic_50/usr/src/tools/env/illumos.sh (revision 6b72f1c00ce6f09bcb01b7a635dcc38bf9b3ed2b)
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.
22bd93c05dSAlexander Eremin# Copyright 2015 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.
25d2359abfSAndrew Stormont# Copyright 2016 RackTop Systems.
268cfa78e6SAndy Fiddaman# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
27*6b72f1c0SJohn Levon# Copyright 2020 Joyent, Inc.
28eb8f03cdSGarrett D'Amore#
29eb8f03cdSGarrett D'Amore
30eb8f03cdSGarrett D'Amore# Configuration variables for the runtime environment of the nightly
31d7693b08SRoland Mainz# build script and other tools for construction and packaging of
32d7693b08SRoland Mainz# releases.
33d7693b08SRoland Mainz# This example is suitable for building an illumos workspace, which
34d7693b08SRoland Mainz# will contain the resulting archives. It is based off the onnv
35d7693b08SRoland Mainz# release. It sets NIGHTLY_OPTIONS to make nightly do:
36eb8f03cdSGarrett D'Amore#       DEBUG build only (-D, -F)
37eb8f03cdSGarrett D'Amore#       do not bringover from the parent (-n)
38eb8f03cdSGarrett D'Amore#       runs 'make check' (-C)
392c2a4b29SRichard Lowe#       checks for new interfaces in libraries (-A)
40eb8f03cdSGarrett D'Amore#       runs lint in usr/src (-l plus the LINTDIRS variable)
41eb8f03cdSGarrett D'Amore#       sends mail on completion (-m and the MAILTO variable)
42eb8f03cdSGarrett D'Amore#       creates packages for PIT/RE (-p)
43eb8f03cdSGarrett D'Amore#       checks for changes in ELF runpaths (-r)
44eb8f03cdSGarrett D'Amore#       build and use this workspace's tools in $SRC/tools (-t)
45eb8f03cdSGarrett D'Amore#
46*6b72f1c0SJohn Levon# - This file is sourced by "bldenv" and "nightly" and should not
47d7693b08SRoland Mainz#   be executed directly.
48d7693b08SRoland Mainz# - This script is only interpreted by ksh93 and explicitly allows the
49d7693b08SRoland Mainz#   use of ksh93 language extensions.
50d7693b08SRoland Mainz#
512c2a4b29SRichard Loweexport NIGHTLY_OPTIONS='-FnCDAlmprt'
52d7693b08SRoland Mainz
5338e64a37SJosef 'Jeff' Sipek# CODEMGR_WS - where is your workspace at
5438e64a37SJosef 'Jeff' Sipek#export CODEMGR_WS="$HOME/ws/illumos-gate"
5538e64a37SJosef 'Jeff' Sipekexport CODEMGR_WS="`git rev-parse --show-toplevel`"
56eb8f03cdSGarrett D'Amore
57d43a4e79SJeppe Toustrup# Maximum number of dmake jobs.  The recommended number is 2 + NCPUS,
58d43a4e79SJeppe Toustrup# where NCPUS is the number of logical CPUs on your build system.
59d7693b08SRoland Mainzfunction maxjobs
60d7693b08SRoland Mainz{
61d7693b08SRoland Mainz	nameref maxjobs=$1
62d7693b08SRoland Mainz	integer ncpu
63d7693b08SRoland Mainz	integer -r min_mem_per_job=512 # minimum amount of memory for a job
64d7693b08SRoland Mainz
65d7693b08SRoland Mainz	ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
66d7693b08SRoland Mainz	(( maxjobs=ncpu + 2 ))
67d7693b08SRoland Mainz
68d7693b08SRoland Mainz	# Throttle number of parallel jobs launched by dmake to a value which
69d7693b08SRoland Mainz	# gurantees that all jobs have enough memory. This was added to avoid
70d7693b08SRoland Mainz	# excessive paging/swapping in cases of virtual machine installations
71d7693b08SRoland Mainz	# which have lots of CPUs but not enough memory assigned to handle
72d7693b08SRoland Mainz	# that many parallel jobs
73d7693b08SRoland Mainz	if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
74d7693b08SRoland Mainz		integer max_jobs_per_memory # parallel jobs which fit into physical memory
75d7693b08SRoland Mainz		integer physical_memory # physical memory installed
76d7693b08SRoland Mainz
77d7693b08SRoland Mainz		# The array ".sh.match" contains the contents of capturing
78d7693b08SRoland Mainz		# brackets in the last regex, .sh.match[1] will contain
79d7693b08SRoland Mainz		# the value matched by ([[:digit:]]+), i.e. the amount of
80d7693b08SRoland Mainz		# memory installed
81d7693b08SRoland Mainz		physical_memory="10#${.sh.match[1]}"
82d7693b08SRoland Mainz
83d7693b08SRoland Mainz		((
84d7693b08SRoland Mainz			max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
85d7693b08SRoland Mainz			maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
86d7693b08SRoland Mainz		))
87d7693b08SRoland Mainz	fi
88d7693b08SRoland Mainz
89d7693b08SRoland Mainz	return 0
90eb8f03cdSGarrett D'Amore}
91d7693b08SRoland Mainz
92d7693b08SRoland Mainzmaxjobs DMAKE_MAX_JOBS # "DMAKE_MAX_JOBS" passed as ksh(1) name reference
93d7693b08SRoland Mainzexport DMAKE_MAX_JOBS
94eb8f03cdSGarrett D'Amore
95eb8f03cdSGarrett D'Amore# path to onbld tool binaries
96d7693b08SRoland MainzONBLD_BIN='/opt/onbld/bin'
97eb8f03cdSGarrett D'Amore
98eb8f03cdSGarrett D'Amore# PARENT_WS is used to determine the parent of this workspace. This is
99eb8f03cdSGarrett D'Amore# for the options that deal with the parent workspace (such as where the
100eb8f03cdSGarrett D'Amore# proto area will go).
101d7693b08SRoland Mainzexport PARENT_WS=''
102eb8f03cdSGarrett D'Amore
103eb8f03cdSGarrett D'Amore# CLONE_WS is the workspace nightly should do a bringover from.
104d7693b08SRoland Mainzexport CLONE_WS='ssh://anonhg@hg.illumos.org/illumos-gate'
105eb8f03cdSGarrett D'Amore
106eb8f03cdSGarrett D'Amore# The bringover, if any, is done as STAFFER.
107eb8f03cdSGarrett D'Amore# Set STAFFER to your own login as gatekeeper or developer
108eb8f03cdSGarrett D'Amore# The point is to use group "staff" and avoid referencing the parent
109eb8f03cdSGarrett D'Amore# workspace as root.
110eb8f03cdSGarrett D'Amore# Some scripts optionally send mail messages to MAILTO.
111eb8f03cdSGarrett D'Amore#
112d7693b08SRoland Mainzexport STAFFER="$LOGNAME"
113d7693b08SRoland Mainzexport MAILTO="$STAFFER"
114eb8f03cdSGarrett D'Amore
1153cb00cf1SJoshua M. Clulow# If you wish the mail messages to be From: an arbitrary address, export
1163cb00cf1SJoshua M. Clulow# MAILFROM.
1173cb00cf1SJoshua M. Clulow#export MAILFROM="user@example.com"
1183cb00cf1SJoshua M. Clulow
119eb8f03cdSGarrett D'Amore# The project (see project(4)) under which to run this build.  If not
120eb8f03cdSGarrett D'Amore# specified, the build is simply run in a new task in the current project.
121d7693b08SRoland Mainzexport BUILD_PROJECT=''
122eb8f03cdSGarrett D'Amore
12360a61f7aSJosef 'Jeff' Sipek# You should not need to change the next three lines
124d7693b08SRoland Mainzexport ATLOG="$CODEMGR_WS/log"
125d7693b08SRoland Mainzexport LOGFILE="$ATLOG/nightly.log"
126d7693b08SRoland Mainzexport MACH="$(uname -p)"
127eb8f03cdSGarrett D'Amore
128081d8c97SJeppe Toustrup#
1291a49874bSJosef 'Jeff' Sipek#  The following macro points to the closed binaries.  Once illumos has
1301a49874bSJosef 'Jeff' Sipek#  totally freed itself, we can remove this reference.
131081d8c97SJeppe Toustrup#
132081d8c97SJeppe Toustrup# Location of encumbered binaries.
133d7693b08SRoland Mainzexport ON_CLOSED_BINS="$CODEMGR_WS/closed"
134081d8c97SJeppe Toustrup
135eb8f03cdSGarrett D'Amore# REF_PROTO_LIST - for comparing the list of stuff in your proto area
136eb8f03cdSGarrett D'Amore# with. Generally this should be left alone, since you want to see differences
137eb8f03cdSGarrett D'Amore# from your parent (the gate).
138eb8f03cdSGarrett D'Amore#
139d7693b08SRoland Mainzexport REF_PROTO_LIST="$PARENT_WS/usr/src/proto_list_${MACH}"
140eb8f03cdSGarrett D'Amore
14186dc0e00SRichard Lowe
14286dc0e00SRichard Loweexport ROOT="$CODEMGR_WS/proto/root_${MACH}"
14386dc0e00SRichard Loweexport SRC="$CODEMGR_WS/usr/src"
14486dc0e00SRichard Loweexport MULTI_PROTO="no"
14586dc0e00SRichard Lowe
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#
15238e64a37SJosef 'Jeff' Sipekexport VERSION="`git describe --long --all HEAD | cut -d/ -f2-`"
153eb8f03cdSGarrett D'Amore
154eb8f03cdSGarrett D'Amore#
155eb8f03cdSGarrett D'Amore# the RELEASE and RELEASE_DATE variables are set in Makefile.master;
156eb8f03cdSGarrett D'Amore# there might be special reasons to override them here, but that
157eb8f03cdSGarrett D'Amore# should not be the case in general
158eb8f03cdSGarrett D'Amore#
159d7693b08SRoland Mainz# export RELEASE='5.11'
160d7693b08SRoland Mainz# export RELEASE_DATE='October 2007'
161eb8f03cdSGarrett D'Amore
162eb8f03cdSGarrett D'Amore# proto area in parent for optionally depositing a copy of headers and
163eb8f03cdSGarrett D'Amore# libraries corresponding to the protolibs target
164eb8f03cdSGarrett D'Amore# not applicable given the NIGHTLY_OPTIONS
165eb8f03cdSGarrett D'Amore#
166d7693b08SRoland Mainzexport PARENT_ROOT="$PARENT_WS/proto/root_$MACH"
167d7693b08SRoland Mainzexport PARENT_TOOLS_ROOT="$PARENT_WS/usr/src/tools/proto/root_$MACH-nd"
168eb8f03cdSGarrett D'Amore
169eb8f03cdSGarrett D'Amore# Package creation variables.  You probably shouldn't change these,
170eb8f03cdSGarrett D'Amore# either.
171eb8f03cdSGarrett D'Amore#
172eb8f03cdSGarrett D'Amore# PKGARCHIVE determines where the repository will be created.
173eb8f03cdSGarrett D'Amore#
174eb8f03cdSGarrett D'Amore# PKGPUBLISHER_REDIST controls the publisher setting for the repository.
175eb8f03cdSGarrett D'Amore#
176d7693b08SRoland Mainzexport PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
177d7693b08SRoland Mainz# export PKGPUBLISHER_REDIST='on-redist'
178eb8f03cdSGarrett D'Amore
179efcb7078SYuri Pankov# Package manifest format version.
180efcb7078SYuri Pankovexport PKGFMT_OUTPUT='v1'
181efcb7078SYuri Pankov
182eb8f03cdSGarrett D'Amore# we want make to do as much as it can, just in case there's more than
183eb8f03cdSGarrett D'Amore# one problem.
184d7693b08SRoland Mainzexport MAKEFLAGS='k'
185eb8f03cdSGarrett D'Amore
186eb8f03cdSGarrett D'Amore# Magic variable to prevent the devpro compilers/teamware from sending
187eb8f03cdSGarrett D'Amore# mail back to devpro on every use.
188d7693b08SRoland Mainzexport UT_NO_USAGE_TRACKING='1'
189eb8f03cdSGarrett D'Amore
190eb8f03cdSGarrett D'Amore# Build tools - don't change these unless you know what you're doing.  These
191bd93c05dSAlexander Eremin# variables allows you to get the compilers and onbld files locally.
192bd93c05dSAlexander Eremin# Set BUILD_TOOLS to pull everything from one location.
193eb8f03cdSGarrett D'Amore# Alternately, you can set ONBLD_TOOLS to where you keep the contents of
194eb8f03cdSGarrett D'Amore# SUNWonbld and SPRO_ROOT to where you keep the compilers.  SPRO_VROOT
195eb8f03cdSGarrett D'Amore# exists to make it easier to test new versions of the compiler.
196d7693b08SRoland Mainzexport BUILD_TOOLS='/opt'
197d7693b08SRoland Mainz#export ONBLD_TOOLS='/opt/onbld'
198d7693b08SRoland Mainzexport SPRO_ROOT='/opt/SUNWspro'
199d7693b08SRoland Mainzexport SPRO_VROOT="$SPRO_ROOT"
200eb8f03cdSGarrett D'Amore
201dac4b50eSJosef 'Jeff' Sipek# Disable shadow compilation by default.
202dac4b50eSJosef 'Jeff' Sipekexport CW_NO_SHADOW='1'
203dac4b50eSJosef 'Jeff' Sipek
204eb8f03cdSGarrett D'Amore# This goes along with lint - it is a series of the form "A [y|n]" which
205eb8f03cdSGarrett D'Amore# means "go to directory A and run 'make lint'" Then mail me (y) the
206eb8f03cdSGarrett D'Amore# difference in the lint output. 'y' should only be used if the area you're
207eb8f03cdSGarrett D'Amore# linting is actually lint clean or you'll get lots of mail.
208eb8f03cdSGarrett D'Amore# You shouldn't need to change this though.
209d7693b08SRoland Mainz#export LINTDIRS="$SRC 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.
213d7693b08SRoland 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=
21886d7016bSGordon Ross
21914c3be39SGordon Ross# Comment this out to disable support for SMB printing, i.e. if you
22014c3be39SGordon Ross# don't want to bother providing the CUPS headers this needs.
22114c3be39SGordon Rossexport ENABLE_SMB_PRINTING=
2221f2ca518SDan McDonald
2231f2ca518SDan McDonald# If your distro uses certain versions of Perl, make sure either Makefile.master
2241f2ca518SDan McDonald# contains your new defaults OR your .env file sets them.
2258cfa78e6SAndy Fiddaman# These are how you would override for building on OmniOS r151028, for example.
2268cfa78e6SAndy Fiddaman#export PERL_VERSION=5.28
227d2359abfSAndrew Stormont#export PERL_VARIANT=-thread-multi
2288cfa78e6SAndy Fiddaman#export PERL_PKGVERS=
2298cfa78e6SAndy Fiddaman
230d2359abfSAndrew Stormont# To disable building of the 32-bit or 64-bit perl modules (or both),
231d2359abfSAndrew Stormont# uncomment these lines:
232d2359abfSAndrew Stormont#export BUILDPERL32='#'
233d2359abfSAndrew Stormont#export BUILDPERL64='#'
234d2359abfSAndrew Stormont
2358cfa78e6SAndy Fiddaman# If your distro uses certain versions of Python, make sure either
2368cfa78e6SAndy Fiddaman# Makefile.master contains your new defaults OR your .env file sets them.
2378cfa78e6SAndy Fiddaman#export PYTHON_VERSION=2.7
2388cfa78e6SAndy Fiddaman#export PYTHON_PKGVERS=-27
2398cfa78e6SAndy Fiddaman#export PYTHON_SUFFIX=
2408cfa78e6SAndy Fiddaman#export PYTHON3_VERSION=3.5
2418cfa78e6SAndy Fiddaman#export PYTHON3_PKGVERS=-35
2428cfa78e6SAndy Fiddaman#export PYTHON3_SUFFIX=m
2438cfa78e6SAndy Fiddaman
2448cfa78e6SAndy Fiddaman# To disable building with either Python2 or Python 3 (or both), uncomment
2458cfa78e6SAndy Fiddaman# these lines:
2468cfa78e6SAndy Fiddaman#export BUILDPY2='#'
2478cfa78e6SAndy Fiddaman#export BUILDPY3='#'
24862cdef2bSHans Rosenfeld
24962cdef2bSHans Rosenfeld# To disable building this workspace's tools in $SRC/tools with either Python2
25062cdef2bSHans Rosenfeld# or Python3 (but not both!), uncomment either of these lines:
25162cdef2bSHans Rosenfeld#export BUILDPY2TOOLS='#'
25262cdef2bSHans Rosenfeld#export BUILDPY3TOOLS='#'
253