make_release_packages revision 595
0N/A#! /bin/ksh93
0N/A#
0N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
0N/A#
407N/A# Permission is hereby granted, free of charge, to any person obtaining a
0N/A# copy of this software and associated documentation files (the
0N/A# "Software"), to deal in the Software without restriction, including
0N/A# without limitation the rights to use, copy, modify, merge, publish,
0N/A# distribute, and/or sell copies of the Software, and to permit persons
0N/A# to whom the Software is furnished to do so, provided that the above
0N/A# copyright notice(s) and this permission notice appear in all copies of
0N/A# the Software and that both the above copyright notice(s) and this
0N/A# permission notice appear in supporting documentation.
0N/A#
0N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
0N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
0N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
0N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
1124N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
0N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
0N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
0N/A#
154N/A# Except as contained in this notice, the name of a copyright holder
159N/A# shall not be used in advertising or otherwise to promote the sale, use
154N/A# or other dealings in this Software without prior written authorization
292N/A# of the copyright holder.
292N/A#
159N/A# @(#)make_release_packages 1.64 08/12/10
154N/A#
154N/A# Create and fill a package staging area for X
605N/A#
1124N/A# This script should be run from the base of the build tree.
434N/A# It takes no parameters.
434N/A#
259N/A# Example:
89N/A# cd /export/home/hammer1/WORKSPACES_S493_ALPHA2.1
1124N/A# ./make_release_packages
1124N/A#
0N/A# To build a subset of packages
0N/A# ./make_release_packages packages
0N/A# or
0N/A# env PACKAGE_LIST="packages" ./make_release_packages
456N/A#
92N/A
92N/A# Make sure that we aren't affected by the personal environment of
92N/A# whoever is running this script
92N/APATH=/usr/bin:/usr/ccs/bin
92N/ASHELL=/bin/ksh93
92N/Aexport LC_NUMERIC=C
154N/A
456N/AMACH="$(uname -p)"
456N/ADATE="$(date +0.%Y.%m.%d)"
456N/A
456N/A# List of official (deliverable) X-window packages for all platforms
345N/AXW_PACKAGE_LIST="SUNWfontconfig SUNWfontconfig-docs SUNWfontconfig-root
0N/A SUNWpciaccess SUNWpixman SUNWfreetype2 SUNWvncviewer SUNWxcursor-themes
345N/A SUNWxorg-cfg SUNWxorg-client-docs SUNWxorg-client-programs
0N/A SUNWxorg-clientlibs SUNWxorg-compatlinks SUNWxorg-devel-docs
0N/A SUNWxorg-doc SUNWxorg-graphics-ddx SUNWxorg-headers
92N/A SUNWxorg-server SUNWxorg-tsol-module SUNWxprint-server
92N/A SUNWxscreensaver-hacks SUNWxscreensaver-hacks-gl SUNWxsun-server
92N/A SUNWxvnc SUNWxwacx SUNWxwcft SUNWxwdem SUNWxwdim SUNWxwdxm
92N/A SUNWxwfnt SUNWxwfs SUNWxwfsw SUNWxwhl SUNWxwice SUNWxwinc
92N/A SUNWxwman SUNWxwmod SUNWxwoft SUNWxwopt SUNWxwpft SUNWxwplr
92N/A SUNWxwplt SUNWxwpmn SUNWxwrtl SUNWxwslb SUNWxwsrv SUNWxwsvr
92N/A SUNWxwts SUNWxwxft"
92N/A
92N/A# Some packages are only built for certain platforms currently
345N/Acase "${MACH}" in
92N/A sparc)
92N/A XW_PACKAGE_LIST="$XW_PACKAGE_LIST SUNWxwpsr"
345N/A ;;
0N/A i386)
0N/A XW_PACKAGE_LIST="$XW_PACKAGE_LIST SUNWxorg-mesa"
92N/A ;;
92N/Aesac
92N/A
92N/A# Localization template packages for delivery to translation teams
345N/Aif [[ "$BUILD_L10N" != "no" ]]; then
92N/A XW_L10N_PACKAGES="SUNW0xacx SUNW0xman SUNW0xpmn
92N/A SUNW0xwplt SUNW0xwopt SUNW0xwsvr"
92N/Aelse
92N/A XW_L10N_PACKAGES=" "
92N/Afi
345N/A
92N/A# FSW* packages are built for the OpenSolaris (Project Indiana) deliveries
439N/AFSW_PACKAGE_LIST="
345N/A FSWxorg-fonts-core
92N/A FSWxorg-fonts-cyrillic
345N/A FSWxorg-fonts-daewoo
92N/A FSWxorg-fonts-ethiopic
92N/A FSWxorg-fonts-iso8859-2
92N/A FSWxorg-fonts-iso8859-3
154N/A FSWxorg-fonts-iso8859-4
92N/A FSWxorg-fonts-iso8859-9
92N/A FSWxorg-fonts-iso8859-10
92N/A FSWxorg-fonts-iso8859-13
345N/A FSWxorg-fonts-iso8859-14
92N/A FSWxorg-fonts-iso8859-16
154N/A FSWxorg-fonts-jiskan
345N/A FSWxorg-fonts-syriac
92N/A FSWxorg-fonts-vera
92N/A"
92N/A
92N/Aif [[ "$BUILD_FSW" != "no" ]]; then
92N/A EXTRA_PACKAGES+="${FSW_PACKAGE_LIST}"
92N/Afi
92N/A
92N/A# To build a subset of packages:
92N/A# make_release_packages packages
92N/A# or
92N/A# env PACKAGE_LIST="packages" make_release_packages
92N/A#
345N/Aif (( $# > 0 )) ; then
92N/A PACKAGE_LIST="$*"
154N/Aelse
154N/A : ${PACKAGE_LIST:="$XW_PACKAGE_LIST $EXTRA_PACKAGES $XW_L10N_PACKAGES"}
154N/Afi
154N/A
154N/A### Functions for use later
154N/Afunction print_and_run
154N/A{
154N/A print "$@"
154N/A "$@"
154N/A}
154N/A
154N/Aprogname="$0"
154N/A
154N/Afunction fatal_error
92N/A{
92N/A print -u2 "${progname}: ERROR: $*"
92N/A exit 1
990N/A}
990N/A
990N/A
990N/A# Which platform name do we use for 64-bit?
990N/Acase "${MACH}" in
990N/A sparc) PLAT_64="sparcv9" ;;
990N/A i386) PLAT_64="amd64" ;;
990N/A *) fatal_error "Unknown architecture - not SPARC nor i386." ;;
990N/Aesac
604N/A
604N/A: ${PACKAGE_DIR:="$(pwd)/proto-packages"}
604N/ASOURCE_DIR="$(pwd)"
604N/APKG_SOURCE_DIR=${SOURCE_DIR}/packages
0N/A
0N/Acd ${PKG_SOURCE_DIR}
0N/A
154N/A# Get build version from pkgversion
583N/Aif [[ -f pkgversion ]] ; then
583N/A source ./pkgversion
583N/Aelse
583N/A fatal_error "${PKG_SOURCE_DIR}/pkgversion not found. Cannot continue."
604N/Afi
604N/A
605N/Aif [[ -z "${VERSION}" ]] ; then
605N/A fatal_error "VERSION not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
604N/Afi
0N/A
605N/Aif [[ -z "${BUILD}" ]] ; then
604N/A fatal_error "BUILD not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
604N/Afi
604N/A
604N/ADECIMAL_BUILD=$(( ${BUILD} / 100.0 ))
604N/Aprint "Building packages for X11 version ${VERSION} build ${DECIMAL_BUILD}"
604N/A
604N/Aif [[ "${MACH}" = "sparc" ]]; then
604N/A PROTODIR=${SOURCE_DIR}/proto-sun4-svr4
604N/Aelse
605N/A PROTODIR=${SOURCE_DIR}/proto-${MACH}-svr4
605N/Afi
604N/A
604N/A# Next, create the staging area.
604N/A#
605N/Aprint 'Removing old proto-packages and recreating'
605N/A/bin/rm -rf ${PACKAGE_DIR}
154N/A/bin/mkdir ${PACKAGE_DIR} ${PACKAGE_DIR}/logs
0N/A
154N/A# Now copy the package description info
0N/Aprint 'Copying package descriptions'
604N/A
604N/A/bin/cp copyright depend i.* r.* ${PACKAGE_DIR} >/dev/null 2>&1
605N/A
605N/Afor package in ${PACKAGE_LIST} common_files ; do
604N/A cd ${package}
604N/A
604N/A /bin/mkdir ${PACKAGE_DIR}/${package}
604N/A /bin/cp p* d* lib* i.* r.* M* ${PACKAGE_DIR}/${package} >/dev/null 2>&1
604N/A
604N/A # We keep the master copyright in the top-level copyright file
604N/A # Packages that need additional copyright have copyright.add files
604N/A # that we then merge here
604N/A cp ../copyright ${PACKAGE_DIR}/${package}/copyright
604N/A
604N/A for F in copyright.add copyright.add.${MACH} ; do
605N/A if [[ -f $F ]] ; then
605N/A chmod +w ${PACKAGE_DIR}/${package}/copyright
604N/A PROTODIR=${PROTODIR} nawk \
604N/A 'BEGIN { PROTODIR = ENVIRON [ "PROTODIR" ]; }
604N/A /^include / {
604N/A system("cat " PROTODIR "/licenses/" $2)
604N/A next
605N/A }
605N/A { print }' \
604N/A $F >> ${PACKAGE_DIR}/${package}/copyright
604N/A fi
604N/A done
604N/A cd ..
604N/Adone
604N/A
605N/A
604N/A# Now move into the package staging area and build the packages.
604N/Acd ${PACKAGE_DIR}
604N/A
604N/Afor D in etc usr var lib licenses kernel ; do
604N/A /bin/rm -f $D
604N/A /bin/ln -s ${PROTODIR}/$D $D
604N/Adone
604N/A
0N/Afor D in openwin ; do
0N/A /bin/rm -f $D
604N/A /bin/ln -s ${PROTODIR}/usr/$D $D
604N/Adone
604N/A
604N/ALOGfile=logs/package_build
604N/A
604N/Aprint -- '---Building packages'
604N/A
604N/A# Variables to pass to pkgmk for use in prototype files
604N/A# They must start with lowercase letters to be resolved at pkgmk time
604N/APKGMK_VARS="plat_64=${PLAT_64} plat=${MACH}"
605N/A
605N/Afor package in ${PACKAGE_LIST} ; do
604N/A cd ${package}
604N/A date
605N/A print "******** Making the ${package} package ********"
605N/A
605N/A sed -e '/ARCH/s/ISA/'${MACH}'/' -e 's/SUNW_PRODVERS=.*$/SUNW_PRODVERS='${VERSION}/ -e 's/VERSION=.*$/VERSION='${VERSION}.${BUILD},REV=${DATE}/ pkginfo.tmpl > pkginfo
605N/A if [[ -f Makefile ]] ; then
605N/A print_and_run /usr/ccs/bin/make SOURCEDIR=${PKG_SOURCE_DIR} all
605N/A else
605N/A for pf in preinstall preremove postinstall postremove ; do
604N/A # If filename.tmpl exists, but filename does not,
605N/A # build filename from the .tmpl
605N/A if [[ -f "${pf}.tmpl" && ! -f "${pf}" ]] ; then
605N/A SOURCEDIR=${PKG_SOURCE_DIR} \
605N/A nawk -f ${PKG_SOURCE_DIR}/awk_procedure \
605N/A ${pf}.tmpl > ${pf}
605N/A fi
1126N/A done
605N/A fi
605N/A
1126N/A if [[ -f prototype ]] ; then
605N/A # Simple package with the same prototype on all platforms
605N/A PROTOTYPE="prototype"
605N/A else
605N/A # Package with some platform-specific settings in prototype
605N/A if [[ ! -f prototype_${MACH} ]]; then
605N/A ln -s prototype_com prototype_${MACH}
605N/A fi
605N/A PROTOTYPE="prototype_${MACH}"
604N/A fi
0N/A
0N/A print_and_run /usr/bin/pkgmk -d ${PACKAGE_DIR}/${package} -f ${PROTOTYPE} -o ${PKGMK_VARS}
604N/A
604N/A print "******** Done Making the ${package} package ********"
604N/A cd ..
604N/Adone >$LOGfile 2>&1
604N/A
604N/Aprint result log is in ${PACKAGE_DIR}/$LOGfile
604N/A
604N/Aprint -n "Packages built: "
604N/Agrep -c "Packaging complete" ${PACKAGE_DIR}/$LOGfile
604N/Aprint -n "Packages failed: "
604N/Agrep -c "Packaging was not successful" ${PACKAGE_DIR}/$LOGfile
604N/A
604N/A# Create an installdir with symlinks to built packages
604N/Acd ${PACKAGE_DIR}
604N/Amkdir installdir
0N/Acd installdir
604N/Afor package in ${PACKAGE_LIST} ; do
604N/A if [[ -d ../${package}/${package} ]] ; then
0N/A ln -s ../${package}/${package} .
154N/A fi
0N/Adone
0N/Aif [[ -f ${PKG_SOURCE_DIR}/upgrade-X ]] ; then
0N/A cp -p ${PKG_SOURCE_DIR}/upgrade-X .
154N/A chmod a+x upgrade-X
0N/Afi
154N/A
0N/Aexit 0
0N/A