Home | History | Annotate | Download | only in fox-gate
      1 #!/bin/ksh93
      2 #
      3 # buildit
      4 # Script for building OpenSolaris X Consolidation
      5 #
      6 ###########################################################################
      7 #
      8 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
      9 #
     10 # Permission is hereby granted, free of charge, to any person obtaining a
     11 # copy of this software and associated documentation files (the
     12 # "Software"), to deal in the Software without restriction, including
     13 # without limitation the rights to use, copy, modify, merge, publish,
     14 # distribute, and/or sell copies of the Software, and to permit persons
     15 # to whom the Software is furnished to do so, provided that the above
     16 # copyright notice(s) and this permission notice appear in all copies of
     17 # the Software and that both the above copyright notice(s) and this
     18 # permission notice appear in supporting documentation.
     19 #
     20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     21 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
     23 # OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
     24 # HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
     25 # INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
     26 # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
     27 # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
     28 # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     29 #
     30 # Except as contained in this notice, the name of a copyright holder
     31 # shall not be used in advertising or otherwise to promote the sale, use
     32 # or other dealings in this Software without prior written authorization
     33 # of the copyright holder.
     34 #
     35 ###########################################################################
     36 #
     37 # ident "@(#)buildit	1.8	09/05/15 SMI"
     38 #
     39 
     40 MAKE_PKGS=0
     41 
     42 set -- `getopt p $*`
     43 if [ $? != 0 ]
     44 then
     45     echo USAGE: $0 [-p]
     46     exit 2
     47 fi
     48 
     49 for i in $* ; do 
     50     case $i in
     51 	-p)     MAKE_PKGS=1; shift;;
     52     esac
     53 done
     54 
     55 
     56 # Add /usr/bin to front of path in case user has /usr/gnu/bin default
     57 # Add /usr/sbin to path for dtrace
     58 # Add /usr/X11/bin to path for makedepend
     59 
     60 PATH=/usr/bin:$PATH:/usr/sbin:/usr/X11/bin
     61 export PATH
     62 
     63 [ -d log ] || mkdir log
     64 
     65 # Send all further output & errors to the log file
     66 exec > log/buildit-XW 2>&1
     67 
     68 echo "------------------------------------------------------------------------------"
     69 echo "Start time: "
     70 date
     71 START=`perl -e 'print time'`
     72 echo "Building on: "
     73 uname -a
     74 echo "Using these compilers: "
     75 which cc gcc
     76 # Make sure Sun C compiler is at least version 5.9 (Studio 12)
     77 cc -V 2>&1 | perl -n -e 'if (($_ =~ m| C (\d)+.(\d)+|)) { \
     78     print $_ ; print "*** Compiler too old!\n" if ( ($1 != 5) || ($2 < 9) ) }'
     79 gcc -v
     80 
     81 # Exported to reduce number of times it's evaluated in makefiles
     82 export POUND_SIGN='#'
     83 
     84 echo "Using these environment variables: "
     85 env
     86 echo "------------------------------------------------------------------------------"
     87 
     88 cd XW_NV
     89 MACH=`uname -p`
     90 if [ "$MACH" = "i386" ]; then
     91     /bin/rm -rf proto-i386-svr4
     92 else
     93     /bin/rm -rf proto-sun4-svr4
     94 fi
     95 
     96 cd open-src
     97 make -k clean install
     98 cd ..
     99 
    100 echo ""
    101 date
    102 echo "\nFinished building the X Window System Consolidation for OpenSolaris.\n"
    103 echo ""
    104 echo "Finish time: "
    105 date
    106 perl -e '$runtime=time-$ARGV[0];printf("Runtime: %d:%02d\n", $runtime/3600, ($runtime%3600)/60); ' $START
    107 
    108 if [ $MAKE_PKGS = 1 ] ; then
    109     PACKAGE_LIST=`cd packages && echo SUNW* FSW*`
    110     export PACKAGE_LIST
    111     chmod +x make_release_packages
    112     mkdir packages/common_files
    113     ./make_release_packages
    114 fi
    115 
    116