Merge commit 'e8921a52c53ee69f7b65f054d9b2e886139daa59'
[unleashed.git] / tools / env.sh
blob5d65210a377ad65f4d79c4d1acf7898ae06a57e7
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
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.
27 # Configuration variables for the runtime environment of the nightly
28 # build script and other tools for construction and packaging of
29 # releases.
30 # This example is suitable for building an illumos workspace, which
31 # will contain the resulting archives. It is based off the onnv
32 # release. It sets NIGHTLY_OPTIONS to make nightly do:
33 # DEBUG build instead of non-DEBUG (-D)
34 # runs 'make check' (-C)
35 # checks for new interfaces in libraries (-A)
36 # sends mail on completion (-m and the MAILTO variable)
37 # creates packages for PIT/RE (-p)
38 # checks for changes in ELF runpaths (-r)
40 # - This file is sourced by "bldenv.sh" and "nightly.sh" and should not
41 # be executed directly.
42 # - This script is only interpreted by ksh93 and explicitly allows the
43 # use of ksh93 language extensions.
45 export NIGHTLY_OPTIONS='-CAmpr'
47 # SRCTOP - where is your workspace at
48 #export SRCTOP="$HOME/ws/illumos-gate"
49 export SRCTOP="`git rev-parse --show-toplevel`"
51 # Maximum number of dmake jobs. The recommended number is 2 + NCPUS,
52 # where NCPUS is the number of logical CPUs on your build system.
53 maxjobs()
55 njobs=1
56 min_mem_per_job=512 # minimum amount of memory for a job
58 ncpu=$(/usr/bin/getconf 'NPROCESSORS_ONLN')
59 njobs=$(( ncpu + 2 ))
61 # Throttle number of parallel jobs launched by dmake to a value which
62 # gurantees that all jobs have enough memory. This was added to avoid
63 # excessive paging/swapping in cases of virtual machine installations
64 # which have lots of CPUs but not enough memory assigned to handle
65 # that many parallel jobs
66 /usr/sbin/prtconf 2>/dev/null | awk "BEGIN { mem_per_job = $min_mem_per_job; njobs = $njobs; } "'
67 /^Memory size: .* Megabytes/ {
68 mem = $3;
69 njobs_mem = int(mem/mem_per_job);
70 if (njobs < njobs_mem) print(njobs);
71 else print(njobs_mem);
75 export DMAKE_MAX_JOBS=$(maxjobs)
77 # Some scripts optionally send mail messages to MAILTO.
78 export MAILTO="$LOGNAME"
80 # The project (see project(4)) under which to run this build. If not
81 # specified, the build is simply run in a new task in the current project.
82 export BUILD_PROJECT=''
84 # You should not need to change the next three lines
85 export ATLOG="$SRCTOP/log"
86 export LOGFILE="$ATLOG/nightly.log"
87 export MACH="$(uname -p)"
88 if [ "$MACH" = "amd64" ]; then
89 MACH=i386
92 export ROOT="$SRCTOP/proto/root_${MACH}"
93 export SRC="$SRCTOP/usr/src"
96 # build environment variables, including version info for mcs, motd,
97 # motd, uname and boot messages. Mostly you shouldn't change this except
98 # when the release slips (nah) or you move an environment file to a new
99 # release
101 export VERSION="`git describe --dirty`"
103 # Package creation variables. You probably shouldn't change these,
104 # either.
106 # PKGARCHIVE determines where the repository will be created.
108 # PKGPUBLISHER controls the publisher setting for the repository.
110 export PKGARCHIVE="${SRCTOP}/packages/${MACH}/nightly"
111 #export PKGPUBLISHER='unleashed'
113 # Package manifest format version.
114 export PKGFMT_OUTPUT='v1'
116 # Set this flag to 'n' to disable the use of 'checkpaths'. The default,
117 # if the 'N' option is not specified, is to run this test.
118 #CHECK_PATHS='y'
120 # POST_NIGHTLY can be any command to be run at the end of nightly. See
121 # nightly(1) for interactions between environment variables and this command.
122 #POST_NIGHTLY=
124 # Don't build python 3 versions of libs.
125 export BUILDPY3='#'