buildit revision 1022
49dbdb0186eb23d87d685b96eaefa9ec3c71d9b8David Lawrence#!/bin/ksh93
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#
7270737ca9bfa3c5f067e6377068aa597687d094Bob Halley# buildit
7270737ca9bfa3c5f067e6377068aa597687d094Bob Halley# Script for building OpenSolaris X Consolidation
7270737ca9bfa3c5f067e6377068aa597687d094Bob Halley#
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence###########################################################################
15a44745412679c30a6d022733925af70a38b715David Lawrence#
15a44745412679c30a6d022733925af70a38b715David Lawrence# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
15a44745412679c30a6d022733925af70a38b715David Lawrence#
15a44745412679c30a6d022733925af70a38b715David Lawrence# Permission is hereby granted, free of charge, to any person obtaining a
15a44745412679c30a6d022733925af70a38b715David Lawrence# copy of this software and associated documentation files (the "Software"),
15a44745412679c30a6d022733925af70a38b715David Lawrence# to deal in the Software without restriction, including without limitation
15a44745412679c30a6d022733925af70a38b715David Lawrence# the rights to use, copy, modify, merge, publish, distribute, sublicense,
15a44745412679c30a6d022733925af70a38b715David Lawrence# and/or sell copies of the Software, and to permit persons to whom the
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# Software is furnished to do so, subject to the following conditions:
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas Gustafsson#
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# The above copyright notice and this permission notice (including the next
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# paragraph) shall be included in all copies or substantial portions of the
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# Software.
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley#
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
440be4c866f6935ac069db79a414304507a664c2Michael Graff# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
fe8d130967804ce76ca98acc00063407cfa0980aAndreas Gustafsson# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
fe8d130967804ce76ca98acc00063407cfa0980aAndreas Gustafsson# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
fe8d130967804ce76ca98acc00063407cfa0980aAndreas Gustafsson# DEALINGS IN THE SOFTWARE.
440be4c866f6935ac069db79a414304507a664c2Michael Graff#
4dafa5b8ed9f4bcc6308526369c9325d7a520b3fBob Halley###########################################################################
90c917523e47f9a97d000528a8b81d90815476c7Brian Wellington#
90c917523e47f9a97d000528a8b81d90815476c7Brian Wellington#
9c4cba349f52bb8176c3858b2b5b340f13603802Brian Wellington
9c4cba349f52bb8176c3858b2b5b340f13603802Brian Wellington# Add /usr/bin to front of path in case user has /usr/gnu/bin default
bb2d54f1b3654857b8cb0209612ed847afbd9d3cMichael Graff# Add /usr/sbin to path for dtrace (to build probes in X servers)
fe8d130967804ce76ca98acc00063407cfa0980aAndreas Gustafsson
e8d3d40f0bea8531138055214cce1a9a1d0302c2David LawrencePATH=/usr/bin:${PATH}:/usr/sbin
74da616f07f038138ddd45c10fc8de0920244d12Michael Graffexport PATH
d8e34837cd6c88c42b3ecdb9107a43ecf8252e79David Lawrence
11e0238bbef7df2649adfd298c00f539c0a3976dDavid Lawrenceprogname="$0"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleyfunction fatal_error
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley{
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley print -u2 "${progname}: ERROR: $*"
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley exit 1
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley}
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob HalleyMAKE_PKGS=0
922e6a3c2ac4ef900dd9dc99f0cc137f18372583Andreas GustafssonVERBOSE_FLAGS="" # verbosity flag passed to xmake/make_release_packages
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob HalleyPUBLISHER_FLAGS=""
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halleywhile getopts pP:v i; do
a2f3208f7f754cbc5156a1d798ae06d8f3546be2Bob Halley case $i in
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley p) MAKE_PKGS=1 ;;
a2f3208f7f754cbc5156a1d798ae06d8f3546be2Bob Halley v) VERBOSE_FLAGS="-v" ;;
0ed6a929818f03c84ae4c4ea6407a6ae5756a54cMichael Graff P) PUBLISHER_FLAGS="-p $OPTARG" ;;
0ed6a929818f03c84ae4c4ea6407a6ae5756a54cMichael Graff ?) print -u2 "USAGE: $0 [-p [-P publisher]] [-v]"; exit 2 ;;
51917258dbb23cfe6069ae1cf2b7fc5aefc1e0c2Bob Halley esac
done
shift $(($OPTIND-1))
if [[ $? != 0 ]] ; then
print -u2 "USAGE: $0 [-p [-P publisher]] [-v]"
exit 2
fi
[ -d log ] || mkdir log
# Send all further output & errors to the log file
exec > log/buildit-XW 2>&1
# Find hg id and export it so set-elf-comments.pl doesn't have to re-run
# for every module built
hg_id() {
hg id -it | read rev tag
case "${tag}" in
tip) print "${rev}" ;;
*) print "${tag}" ;;
esac
}
export XBUILD_HG_ID="$(hg_id)"
START="$(perl -e 'print time')"
print "------------------------------------------------------------------------------"
print "Building gate at hg id: ${XBUILD_HG_ID}"
print -n "Start time: " ; date
print -n "Building on: " ; uname -a
print "Using these compilers: "
whence cc gcc
# Make sure Sun C compiler is at least version 5.10 (Studio 12 Update 1)
cc -V 2>&1 | perl -n -e 'if (($_ =~ m| C (\d+).(\d+)|)) { \
print $_ ; print "*** Compiler too old!\n" if ( ($1 != 5) || ($2 < 10) ) }'
gcc -v
# Exported to stop Sun compilers from reporting home on each usage
export SUNW_NO_UPDATE_NOTIFY='true'
export UT_NO_USAGE_TRACKING='1'
print "Using these environment variables: "
env
print "------------------------------------------------------------------------------"
MACH="$(uname -p)"
# Remove old proto area & package area to clean after moving to new locations
if [ "${MACH}" = "i386" ]; then
/bin/rm -rf proto-i386-svr4
else
/bin/rm -rf proto-sun4-svr4
fi
/bin/rm -rf proto-packages
# Clean new proto areas for this architecture
/bin/rm -rf "proto/root_${MACH}" "proto/metadata_${MACH}" \
"proto/pkg_${MACH}" "proto/tools_${MACH}"
XMAKE="$(pwd)/open-src/util/build-tools/xmake ${VERBOSE_FLAGS} -k"
${XMAKE} setup || fatal_error "make setup failed: cannot build"
cd open-src
# Run as two steps to avoid race between cleaning & rebuilding when
# using parallel make
${XMAKE} clean
${XMAKE} install
cd ..
print "\nFinished building the X Window System Consolidation for OpenSolaris.\n"
print -n "Finish time: " ; date
perl -e '$runtime = time - $ARGV[0];
printf("Runtime: %d:%02d\n", $runtime/3600, ($runtime%3600)/60); ' \
"${START}"
if [ "${MAKE_PKGS}" = 1 ] ; then
./make_release_packages ${PUBLISHER_FLAGS} ${VERBOSE_FLAGS}
fi