1
1
openmpi/contrib/dist/make_dist_tarball
Ralph Castain 40a2bfa238 WARNING: Work on the temp branch being merged here encountered problems with bugs in subversion. Considerable effort has gone into validating the branch. However, not all conditions can be checked, so users are cautioned that it may be advisable to not update from the trunk for a few days to allow MTT to identify platform-specific issues.
This merges the branch containing the revamped build system based around converting autogen from a bash script to a Perl program. Jeff has provided emails explaining the features contained in the change.

Please note that configure requirements on components HAVE CHANGED. For example. a configure.params file is no longer required in each component directory. See Jeff's emails for an explanation.

This commit was SVN r23764.
2010-09-17 23:04:06 +00:00

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

#!/bin/sh
#
# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
#
# Version of auto tools that we want
#
M4_TARGET_VERSION=1.4.13
AM_TARGET_VERSION=1.11
AC_TARGET_VERSION=2.65
LT_TARGET_VERSION=2.2.6b
FLEX_TARGET_VERSION=2.5.35
#
# When running "make distcheck", use these parallelization flags. Can
# significantly decrease the time required for "make distcheck" because
# that target includes multiple builds of the entire code base.
#
DISTCHECK_MAKE_FLAGS=-j4
#########################################################################
#
# Check command line flags
#
# Default to requiring *exact* versions if we're making distribution
# tarballs; but higher-than-expected versions are ok for
# non-distribution tarballs.
dist_target=distcheck
distcheck_flags="AM_MAKEFLAGS=$DISTCHECK_MAKE_FLAGS"
if test "`basename $0`" = "make_tarball"; then
dist_target=dist
distcheck_flags=
highok=1
else
highok=0
fi
greekonly=0
want_ompi=1
autogen_args=
while test "$1" != ""; do
case $1 in
-greekonly) greekonly=1 ;;
--greekonly) greekonly=1 ;;
-highok) highok=1 ;;
--highok) highok=1 ;;
-no-ompi) want_ompi=0 ;;
--no-ompi) want_ompi=0 ;;
-autogen-args) autogen_args=$2; shift ;;
--autogen-args) autogen_args=$2; shift ;;
*)
echo Unrecognized argument: $1
exit 1
;;
esac
shift
done
#
# First things first -- check that the auto versions that we have are
# the ones that we want.
#
check_gnu_version() {
prog="$1"
target="$2"
ver="`$prog --version | head -n 1 | sed -e's/([^)]*)//g' -e's/[^0-9 .][^ ]* / /g' -e's/ //g'`"
echo $prog version is $ver
ver_major=`echo $ver | cut -d. -f1`
ver_minor=`echo $ver | cut -d. -f2`
ver_release=`echo $ver | cut -d. -f3`
if test "$ver_release" = ""; then
ver_release=0
fi
target_major=`echo $target | cut -d. -f1`
target_minor=`echo $target | cut -d. -f2`
target_release=`echo $target | cut -d. -f3`
if test "$target_release" = ""; then
target_release=0
fi
# Gah -- Libtool released version 2.2.6b, the "b" of which totally
# screws up the -lt and -gt comparisons, below. So strip out any
# trailing letters in the target_release and ver_release variables
# -- if they don't match, we'll just get a "they don't match
# somehow" kind of message (because I'm not going to code up a
# complex/clever alphanumeric lower/higher comparison thingy).
# Sigh.
ver_release=`echo $ver_release | sed 's/[a-z]//g'`
target_release=`echo $target_release | sed 's/[a-z]//g'`
result=same
if test "$ver" != "$target"; then
if test "$ver_major" -lt "$target_major"; then
result=low
elif test "$ver_major" = "$target_major" -a "$ver_minor" -lt "$target_minor"; then
result=low
elif test "$ver_major" = "$target_major" -a "$ver_minor" = "$target_minor" -a "$ver_release" -lt "$target_release"; then
result=low
elif test "$ver_major" -gt "$target_major"; then
result=high
elif test "$ver_major" = "$target_major" -a "$ver_minor" -gt "$target_minor"; then
result=high
elif test "$ver_major" = "$target_major" -a "$ver_minor" = "$target_minor" -a "$ver_release" -gt "$target_release"; then
result=high
else
result=unknown
fi
fi
if test "$result" = "low"; then
cat <<EOF
----------------------------------------------------------------------
ERROR: Program "$prog" does not have a high enough version:
Found: $ver
Expected: $target
Expected versions:
m4: $M4_TARGET_VERSION
Automake: $AM_TARGET_VERSION
Autoconf: $AC_TARGET_VERSION
Libtool: $LT_TARGET_VERSION
Flex: $FLEX_TARGET_VERSION
Either change this script to match the found version, or install
the correct version of the tools.
----------------------------------------------------------------------
EOF
exit 1
elif test "$result" = "high"; then
if test "$highok" = "0"; then
cat <<EOF
----------------------------------------------------------------------
ERROR: Program "$prog" has a higher version than expected:
Found: $ver
Expected: $target
Expected versions:
m4: $M4_TARGET_VERSION
Automake: $AM_TARGET_VERSION
Autoconf: $AC_TARGET_VERSION
Libtool: $LT_TARGET_VERSION
Flex: $FLEX_TARGET_VERSION
Either change this script to match the found version, or install
the correct version of the tools.
----------------------------------------------------------------------
EOF
exit 1
else
cat <<EOF
----------------------------------------------------------------------
WARNING: Program "$prog" has a higher version than expected:
Found: $ver
Expected: $target
Expected versions:
m4: $M4_TARGET_VERSION
Automake: $AM_TARGET_VERSION
Autoconf: $AC_TARGET_VERSION
Libtool: $LT_TARGET_VERSION
Flex: $FLEX_TARGET_VERSION
This is *usually* ok, but this script is going to sleep for 5 seconds
to give you the chance to quit before doing anything.
----------------------------------------------------------------------
EOF
sleep 5
fi
elif test "$result" = "unknown"; then
cat <<EOF
----------------------------------------------------------------------
ERROR: Program "$prog" does not have the correct version:
Found: $ver
Expected: $target
Expected versions:
m4: $M4_TARGET_VERSION
Automake: $AM_TARGET_VERSION
Autoconf: $AC_TARGET_VERSION
Libtool: $LT_TARGET_VERSION
Flex: $FLEX_TARGET_VERSION
Either change this script to match the found version, or install
the correct version of the tools.
----------------------------------------------------------------------
EOF
exit 1
fi
}
#
# Subroutine to actually make a tarball
#
make_tarball() {
#
# Autogen
#
echo "*** Running autogen $autogen_args..."
rm -f success
if test "$want_ompi" = "1" ; then
(./autogen.pl $autogen_args 2>&1 && touch success) | tee auto.out
else
(./autogen.pl -no-ompi $autogen_args 2>&1 && touch success) | tee auto.out
fi
if test ! -f success; then
echo "Autogen failed. Aborting"
exit 1
fi
#
# Configure
#
echo "*** Running configure..."
rm -f success
(./configure --enable-dist 2>&1 && touch success) | tee config.out
if test ! -f success; then
echo "Configure failed. Aborting"
exit 1
fi
#
# Remove all generated *_lex.c files so that we ensure to invoke
# flex from here in this script (to ensure that we're using a good
# version of flex, and not picking up random *_lex.c files that
# happened to be in the tree already).
#
echo "*** Removing old generated flex files..."
find . -name \*_lex.c -exec rm -f {} \; -print
#
# make tarball
#
echo "*** Running make $dist_target..."
save_LD=$LD_LIBRARY_PATH
LD_LIBRARY_PATH=
rm -f success
(make $distcheck_flags $dist_target 2>&1 && touch success) | tee dist.out
if test ! -f success; then
echo "Make $dist_target failed. Aborting"
exit 1
fi
rm -f success
LD_LIBRARY_PATH=$save_LD
#
# move
#
echo "*** Moving tarballs..."
mv openmpi-* ..
echo "*** All done"
}
#########################################################################
# main
#########################################################################
start=`date`
echo "*** Start time: $start"
echo "*** Checking tools versions..."
check_gnu_version m4 $M4_TARGET_VERSION
check_gnu_version automake $AM_TARGET_VERSION
check_gnu_version autoconf $AC_TARGET_VERSION
check_gnu_version libtool $LT_TARGET_VERSION
# Windows needs a recent version of flex; old versions don't generate
# Windows-friendly *_lex.c files.
check_gnu_version flex $FLEX_TARGET_VERSION
#
# Verify that we're in a top Open MPI dir
#
echo "*** Checking to ensure in top-level Open MPI directory..."
if test -f VERSION -a -f configure.ac -a -f config/opal_get_version.m4 ; then
happy=1
else
echo "Do not appear to be in an Open MPI top directory. Abort!"
exit 1
fi
#
# Do svn up and all that
#
if test -d .svn; then
echo "*** Removing old VERSION file..."
rm -f VERSION
echo "*** Running svn up..."
svn up
if test ! "$?" = "0"; then
echo "SVN update failed. Aborting"
exit 1
fi
echo "*** Getting svn r number..."
svn_r="r`svnversion .`"
elif test -d .hg; then
echo "*** Removing old VERSION file..."
rm -f VERSION
echo "*** Running hg up..."
hg revert VERSION
hg up
if test ! "$?" = "0"; then
echo "HG update failed. Aborting"
exit 1
fi
echo "*** Getting hg version number..."
svn_r="r`svnversion .`"
fi
#
# Ditch "svn/hg" from all version numbers
#
echo "*** Removing svn version numbers..."
version_files=VERSION
release_date=`date '+%b %d, %Y'`
for file in $version_files; do
echo " - $file"
sed -e 's/^want_svn=.*/want_svn=0/' \
-e 's/^svn_r=.*/'svn_r=$svn_r/ \
-e "s/^date=.*/date=\"$release_date\"/" \
$file > $file.new
cp -f $file.new $file
rm $file.new
done
#
# Make 2 tarballs:
#
# - one with the greek
# - one without the greek
#
# unless the user specifically said --greekonly, then only make the
# greek tarball. Making both tarballs at once allows us to guarantee
# to have two tarballs -- one greek and one not -- that have exactly
# the same SVN r number (as opposed to, for example, running this
# script to make a greek tarball, then running it again to make a
# non-greek tarball -- there is a race condition that someone could
# commit in the meantime and change the SVN r number in the 2nd
# tarball)
#
# First, make greek tarball
echo "*** Making greek tarball"
make_tarball
# Now if ! --greekonly, make the non-greek tarball
if test "$greekonly" = "0"; then
echo "*** REMOVING ALL GREEK FROM VERSION NUMBERS!!"
for file in $version_files; do
echo " - $file"
sed -e 's/^greek=.*/greek=/' $file > $file.new
cp -f $file.new $file
rm $file.new
done
echo "Making non-greek tarball"
make_tarball
fi
# Put the VERSION file back the way it was
if test -d .svn; then
svn revert VERSION
elif test -d .hg; then
hg revert VERSION
fi
echo " "
echo "*** Start time: $start"
echo "*** Finish time: `date`"