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 23 # 24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 # ident "%Z%%M% %I% %E% SMI" 28 # 29 30 # 31 # Make SUNWonbld package tarball for OpenSolaris. Besides the 32 # package, we include licensing files. 33 # 34 35 fail() { 36 echo $* 37 exit 1 38 } 39 40 # 41 # Directory that we assemble everything in. Everything goes into 42 # $subdir so that it unpacks cleanly. 43 # 44 stagedir=$(mktemp -dt onblddropXXXXX) 45 subdir=onbld 46 47 [ -n "$SRC" ] || fail "Please set SRC." 48 [ -n "$CODEMGR_WS" ] || fail "Please set CODEMGR_WS." 49 [ -n "$PKGARCHIVE" ] || fail "Please set PKGARCHIVE." 50 51 [ -n "$MAKE" ] || export MAKE=make 52 53 isa=`uname -p` 54 tarfile=$CODEMGR_WS/SUNWonbld.$isa.tar 55 56 # 57 # Generate the README from boilerplate and the contents of the 58 # SUNWonbld tree. 59 # usage: mkdireadme targetdir 60 # 61 mkreadme() { 62 targetdir=$1 63 readme=README.ON-BUILD-TOOLS.$isa 64 sed -e s/@ISA@/$isa/ -e s/@DELIVERY@/ON-BUILD-TOOLS/ \ 65 $SRC/tools/opensolaris/README.binaries.tmpl > $targetdir/$readme 66 (cd $targetdir; find SUNWonbld -type f -print | \ 67 sort >> $targetdir/$readme) 68 } 69 70 [ -n "$stagedir" ] || fail "Can't create staging directory." 71 mkdir -p $stagedir/$subdir || fail "Can't create $stagedir/$subdir." 72 73 cd $CODEMGR_WS 74 # $MAKE -e to make sure PKGARCHIVE is used. 75 (cd usr/src/tools/SUNWonbld; $MAKE -e install) || fail "Can't make package." 76 77 [ -d $PKGARCHIVE/SUNWonbld ] || \ 78 fail "$PKGARCHIVE/SUNWonbld is missing." 79 (cd $PKGARCHIVE; tar cf - SUNWonbld) | (cd $stagedir/$subdir; tar xf -) 80 81 # Insert binary license files. 82 cp -p $SRC/tools/opensolaris/BINARYLICENSE.txt $stagedir/$subdir || \ 83 fail "Can't add BINARYLICENSE.txt" 84 mkreadme $stagedir/$subdir 85 cp -p $CODEMGR_WS/THIRDPARTYLICENSE.ON-BUILD-TOOLS $stagedir/$subdir || \ 86 fail "Can't add THIRDPARTYLICENSE.ON-BUILD-TOOLS." 87 88 (cd $stagedir; tar cf $tarfile $subdir) || fail "Can't create $tarfile." 89 bzip2 -f $tarfile || fail "Can't compress $tarfile". 90 91 rm -rf $stagedir 92