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