buildit revision 905
5cd4555ad444fd391002ae32450572054369fd42Rob Austein#!/bin/ksh93
5cd4555ad444fd391002ae32450572054369fd42Rob Austein#
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# buildit
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington# Script for building OpenSolaris X Consolidation
6ea2385360e9e2167e65f9286447da9eea189457Tinderbox User#
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews###########################################################################
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington#
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington# Use is subject to license terms.
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington#
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington# Permission is hereby granted, free of charge, to any person obtaining a
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# copy of this software and associated documentation files (the
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# "Software"), to deal in the Software without restriction, including
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# without limitation the rights to use, copy, modify, merge, publish,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# distribute, and/or sell copies of the Software, and to permit persons
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# to whom the Software is furnished to do so, provided that the above
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# copyright notice(s) and this permission notice appear in all copies of
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# the Software and that both the above copyright notice(s) and this
d4ef65050feac78554addf6e16a06c6e2e0bd331Brian Wellington# permission notice appear in supporting documentation.
f5d30e2864e048a42c4dc1134993ae7efdb5d6c3Mark Andrews#
b5ad6dfea4cc3e7d1d322ac99f1e5a31096837c4Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1753d3c4d74241a847794f7e7cfd94cc79be6600Evan Hunt# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Except as contained in this notice, the name of a copyright holder
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# shall not be used in advertising or otherwise to promote the sale, use
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# or other dealings in this Software without prior written authorization
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# of the copyright holder.
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington#
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington###########################################################################
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# ident "@(#)buildit 1.10 09/10/27 SMI"
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein
c1a883f2e04d94e99c433b1f6cfd0c0338f4ed85Mark AndrewsMAKE_PKGS=0
3398334b3acda24b086957286288ca9852662b12Automatic Updater
dde8659175c5798267fb0fdefd7576e4efe271b3Automatic Updaterset -- $(getopt p $*)
f428e385a4f7a42196b53de8e134909e8c488258Automatic Updaterif [ $? != 0 ]
207cee019eb5cbbe7c905f7c52f7b5d11f8c0305Automatic Updaterthen
99d8f5a70440ee8b63ab1745d713b96dde890546Tinderbox User echo USAGE: $0 [-p]
6ea2385360e9e2167e65f9286447da9eea189457Tinderbox User exit 2
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinfi
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinfor i in $* ; do
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein case $i in
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein -p) MAKE_PKGS=1; shift;;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein esac
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeindone
f5d30e2864e048a42c4dc1134993ae7efdb5d6c3Mark Andrews
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Add /usr/bin to front of path in case user has /usr/gnu/bin default
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Add /usr/sbin to path for dtrace
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein# Add /usr/X11/bin to path for makedepend
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian WellingtonPATH=/usr/bin:${PATH}:/usr/sbin:/usr/X11/bin
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonexport PATH
b272d38cc5d24f64c0647a9afb340c21c4b9aaf7Evan Hunt
b272d38cc5d24f64c0647a9afb340c21c4b9aaf7Evan Hunt[ -d log ] || mkdir log
b272d38cc5d24f64c0647a9afb340c21c4b9aaf7Evan Hunt
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt# Send all further output & errors to the log file
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntexec > log/buildit-XW 2>&1
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonecho "------------------------------------------------------------------------------"
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntecho "Start time: "
8b78c993cb475cc94e88560941b28c37684789d9Francis Dupontdate
b0c15bd9792112fb47f6d956e580e4369e92f4e7Mark AndrewsSTART="$(perl -e 'print time')"
b843f577bbcd6660fbaa506d9e55b156c689a5a8Evan Huntecho "Building on: "
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonuname -a
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonecho "Using these compilers: "
b843f577bbcd6660fbaa506d9e55b156c689a5a8Evan Huntwhich cc gcc
c6f4972c745f8903aba6dcca41f17a44c473db66Mark Andrews# Make sure Sun C compiler is at least version 5.9 (Studio 12)
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntcc -V 2>&1 | perl -n -e 'if (($_ =~ m| C (\d+).(\d+)|)) { \
61bcc232038f0a2cb77ed6269675fdc288f5ec98Evan Hunt print $_ ; print "*** Compiler too old!\n" if ( ($1 != 5) || ($2 < 9) ) }'
cc3aafe737334d444781f8a34ffaf459e075bb9aMark Andrewsgcc -v
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Exported to stop Sun compilers from reporting home on each usage
c6d2578fd67bc1a427d13fd0699b25a187feec8aMark Andrewsexport SUNW_NO_UPDATE_NOTIFY='true'
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntexport UT_NO_USAGE_TRACKING='1'
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
c6f4972c745f8903aba6dcca41f17a44c473db66Mark Andrewsecho "Using these environment variables: "
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonenv
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonecho "------------------------------------------------------------------------------"
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
553ead32ff5b00284e574dcabc39115d4d74ec66Evan HuntXMAKE="$(pwd)/open-src/util/build-tools/xmake"
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonchmod +x ${XMAKE}
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian WellingtonMACH="$(uname -p)"
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonif [ "${MACH}" = "i386" ]; then
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington /bin/rm -rf proto-i386-svr4
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonelse
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein /bin/rm -rf proto-sun4-svr4
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeinfi
561a29af8c54a216e7d30b5b4f6e0d21661654ecMark Andrews
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntchmod +x open-src/common/install-sh open-src/common/delibtoolize.pl
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntcd open-src
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington# Run as two steps to avoid race between cleaning & rebuilding
41eeb37b516d1bac073781b6ec50a39a669987dfEvan Hunt${XMAKE} -v -k clean
41eeb37b516d1bac073781b6ec50a39a669987dfEvan Hunt${XMAKE} -v -k install
41eeb37b516d1bac073781b6ec50a39a669987dfEvan Huntcd ..
41eeb37b516d1bac073781b6ec50a39a669987dfEvan Hunt
41eeb37b516d1bac073781b6ec50a39a669987dfEvan Huntecho ""
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondate
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonecho "\nFinished building the X Window System Consolidation for OpenSolaris.\n"
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonecho ""
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonecho "Finish time: "
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtondate
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonperl -e '$runtime=time-$ARGV[0]; printf("Runtime: %d:%02d\n", $runtime/3600, ($runtime%3600)/60); ' "${START}"
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellington
0b062f4990db5cc6db2fe3398926f71b92a67407Brian Wellingtonif [ "${MAKE_PKGS}" = 1 ] ; then
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein chmod +x make_release_packages
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein ./make_release_packages
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Huntfi
553ead32ff5b00284e574dcabc39115d4d74ec66Evan Hunt