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