0
|
1 #!/bin/ksh -p
|
|
2 #
|
|
3 # CDDL HEADER START
|
|
4 #
|
|
5 # The contents of this file are subject to the terms of the
|
|
6 # Common Development and Distribution License (the "License").
|
|
7 # You may not use this file except in compliance with the License.
|
|
8 #
|
|
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
10 # or http://www.opensolaris.org/os/licensing.
|
|
11 # See the License for the specific language governing permissions
|
|
12 # and limitations under the License.
|
|
13 #
|
|
14 # When distributing Covered Code, include this CDDL HEADER in each
|
|
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
16 # If applicable, add the following below this CDDL HEADER, with the
|
|
17 # fields enclosed by brackets "[]" replaced with your own identifying
|
|
18 # information: Portions Copyright [yyyy] [name of copyright owner]
|
|
19 #
|
|
20 # CDDL HEADER END
|
|
21 #
|
|
22 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
|
|
23 # Use is subject to license terms.
|
|
24 #
|
|
25 #ident "@(#)opensolaris.sh 1.8 08/02/07 SMI"
|
|
26 #
|
|
27
|
|
28 #
|
|
29 # Copyright (c) 2006-2009 NEC Corporation
|
|
30 #
|
|
31
|
|
32 ##
|
|
33 ## Create runtime configuration file of the build tools.
|
|
34 ##
|
|
35
|
|
36 CAT=/bin/cat
|
|
37 PWD=/bin/pwd
|
|
38 WHO=/bin/who
|
|
39 UNAME=/bin/uname
|
|
40 BASENAME=/bin/basename
|
|
41 DIRNAME=/bin/dirname
|
|
42 AWK=/bin/awk
|
|
43
|
|
44 arm_COMPILER_TARGET=${arm_COMPILER_TARGET:-arm-pc-solaris2.11}
|
|
45 arm_COMPILER_PREFIX=${arm_COMPILER_PREFIX:-/opt/arm-eabi}
|
|
46 arm_COMPILER_ROOT=${arm_COMPILER_ROOT:-${arm_COMPILER_PREFIX}/${arm_COMPILER_TARGET}}
|
|
47 arm_DEFAULT_SYSROOT=${arm_DEFAULT_SYSROOT:-${arm_COMPILER_PREFIX}/root}
|
|
48
|
|
49 # Specify platform for ARM explicitly.
|
|
50 ARM_PLATFORM=${ARM_PLATFORM:-ne1}
|
|
51
|
|
52 get_workspace_root()
|
|
53 {
|
|
54 dir=`$PWD`
|
|
55 while [ ! -d $dir/usr -o ! -d $dir/usr/src -o \
|
|
56 ! -f $dir/README.opensolaris ]; do
|
|
57 if [ $dir = "/" ]; then
|
|
58 echo "Can't detect workspace path." >&2
|
|
59 exit 1
|
|
60 fi
|
|
61 dir=`$DIRNAME $dir`
|
|
62 done
|
|
63 workspace=$dir
|
|
64 }
|
|
65
|
|
66
|
|
67 dump_config()
|
|
68 {
|
|
69 ws=$1
|
|
70 staffer=$2
|
|
71 mach=$3
|
|
72
|
|
73 gate=`$BASENAME $ws`
|
|
74 native_mach=`$UNAME -p`
|
|
75
|
|
76 cross=`eval echo '$'"${mach}"_COMPILER_ROOT`
|
|
77 target=
|
|
78 xtarget=
|
|
79 xprefix=
|
|
80 xtool_prefix=
|
|
81 xsysroot=
|
|
82 if [ "$cross" != "" ]; then
|
|
83 # Use cross compiler
|
|
84 cross="GNU_ROOT=${cross}; export GNU_ROOT"
|
|
85 prefix=`eval echo '$'"${mach}"_COMPILER_PREFIX`
|
|
86 xprefix="GNU_PREFIX=${prefix}; export GNU_PREFIX"
|
|
87 xld_prefix="LD_PREFIX=${prefix}; export LD_PREFIX"
|
|
88
|
|
89 target=`eval echo '$'"${mach}"_COMPILER_TARGET`
|
|
90 xtarget="GNU_TOOL_TARGET=${target}; export GNU_TOOL_TARGET"
|
|
91 xtool_prefix="GNU_TOOL_PREFIX=${target}-; export GNU_TOOL_PREFIX"
|
|
92 sysroot=`eval echo '$'"${mach}"_DEFAULT_SYSROOT`
|
|
93 xsysroot="DEFAULT_SYSROOT=${sysroot}; export DEFAULT_SYSROOT"
|
|
94 fi
|
|
95
|
|
96 fname="opensolaris-${mach}.sh"
|
|
97 $CAT > $fname <<EOF
|
|
98
|
|
99 #
|
|
100 # Configuration variables for the runtime environment of the nightly
|
|
101 # build script and other tools for construction and packaging of releases.
|
|
102 # This script is sourced by 'nightly' and 'bldenv' to set up the environment
|
|
103 # for the build. This example is suitable for building an OpenSolaris
|
|
104 # workspace, which will contain the resulting archives. It is based
|
|
105 # off the onnv release. It sets NIGHTLY_OPTIONS to make nightly do:
|
|
106 # DEBUG build only (-D, -F)
|
|
107 # do not run protocmp or checkpaths (-N)
|
|
108 # do not bringover from the parent (-n)
|
|
109 # creates cpio archives for bfu (-a)
|
|
110 # runs 'make check' (-C)
|
|
111 # runs lint in usr/src (-l plus the LINTDIRS variable)
|
|
112 # sends mail on completion (-m and the MAILTO variable)
|
|
113 # checks for changes in ELF runpaths (-r)
|
|
114 # build and use this workspace's tools in \$SRC/tools (-t)
|
|
115 #
|
|
116 #NIGHTLY_OPTIONS="-FNnaCDlmrt"; export NIGHTLY_OPTIONS
|
|
117 NIGHTLY_OPTIONS="-FNnDt"; export NIGHTLY_OPTIONS
|
|
118
|
|
119 # This is a variable for the rest of the script - GATE doesn't matter to
|
|
120 # nightly itself
|
|
121 GATE=$gate; export GATE
|
|
122
|
|
123 # CODEMGR_WS - where is your workspace at (or what should nightly name it)
|
|
124 CODEMGR_WS="$ws"; export CODEMGR_WS
|
|
125
|
|
126 # Location of encumbered binaries.
|
|
127 ON_CLOSED_BINS="\$CODEMGR_WS/closed"; export ON_CLOSED_BINS
|
|
128
|
|
129 # This flag controls whether to build the closed source. If
|
|
130 # undefined, nightly(1) and bldenv(1) will set it according to whether
|
|
131 # the closed source tree is present. CLOSED_IS_PRESENT="no" means not
|
|
132 # building the closed sources.
|
|
133 # CLOSED_IS_PRESENT="no"; export CLOSED_IS_PRESENT
|
|
134
|
|
135 # Maximum number of dmake jobs. The recommended number is 2 + (2 *
|
|
136 # NCPUS), where NCPUS is the number of CPUs on your build system.
|
|
137 maxjobs() {
|
|
138 ncpu=\`/usr/sbin/psrinfo -p\`
|
|
139 expr \$ncpu \* 2 + 2
|
|
140 }
|
|
141 DMAKE_MAX_JOBS=\`maxjobs\`; export DMAKE_MAX_JOBS
|
|
142
|
|
143 # path to onbld tool binaries
|
|
144 ONBLD_BIN="/opt/onbld/bin"
|
|
145
|
|
146 # used by bfu.
|
|
147 FASTFS=\$ONBLD_BIN/${mach}/fastfs; export FASTFS
|
|
148 BFULD=\$ONBLD_BIN/${mach}/bfuld; export BFULD
|
|
149 GZIPBIN=/usr/bin/gzip; export GZIPBIN
|
|
150 ACR=\$ONBLD_BIN/acr; export ACR
|
|
151
|
|
152 # PARENT_WS is used to determine the parent of this workspace. This is
|
|
153 # for the options that deal with the parent workspace (such as where the
|
|
154 # proto area will go).
|
|
155 PARENT_WS=""; export PARENT_WS
|
|
156
|
|
157 # CLONE_WS is the workspace nightly should do a bringover from. Since it's
|
|
158 # going to bringover usr/src, this could take a while, so we use the
|
|
159 # clone instead of the gate (see the gate's README).
|
|
160 CLONE_WS=""; export CLONE_WS
|
|
161
|
|
162 # The bringover, if any, is done as STAFFER.
|
|
163 # Set STAFFER to your own login as gatekeeper or developer
|
|
164 # The point is to use group "staff" and avoid referencing the parent
|
|
165 # workspace as root.
|
|
166 # Some scripts optionally send mail messages to MAILTO.
|
|
167 #
|
|
168 STAFFER=$staffer; export STAFFER
|
|
169 MAILTO=\$STAFFER; export MAILTO
|
|
170
|
|
171 # The project (see project(4)) under which to run this build. If not
|
|
172 # specified, the build is simply run in a new task in the current project.
|
|
173 BUILD_PROJECT=; export BUILD_PROJECT
|
|
174
|
|
175 # You should not need to change the next four lines
|
|
176 LOCKNAME="\`basename \$CODEMGR_WS\`_nightly.lock"; export LOCKNAME
|
|
177 ATLOG="\$CODEMGR_WS/log"; export ATLOG
|
|
178 LOGFILE="\$ATLOG/nightly.log"; export LOGFILE
|
|
179 MACH=$mach; export MACH
|
|
180 NATIVE_MACH=$native_mach; export NATIVE_MACH
|
|
181
|
|
182 # REF_PROTO_LIST - for comparing the list of stuff in your proto area
|
|
183 # with. Generally this should be left alone, since you want to see differences
|
|
184 # from your parent (the gate).
|
|
185 #
|
|
186 REF_PROTO_LIST=\$PARENT_WS/usr/src/proto_list_\${MACH}; export REF_PROTO_LIST
|
|
187
|
|
188 # where cpio archives of the OS are placed. Usually this should be left
|
|
189 # alone too.
|
|
190 CPIODIR="\${CODEMGR_WS}/archives/\${MACH}/nightly"; export CPIODIR
|
|
191
|
|
192 #
|
|
193 # build environment variables, including version info for mcs, motd,
|
|
194 # motd, uname and boot messages. Mostly you shouldn't change this except
|
|
195 # when the release slips (nah) or you move an environment file to a new
|
|
196 # release
|
|
197 #
|
|
198 ROOT="\$CODEMGR_WS/proto/root_\${MACH}"; export ROOT
|
|
199 SRC="\$CODEMGR_WS/usr/src"; export SRC
|
|
200 VERSION="$VERSION"; export VERSION
|
|
201
|
|
202 #
|
|
203 # the RELEASE and RELEASE_DATE variables are set in Makefile.master;
|
|
204 # there might be special reasons to override them here, but that
|
|
205 # should not be the case in general
|
|
206 #
|
|
207 # RELEASE="5.11"; export RELEASE
|
|
208 # RELEASE_DATE="October 2007"; export RELEASE_DATE
|
|
209
|
|
210 # proto area in parent for optionally depositing a copy of headers and
|
|
211 # libraries corresponding to the protolibs target
|
|
212 # not applicable given the NIGHTLY_OPTIONS
|
|
213 #
|
|
214 PARENT_ROOT=\$PARENT_WS/proto/root_\$MACH; export PARENT_ROOT
|
|
215
|
|
216 #
|
|
217 # package creation variable. you probably shouldn't change this either.
|
|
218 #
|
|
219 PKGARCHIVE="\${CODEMGR_WS}/packages/\${MACH}/nightly"; export PKGARCHIVE
|
|
220
|
|
221 # we want make to do as much as it can, just in case there's more than
|
|
222 # one problem.
|
|
223 MAKEFLAGS=k; export MAKEFLAGS
|
|
224
|
|
225 # Magic variable to prevent the devpro compilers/teamware from sending
|
|
226 # mail back to devpro on every use.
|
|
227 UT_NO_USAGE_TRACKING="1"; export UT_NO_USAGE_TRACKING
|
|
228
|
|
229 # Build tools - don't change these unless you know what you're doing. These
|
|
230 # variables allows you to get the compilers and onbld files locally or
|
|
231 # through cachefs. Set BUILD_TOOLS to pull everything from one location.
|
|
232 # Alternately, you can set ONBLD_TOOLS to where you keep the contents of
|
|
233 # SUNWonbld and SPRO_ROOT to where you keep the compilers. SPRO_VROOT
|
|
234 # exists to make it easier to test new versions of the compiler.
|
|
235 BUILD_TOOLS=/opt; export BUILD_TOOLS
|
|
236 #ONBLD_TOOLS=/opt/onbld; export ONBLD_TOOLS
|
|
237 #SPRO_ROOT=/opt/SUNWspro; export SPRO_ROOT
|
|
238 #SPRO_VROOT=\$SPRO_ROOT; export SPRO_VROOT
|
|
239
|
|
240 # This goes along with lint - it is a series of the form "A [y|n]" which
|
|
241 # means "go to directory A and run 'make lint'" Then mail me (y) the
|
|
242 # difference in the lint output. 'y' should only be used if the area you're
|
|
243 # linting is actually lint clean or you'll get lots of mail.
|
|
244 # You shouldn't need to change this though.
|
|
245 #LINTDIRS="\$SRC y"; export LINTDIRS
|
|
246
|
|
247 # Set this flag to 'n' to disable the automatic validation of the dmake
|
|
248 # version in use. The default is to check it.
|
|
249 #CHECK_DMAKE=y
|
|
250 CHECK_DMAKE=n
|
|
251
|
|
252 # Set this flag to 'n' to disable the use of 'checkpaths'. The default,
|
|
253 # if the 'N' option is not specified, is to run this test.
|
|
254 #CHECK_PATHS=y
|
|
255
|
|
256 # BRINGOVER_FILES is the list of files nightly passes to bringover.
|
|
257 # If not set the default is "usr", but it can be used for bringing
|
|
258 # over deleted_files or other nifty directories.
|
|
259 #BRINGOVER_FILES="usr deleted_files"
|
|
260
|
|
261 # POST_NIGHTLY can be any command to be run at the end of nightly. See
|
|
262 # nightly(1) for interactions between environment variables and this command.
|
|
263 #POST_NIGHTLY=
|
|
264
|
|
265 #
|
|
266 # the source product has no SCCS history, and is modified to remove source
|
|
267 # that cannot be shipped. EXPORT_SRC is where the clear files are copied, then
|
|
268 # modified with 'make EXPORT_SRC'.
|
|
269 #
|
|
270 EXPORT_SRC="\$CODEMGR_WS/export_src"; export EXPORT_SRC
|
|
271
|
|
272 #
|
|
273 # CRYPT_SRC is similar to EXPORT_SRC, but after 'make CRYPT_SRC' the files in
|
|
274 # xmod/cry_files are saved. They are dropped on the exportable source to create
|
|
275 # the domestic build.
|
|
276 #
|
|
277
|
|
278 CRYPT_SRC="\$CODEMGR_WS/crypt_src"; export CRYPT_SRC
|
|
279
|
|
280 #
|
|
281 # OPEN_SRCDIR is where we copy the open tree to so that we can be sure
|
|
282 # we don't have a hidden dependency on closed code. The name ends in
|
|
283 # "DIR" to avoid confusion with the flags related to open source
|
|
284 # builds.
|
|
285 #
|
|
286
|
|
287 OPEN_SRCDIR="\$CODEMGR_WS/open_src"; export OPEN_SRCDIR
|
|
288
|
|
289 #
|
|
290 # Flag to enable creation of per-build-type proto areas. If "yes",
|
|
291 # more proto areas are created, which speeds up incremental builds but
|
|
292 # increases storage consumption. Will be forced to "yes" for
|
|
293 # OpenSolaris deliveries.
|
|
294 #
|
|
295 MULTI_PROTO=no; export MULTI_PROTO
|
|
296
|
|
297 __GNUC=""; export __GNUC
|
|
298 CW_NO_SHADOW=1; export CW_NO_SHADOW
|
|
299 $cross
|
|
300 $xprefix
|
|
301 $xtarget
|
|
302 $xtool_prefix
|
|
303 $xsysroot
|
|
304 $xld_prefix
|
|
305 __LINT=#; export __LINT
|
|
306 __ARLIB=#; export __ARLIB
|
|
307 __SOLIB=""; export __SOLIB
|
|
308 USE_WS_TOOLS=; export USE_WS_TOOLS
|
|
309 USE_UTSTUNE=; export USE_UTSTUNE
|
|
310
|
|
311 EOF
|
|
312
|
|
313 if [ "$mach" = "arm" ]; then
|
|
314 $CAT >> $fname <<EOF
|
|
315
|
|
316 # Target ARM platform.
|
|
317 ARM_PLATFORM=$ARM_PLATFORM; export ARM_PLATFORM
|
|
318
|
|
319 # Comment out below line if you want to use GNU binutils linker
|
|
320 # to build OpenSolaris.
|
|
321 __GNU_LD=#; export __GNU_LD
|
|
322
|
|
323 # ARM architecture doesn't support 64-bit build.
|
|
324 BUILD64=#; export BUILD64
|
|
325
|
|
326 # Use ARM EABI mode.
|
|
327 GNUC_ARM_EABI=; export GNUC_ARM_EABI
|
|
328
|
|
329 # Install all kernel modules under /usr directory.
|
|
330 # Set '#' if you don't want to.
|
|
331 KMODS_INST_USR=; export KMODS_INST_USR
|
|
332
|
|
333 # IPv4 only.
|
|
334 USE_INET6=#; export USE_INET6
|
|
335 EOF
|
|
336 fi
|
|
337 }
|
|
338
|
|
339
|
|
340 get_workspace_root
|
|
341 VERSION='$GATE'
|
|
342 staffer=`$WHO -m|$AWK '{print $1}'`
|
|
343
|
|
344 for mach in arm i386; do
|
|
345 dump_config "$workspace" "$staffer" "$mach"
|
|
346 done
|