make_release_packages revision 837
493N/A#! /bin/ksh93
0N/A#
606N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
731N/A# Use is subject to license terms.
0N/A#
0N/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
0N/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#
0N/A# Except as contained in this notice, the name of a copyright holder
0N/A# shall not be used in advertising or otherwise to promote the sale, use
0N/A# or other dealings in this Software without prior written authorization
0N/A# of the copyright holder.
0N/A#
837N/A# ident "@(#)make_release_packages 1.79 09/11/23 SMI"
0N/A#
0N/A# Create and fill a package staging area for X
0N/A#
0N/A# This script should be run from the base of the build tree.
0N/A# It takes no parameters.
0N/A#
0N/A# Example:
0N/A# cd /export/home/hammer1/WORKSPACES_S493_ALPHA2.1
0N/A# ./make_release_packages
0N/A#
0N/A# To build a subset of packages
561N/A# ./make_release_packages packages
561N/A# or
0N/A# env PACKAGE_LIST="packages" ./make_release_packages
0N/A#
0N/A
0N/A# Make sure that we aren't affected by the personal environment of
0N/A# whoever is running this script
493N/APATH=/usr/bin:/usr/ccs/bin
493N/ASHELL=/bin/ksh93
493N/Aexport LC_NUMERIC=C
0N/A
493N/AMACH="$(uname -p)"
493N/ADATE="$(date +0.%Y.%m.%d)"
0N/A
493N/A# List of official (deliverable) X-window packages for all platforms
837N/AXW_PACKAGE_LIST="
837N/A SUNWfontconfig
837N/A SUNWfontconfig-docs
837N/A SUNWfontconfig-root
837N/A SUNWfont-daewoo-misc
837N/A SUNWfont-isas-misc
837N/A SUNWfont-jis-misc
837N/A SUNWfont-misc-ethiopic
837N/A SUNWfont-misc-meltho
837N/A SUNWfont-xorg-cyrillic
837N/A SUNWfont-xorg-core
837N/A SUNWfont-xorg-iso8859-1
837N/A SUNWfont-xorg-iso8859-2
837N/A SUNWfont-xorg-iso8859-3
837N/A SUNWfont-xorg-iso8859-4
837N/A SUNWfont-xorg-iso8859-5
837N/A SUNWfont-xorg-iso8859-7
837N/A SUNWfont-xorg-iso8859-8
837N/A SUNWfont-xorg-iso8859-9
837N/A SUNWfont-xorg-iso8859-10
837N/A SUNWfont-xorg-iso8859-11
837N/A SUNWfont-xorg-iso8859-13
837N/A SUNWfont-xorg-iso8859-14
837N/A SUNWfont-xorg-iso8859-15
837N/A SUNWfont-xorg-iso8859-16
837N/A SUNWfreetype2
837N/A SUNWpciaccess
837N/A SUNWpixman
791N/A SUNWsynergy
837N/A SUNWttf-bh-luxi
837N/A SUNWttf-bitstream-vera
837N/A SUNWttf-dejavu
653N/A SUNWttf-google-droid
837N/A SUNWttf-liberation
837N/A SUNWvncviewer
837N/A SUNWxcompmgr
837N/A SUNWxcursor-themes
837N/A SUNWxdm
837N/A SUNWxdm-root
837N/A SUNWxorg-client-docs
837N/A SUNWxorg-client-programs
837N/A SUNWxorg-clientlibs
837N/A SUNWxorg-compatlinks
837N/A SUNWxorg-graphics-ddx
837N/A SUNWxorg-headers
837N/A SUNWxorg-server
837N/A SUNWxorg-tsol-module
837N/A SUNWxvnc
837N/A SUNWxwacx
837N/A SUNWxwcft
837N/A SUNWxwdem
837N/A SUNWxwdxm
837N/A SUNWxwfnt
837N/A SUNWxwfs
837N/A SUNWxwfsw
837N/A SUNWxwice
837N/A SUNWxwinc
837N/A SUNWxwman
837N/A SUNWxwmod
837N/A SUNWxwoft
837N/A SUNWxwopt
837N/A SUNWxwplr
837N/A SUNWxwplt
837N/A SUNWxwpmn
837N/A SUNWxwrtl
837N/A SUNWxwslb
837N/A SUNWxwxft
837N/A"
731N/A
731N/AXSUN_PACKAGE_LIST="SUNWxsun-headers SUNWxsun-server SUNWxwts"
0N/A
493N/A# Some packages are only built for certain platforms currently
493N/Acase "${MACH}" in
493N/A sparc)
731N/A XW_PACKAGE_LIST="$XW_PACKAGE_LIST $XSUN_PACKAGE_LIST SUNWxwpsr"
493N/A ;;
493N/A i386)
493N/A XW_PACKAGE_LIST="$XW_PACKAGE_LIST SUNWxorg-mesa"
493N/A ;;
493N/Aesac
493N/A
493N/A# Localization template packages for delivery to translation teams
493N/Aif [[ "$BUILD_L10N" != "no" ]]; then
493N/A XW_L10N_PACKAGES="SUNW0xacx SUNW0xman SUNW0xpmn
763N/A SUNW0xwplt SUNW0xwopt"
0N/Aelse
0N/A XW_L10N_PACKAGES=" "
0N/Afi
0N/A
561N/A# To build a subset of packages:
561N/A# make_release_packages packages
561N/A# or
561N/A# env PACKAGE_LIST="packages" make_release_packages
0N/A#
561N/Aif (( $# > 0 )) ; then
561N/A PACKAGE_LIST="$*"
561N/Aelse
561N/A : ${PACKAGE_LIST:="$XW_PACKAGE_LIST $EXTRA_PACKAGES $XW_L10N_PACKAGES"}
561N/Afi
493N/A
493N/A### Functions for use later
493N/Afunction print_and_run
493N/A{
493N/A print "$@"
493N/A "$@"
493N/A}
493N/A
493N/Aprogname="$0"
0N/A
493N/Afunction fatal_error
493N/A{
493N/A print -u2 "${progname}: ERROR: $*"
493N/A exit 1
493N/A}
493N/A
606N/Afunction process_includes
606N/A{
606N/A nawk \
606N/A "/^include / {
606N/A system(\"cat $1/\" \$2)
606N/A next
606N/A }
606N/A { print }" $2
606N/A}
0N/A
493N/A# Which platform name do we use for 64-bit?
493N/Acase "${MACH}" in
493N/A sparc) PLAT_64="sparcv9" ;;
493N/A i386) PLAT_64="amd64" ;;
493N/A *) fatal_error "Unknown architecture - not SPARC nor i386." ;;
493N/Aesac
493N/A
493N/A: ${PACKAGE_DIR:="$(pwd)/proto-packages"}
493N/ASOURCE_DIR="$(pwd)"
561N/APKG_SOURCE_DIR=${SOURCE_DIR}/packages
493N/A
561N/Acd ${PKG_SOURCE_DIR}
0N/A
0N/A# Get build version from pkgversion
493N/Aif [[ -f pkgversion ]] ; then
493N/A source ./pkgversion
0N/Aelse
561N/A fatal_error "${PKG_SOURCE_DIR}/pkgversion not found. Cannot continue."
355N/Afi
355N/A
493N/Aif [[ -z "${VERSION}" ]] ; then
561N/A fatal_error "VERSION not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
493N/Afi
493N/A
493N/Aif [[ -z "${BUILD}" ]] ; then
561N/A fatal_error "BUILD not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
493N/Afi
493N/A
493N/ADECIMAL_BUILD=$(( ${BUILD} / 100.0 ))
493N/Aprint "Building packages for X11 version ${VERSION} build ${DECIMAL_BUILD}"
493N/A
493N/Aif [[ "${MACH}" = "sparc" ]]; then
493N/A PROTODIR=${SOURCE_DIR}/proto-sun4-svr4
493N/Aelse
493N/A PROTODIR=${SOURCE_DIR}/proto-${MACH}-svr4
493N/Afi
493N/A
493N/A# Next, create the staging area.
0N/A#
493N/Aprint 'Removing old proto-packages and recreating'
493N/A/bin/rm -rf ${PACKAGE_DIR}
493N/A/bin/mkdir ${PACKAGE_DIR} ${PACKAGE_DIR}/logs
0N/A
0N/A# Now copy the package description info
493N/Aprint 'Copying package descriptions'
0N/A
493N/A/bin/cp copyright depend i.* r.* ${PACKAGE_DIR} >/dev/null 2>&1
0N/A
493N/Afor package in ${PACKAGE_LIST} common_files ; do
606N/A if [[ ! -d ${package} ]] ; then
606N/A print "packages/${package} not found ; skipping"
606N/A continue
606N/A fi
606N/A
493N/A cd ${package}
0N/A
493N/A /bin/mkdir ${PACKAGE_DIR}/${package}
493N/A /bin/cp p* d* lib* i.* r.* M* ${PACKAGE_DIR}/${package} >/dev/null 2>&1
0N/A
0N/A # We keep the master copyright in the top-level copyright file
0N/A # Packages that need additional copyright have copyright.add files
0N/A # that we then merge here
493N/A cp ../copyright ${PACKAGE_DIR}/${package}/copyright
355N/A
493N/A for F in copyright.add copyright.add.${MACH} ; do
493N/A if [[ -f $F ]] ; then
493N/A chmod +w ${PACKAGE_DIR}/${package}/copyright
606N/A process_includes "${PROTODIR}/licenses" $F \
606N/A >> ${PACKAGE_DIR}/${package}/copyright
493N/A fi
368N/A done
0N/A cd ..
0N/Adone
0N/A
0N/A
0N/A# Now move into the package staging area and build the packages.
493N/Acd ${PACKAGE_DIR}
0N/A
595N/Afor D in etc usr var lib licenses kernel ; do
0N/A /bin/rm -f $D
493N/A /bin/ln -s ${PROTODIR}/$D $D
0N/Adone
0N/A
595N/Afor D in openwin ; do
0N/A /bin/rm -f $D
493N/A /bin/ln -s ${PROTODIR}/usr/$D $D
0N/Adone
0N/A
0N/ALOGfile=logs/package_build
0N/A
493N/Aprint -- '---Building packages'
0N/A
0N/A# Variables to pass to pkgmk for use in prototype files
0N/A# They must start with lowercase letters to be resolved at pkgmk time
0N/APKGMK_VARS="plat_64=${PLAT_64} plat=${MACH}"
0N/A
493N/Afor package in ${PACKAGE_LIST} ; do
606N/A print "******** Making the ${package} package ********"
606N/A if [[ ! -d ${package} ]] ; then
606N/A print "${PACKAGE_DIR}/${package} was not found ; skipping"
606N/A continue
606N/A fi
606N/A
493N/A cd ${package}
493N/A date
0N/A
493N/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
493N/A if [[ -f Makefile ]] ; then
561N/A print_and_run /usr/ccs/bin/make SOURCEDIR=${PKG_SOURCE_DIR} all
561N/A else
561N/A for pf in preinstall preremove postinstall postremove ; do
561N/A # If filename.tmpl exists, but filename does not,
561N/A # build filename from the .tmpl
561N/A if [[ -f "${pf}.tmpl" && ! -f "${pf}" ]] ; then
561N/A SOURCEDIR=${PKG_SOURCE_DIR} \
561N/A nawk -f ${PKG_SOURCE_DIR}/awk_procedure \
561N/A ${pf}.tmpl > ${pf}
561N/A fi
561N/A done
493N/A fi
0N/A
606N/A for df in depend depend_${MACH} ; do
606N/A # If filename.tmpl exists, but filename does not,
606N/A # build filename from the .tmpl
606N/A if [[ -f "${df}.tmpl" && ! -f "${df}" ]] ; then
606N/A process_includes "${PKG_SOURCE_DIR}/${package}" ${df}.tmpl > ${df}
606N/A fi
606N/A done
606N/A
493N/A if [[ -f prototype ]] ; then
493N/A # Simple package with the same prototype on all platforms
493N/A PROTOTYPE="prototype"
493N/A else
493N/A # Package with some platform-specific settings in prototype
493N/A if [[ ! -f prototype_${MACH} ]]; then
493N/A ln -s prototype_com prototype_${MACH}
493N/A fi
493N/A PROTOTYPE="prototype_${MACH}"
493N/A fi
493N/A
493N/A print_and_run /usr/bin/pkgmk -d ${PACKAGE_DIR}/${package} -f ${PROTOTYPE} -o ${PKGMK_VARS}
493N/A
493N/A print "******** Done Making the ${package} package ********"
493N/A cd ..
0N/Adone >$LOGfile 2>&1
0N/A
493N/Aprint result log is in ${PACKAGE_DIR}/$LOGfile
0N/A
493N/Aprint -n "Packages built: "
493N/Agrep -c "Packaging complete" ${PACKAGE_DIR}/$LOGfile
493N/Aprint -n "Packages failed: "
493N/Agrep -c "Packaging was not successful" ${PACKAGE_DIR}/$LOGfile
29N/A
561N/A# Create an installdir with symlinks to built packages
493N/Acd ${PACKAGE_DIR}
0N/Amkdir installdir
0N/Acd installdir
561N/Afor package in ${PACKAGE_LIST} ; do
561N/A if [[ -d ../${package}/${package} ]] ; then
561N/A ln -s ../${package}/${package} .
561N/A fi
561N/Adone
561N/Aif [[ -f ${PKG_SOURCE_DIR}/upgrade-X ]] ; then
561N/A cp -p ${PKG_SOURCE_DIR}/upgrade-X .
29N/A chmod a+x upgrade-X
29N/Afi
0N/A
493N/Aexit 0