buildit
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Wed, 28 Apr 2010 18:08:17 -0700
changeset 943 294f64612d23
parent 919 425233ae7236
child 967 efbd0ee6805d
permissions -rwxr-xr-x
6948254 Mass update of X gate sources to Oracle copyright format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
493
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
     1
#!/bin/ksh93
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     2
#
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     3
# buildit
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     4
# Script for building OpenSolaris X Consolidation
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     5
#
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     6
###########################################################################
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     7
#
943
294f64612d23 6948254 Mass update of X gate sources to Oracle copyright format
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents: 919
diff changeset
     8
# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
     9
#
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    10
# Permission is hereby granted, free of charge, to any person obtaining a
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    11
# copy of this software and associated documentation files (the "Software"),
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    12
# to deal in the Software without restriction, including without limitation
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    13
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    14
# and/or sell copies of the Software, and to permit persons to whom the
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    15
# Software is furnished to do so, subject to the following conditions:
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    16
#
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    17
# The above copyright notice and this permission notice (including the next
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    18
# paragraph) shall be included in all copies or substantial portions of the
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    19
# Software.
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    20
#
919
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    21
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    22
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    23
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    24
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    25
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    26
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
425233ae7236 6931307 Standardize Sun copyright & license notices in X gate on current format
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 907
diff changeset
    27
# DEALINGS IN THE SOFTWARE.
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    28
#
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    29
###########################################################################
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    30
#
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    31
#
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    32
493
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
    33
MAKE_PKGS=0
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    34
810
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    35
set -- $(getopt p $*)
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    36
if [ $? != 0 ] ; then
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    37
    print -u2 USAGE: $0 [-p]
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    38
    exit 2
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    39
fi
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    40
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    41
for i in $* ; do 
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    42
    case $i in
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    43
	-p)     MAKE_PKGS=1; shift;;
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    44
    esac
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    45
done
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    46
599
c195ef96916e 6787756 Use Solaris-bundled GNU tools where possible, instead of JDS CBE, when building X
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 585
diff changeset
    47
# Add /usr/bin to front of path in case user has /usr/gnu/bin default
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    48
# Add /usr/sbin to path for dtrace (to build probes in X servers)
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    49
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    50
PATH=/usr/bin:${PATH}:/usr/sbin
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    51
export PATH
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    52
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    53
[ -d log ] || mkdir log
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    54
493
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
    55
# Send all further output & errors to the log file
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    56
exec > log/buildit-XW 2>&1
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    57
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    58
# Find hg id and export it so set-elf-comments.pl doesn't have to re-run
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    59
# for every module built
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    60
export XBUILD_HG_ID="$(hg id)"
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    61
810
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    62
START="$(perl -e 'print time')"
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    63
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    64
print "------------------------------------------------------------------------------"
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    65
print "Building gate at hg id: ${XBUILD_HG_ID}"
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    66
print -n "Start time: " ; date
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    67
print -n "Building on: " ; uname -a
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    68
print "Using these compilers: "
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    69
whence cc gcc
599
c195ef96916e 6787756 Use Solaris-bundled GNU tools where possible, instead of JDS CBE, when building X
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 585
diff changeset
    70
# Make sure Sun C compiler is at least version 5.9 (Studio 12)
802
159b5b227862 6865400 X consolidation does not build with Studio 12 Update 1 compilers
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 705
diff changeset
    71
cc -V 2>&1 | perl -n -e 'if (($_ =~ m| C (\d+).(\d+)|)) { \
599
c195ef96916e 6787756 Use Solaris-bundled GNU tools where possible, instead of JDS CBE, when building X
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 585
diff changeset
    72
    print $_ ; print "*** Compiler too old!\n" if ( ($1 != 5) || ($2 < 9) ) }'
493
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
    73
gcc -v
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
    74
810
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    75
# Exported to stop Sun compilers from reporting home on each usage
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    76
export SUNW_NO_UPDATE_NOTIFY='true'
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    77
export UT_NO_USAGE_TRACKING='1'
705
24ca414edbff 6826940 Xorg server 1.6.1, Mesa 7.4.1, and associated module upgrades [PSARC 2009/292]
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 648
diff changeset
    78
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    79
print "Using these environment variables: "
493
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
    80
env
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    81
print "------------------------------------------------------------------------------"
810
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    82
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    83
MACH="$(uname -p)"
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
    84
if [ "${MACH}" = "i386" ]; then
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    85
    /bin/rm -rf proto-i386-svr4
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    86
else
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    87
    /bin/rm -rf proto-sun4-svr4
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    88
fi
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    89
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    90
XMAKE="$(pwd)/open-src/util/build-tools/xmake"
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    91
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    92
cd open-src
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    93
# Run as two steps to avoid race between cleaning & rebuilding when
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    94
# using parallel make
905
d2b59d5a79ed 6926932 Removal of Xsun on SPARC [PSARC 2008/033]: X consolidation portion
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 841
diff changeset
    95
${XMAKE} -v -k clean 
d2b59d5a79ed 6926932 Removal of Xsun on SPARC [PSARC 2008/033]: X consolidation portion
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 841
diff changeset
    96
${XMAKE} -v -k install
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    97
cd ..
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
    98
906
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
    99
print "\nFinished building the X Window System Consolidation for OpenSolaris.\n"
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
   100
print -n "Finish time: " ; date
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
   101
perl -e '$runtime = time - $ARGV[0];
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
   102
	 printf("Runtime: %d:%02d\n", $runtime/3600, ($runtime%3600)/60); ' \
4c633d8c519b 6927451 X gate build scripts & Makefiles need adjustments for hg master gate
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 905
diff changeset
   103
	"${START}"
493
f43507b5737d 6735203 open-src Makefile cleanup & enhancements
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 379
diff changeset
   104
810
6f94d3da0552 6889793 enable parallel builds of the X consolidation
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents: 802
diff changeset
   105
if [ "${MAKE_PKGS}" = 1 ] ; then
0
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   106
    ./make_release_packages
b949c5054bc4 Initial OpenSolaris release: X-src-20060331
Alan Coopersmith <Alan.Coopersmith@Sun.COM>
parents:
diff changeset
   107
fi