1
1
openmpi/contrib/dist/solaris/bld_solaris_pkgs
Dan Lacher 01512d6950 Ticket #621
typo in solaris comment

This commit was SVN r13965.
2007-03-08 14:20:24 +00:00

263 строки
6.6 KiB
Bash
Исполняемый файл

#!/bin/ksh
# Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
#
# This script takes as input to the prototype space of files that are to be
# encapsulated in Solaris packages. The installation must include both 32 and
# 64 bit libraries and prefixes in the correct manner.
#
# The steps to build are as follows using vpaths:
# % cd ompi-trunk
# % ./autogen.sh
# % mkdir -p vpath/64 vpath/32/ vpath/proto
#
# (sparc build)
# % cd vpath/64
# % ../../configure --enable-shared --enable-mpi-f90 \
# --with-tm=/path/to/OpenPBS --with-threads=solaris --enable-mpi-threads \
# CFLAGS="-xarch=v9" CXXFLAGS="-xarch=v9" FFLAGS="-stackvar -mt -dalign \
# -fpp -xarch=v9" FCFLAGS="-xarch=v9 -KPIC" --disable-binaries \
# --prefix=/opt/SUNWhpc/HPC7.0 --libdir=/opt/SUNWhpc/HPC7.0/lib/sparcv9 \
# --includedir=/opt/SUNWhpc/HPC7.0/include/v9
# % make DESTDIR=/path/to/ompi-trunk/vpath/proto install
# % cd ../32
# % ../../configure --enable-shared --enable-mpi-f90 \
# --with-tm=/path/to/OpenPBS --with-threads=solaris --enable-mpi-threads \
# CFLAGS="" CXXFLAGS="" FFLAGS="-stackvar -mt -dalign -fpp" \
# FCFLAGS="-KPIC" --prefix=/opt/SUNWhpc/HPC7.0 \
# --libdir=/opt/SUNWhpc/HPC7.0/lib --includedir=/opt/SUNWhpc/HPC7.0/include
# % make DESTDIR=/path/to/ompi-trunk/vpath/proto install
# % cd ../../contrib/dist/solaris
# % ./bld_solaris_pkgs -p /path/to/vpath/proto/opt/SUNWhpc/HPC7.0
#
# (amd/i386 build)
# % cd vpath/64
# % ../../configure --enable-shared --enable-mpi-f90 \
# --with-tm=/path/to/OpenPBS --with-threads=solaris --enable-mpi-threads \
# CFLAGS="" CXXFLAGS="" FFLAGS="-stackvar -mt -dalign \
# -fpp" FCFLAGS="-KPIC" \
# --prefix=/opt/SUNWhpc/HPC7.0 --libdir=/opt/SUNWhpc/HPC7.0/lib/amd64 \
# --includedir=/opt/SUNWhpc/HPC7.0/include/amd64
# % make DESTDIR=/path/to/ompi-trunk/vpath/proto install
# % cd ../32
# % ../../configure --enable-shared --enable-mpi-f90 \
# --with-tm=/path/to/OpenPBS --with-threads=solaris --enable-mpi-threads \
# CFLAGS="" CXXFLAGS="" FFLAGS="-stackvar -mt -dalign -fpp" \
# FCFLAGS="-KPIC" --prefix=/opt/SUNWhpc/HPC7.0 \
# --libdir=/opt/SUNWhpc/HPC7.0/lib --includedir=/opt/SUNWhpc/HPC7.0/include
# % make DESTDIR=/path/to/ompi-trunk/vpath/proto install
# % cd ../../contrib/dist/solaris
# % ./bld_solaris_pkgs -p /path/to/vpath/proto/opt/SUNWhpc/HPC7.0
#
# The packages will be built into
# .../ompi-trunk/contrib/dist/solaris/$PLATFORM/$ARCH/$DATE unless otherwise
# specified by the -b option to bld_solaris_pkgs
#
PATH=/usr/bin:/usr/sbin:${PATH}
#
# global variables
#
ARCH=`uname -p`
DATE=`date +'%Y.%m.%d'`
PKGNAMES="SUNWompi SUNWompimn SUNWomsc"
PLATFORM=`uname -s`
PROTO=
SED_PKGINFO_PROTO=sed_pkginfo_proto
SPOOLDEV=`pwd`"/${PLATFORM}/${ARCH}/${DATE}"
MY_IDNAME=`id | awk -F"(" '{print $2}' | awk -F")" '{print $1}'`
MY_IDGRP=`id | awk -F"(" '{print $3}' | awk -F")" '{print $1}'`
#
# build_package: This function takes as input the name of the package to build
# and constructs the package into ${SPOOLDEV}/${PLATFORM}/${ARCH}/${DATE}
#
function build_package
{
f_pkg_name=$1
if [ ${BASE} ] ; then
SPOOLDEV=${BASE}
fi
if [ ! -d ${SPOOLDEV} ] ; then
mkdir -p ${SPOOLDEV}
fi
pkgmk -b ${PROTO} -d ${SPOOLDEV} -f prototype.${f_pkg_name}
if [ $? != 0 ] ; then
print "Error in packaging ${f_pkg_name}"
cleanup_pkginfo ${f_pkg_name}
cleanup_prototype ${f_pkg_name}
exit 1
fi
}
#
# build_prototype: This function will create and update dynamic prototype files
# for open mpi
#
function build_prototype
{
f_proto_name=prototype.$1
if [ -f ${f_proto_name} ] ; then
rm -f ${f_proto_name}
fi
if [ -f ${f_proto_name}.tmp ] ; then
rm -f ${f_proto_name}.tmp
fi
# need to prepend copyright and some basic information
cat copyright > ${f_proto_name}.tmp 2>&1
cat << _EOF >> ${f_proto_name}.tmp
i pkginfo=pkginfo.${1}
i copyright
d none SUNWhpc 0755 root bin
_EOF
if [ "$1" = "SUNWompimn" ] ; then
echo "d none SUNWhpc/\$SUNW_PRODVERS 0755 root bin" >> ${f_proto_name}.tmp 2>&1
pkgproto ${PROTO}/man=SUNWhpc/\$SUNW_PRODVERS/man >> ${f_proto_name}.tmp 2>&1
fi
if [ "$1" = "SUNWomsc" ] ; then
echo "d none SUNWhpc/\$SUNW_PRODVERS 0755 root bin" >> ${f_proto_name}.tmp 2>&1
pkgproto ${PROTO}/examples=SUNWhpc/\$SUNW_PRODVERS/examples >> ${f_proto_name}.tmp 2>&1
fi
if [ "$1" = "SUNWompi" ] ; then
pkgproto ${PROTO}=SUNWhpc/\$SUNW_PRODVERS | egrep -v "man|examples|\.la" >> ${f_proto_name}.tmp 2>&1
fi
sed -f ${SED_PKGINFO_PROTO} ${f_proto_name}.tmp > ${f_proto_name}
if [ -f ${f_proto_name}.tmp ] ; then
rm -f ${f_proto_name}.tmp
fi
}
#
# build_sed_script: This function creates the temporary sed script that is used
# to process the pkginfo and prototype template files.
#
function build_sed_script
{
if [ -f ${SED_PKGINFO_PROTO} ] ; then
rm -f ${SED_PKGINFO_PROTO}
fi
cat << _EOF > ${SED_PKGINFO_PROTO}
s/\=\"ISA\"/\=\"${ARCH}\"/g
s/ ${MY_IDNAME} / root /g
s/ ${MY_IDGRP}/ bin/g
_EOF
}
#
# cleanup_pkginfo: This function takes a single input of a package name and
# removes the non-templete version of the pkginfo file after the package
# has been created.
#
function cleanup_pkginfo
{
f_pkginfo_name=pkginfo.$1
if [ -f ${f_pkginfo_name} ] ; then
rm -f ${f_pkginfo_name}
fi
}
#
# cleanup_prototype: This function takes a single input of a package name and
# removes the non-templete version of the prototype file after the package
# has been created.
#
function cleanup_prototype
{
f_proto_name=prototype.$1
if [ -f ${f_proto_name} ] ; then
rm -f ${f_proto_name}
fi
}
#
# update_pkginfo: This function takes a single input of a package name and
# creates the needed pkginfo file from the template and processing it
# with the sed_pkginfo_proto script.
#
function update_pkginfo
{
f_pkginfo_name=pkginfo.$1
if [ -f ${f_pkginfo_name} ] ; then
rm -f ${f_pkginfo_name}
fi
sed -f ${SED_PKGINFO_PROTO} ${f_pkginfo_name}.tmpl > ${f_pkginfo_name}
}
#
#
#
function usage
{
prog=`basename $0`
print "Usage: ${prog} [-b build-base] -p proto-dir"
print " -b path to place built packages"
print " -p path to the prototype space of files to be packaged"
}
#
# main
#
if (( $# < 1 )) ; then
usage
exit 1
fi
while getopts b:p: a
do
case "$a" in
b) BASE=$OPTARG;;
p) PROTO=$OPTARG;;
esac
done
if [ ! ${PROTO} ] ; then
usage
exit 1
fi
if [ ! -d ${PROTO} ]; then
print "Error: the proto space ${PROTO} does not exist."
usage
exit 1
fi
build_sed_script
for pkg in ${PKGNAMES}
do
update_pkginfo ${pkg}
build_prototype ${pkg}
build_package ${pkg}
cleanup_pkginfo ${pkg}
cleanup_prototype ${pkg}
done
rm ${SED_PKGINFO_PROTO}
exit 0