From 8156ee2b1f519c6ba7b14fd0539a39dce97c942f Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Wed, 1 Dec 2010 08:07:16 -0500 Subject: [PATCH] Updating the ThirdParty packages env. variables before compiling a new package. Applying same recipe before compiling the OpenFOAM source code. --- Allwmake | 6 ++++- ThirdParty/AllMake.stage3 | 25 ++++++------------- .../tools/makeThirdPartyFunctionsForRPM | 10 +++++++- etc/settings.sh | 13 ++++++++++ 4 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Allwmake b/Allwmake index 2458a1916..886b05cd0 100755 --- a/Allwmake +++ b/Allwmake @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash cd ${0%/*} || exit 1 # run from this directory if [ "$PWD" != "$WM_PROJECT_DIR" ] @@ -16,6 +16,10 @@ fi #( cd $WM_THIRD_PARTY_DIR && ./Allwmake ) ( cd $WM_THIRD_PARTY_DIR && ./AllMake ) +# We make sure the ThirdParty packages environment variables are up-to-date +# before compiling the rest of OpenFOAM +. $WM_PROJECT_DIR/etc/settings.sh + # build OpenFOAM libraries and applications src/Allwmake applications/Allwmake diff --git a/ThirdParty/AllMake.stage3 b/ThirdParty/AllMake.stage3 index 97ae61948..595b4021b 100755 --- a/ThirdParty/AllMake.stage3 +++ b/ThirdParty/AllMake.stage3 @@ -56,7 +56,6 @@ echo Starting ThirdParty AllMake: Stage3 echo ======================================== echo - # Metis ( rpm_make metis-5.0pre2 http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.0pre2.tar.gz ) @@ -69,25 +68,17 @@ echo # Mesquite ( rpm_make mesquite-2.1.2 http://software.sandia.gov/~jakraft/mesquite-2.1.2.tar.gz ) +# The following two packages depends on the availability of OpenMPI +# The macro rpm_make() will make sure to update the ThirdParty environment variables before starting +# the compilation. +# Just make sure the OpenMPI environment variables are properly initialized, or that +# the AllMake.stage2 script completed correctly +# # Scotch -if [ -d "$OPENMPI_DIR" ]; then - ( rpm_make scotch-5.1.10b https://gforge.inria.fr/frs/download.php/27583/scotch-5.1.10b.tar.gz ) -else - echo "WARNING: The OPENMPI_DIR environment variable is not set." - echo "WARNING: Please make sure your environment is properly set up for openmpi. This is necessary for compiling scotch-5.1.10b" - echo "WARNING: Skipping the compilation of scotch-5.1.10b" - echo "" -fi +( rpm_make scotch-5.1.10b https://gforge.inria.fr/frs/download.php/27583/scotch-5.1.10b.tar.gz ) # ParMetis -if [ -d "$OPENMPI_DIR" ]; then - ( rpm_make ParMetis-3.1.1 http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/ParMetis-3.1.1.tar.gz ) -else - echo "WARNING: The OPENMPI_DIR environment variable is not set." - echo "WARNING: Please make sure your environment is properly set up for openmpi. This is necessary for compiling ParMetis-3.1.1" - echo "WARNING: Skipping the compilation of ParMetis-3.1.1" - echo "" -fi +( rpm_make ParMetis-3.1.1 http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/ParMetis-3.1.1.tar.gz ) echo ======================================== echo Done ThirdParty AllMake: Stage3 diff --git a/ThirdParty/tools/makeThirdPartyFunctionsForRPM b/ThirdParty/tools/makeThirdPartyFunctionsForRPM index e4d5aa7bc..c1454226f 100755 --- a/ThirdParty/tools/makeThirdPartyFunctionsForRPM +++ b/ThirdParty/tools/makeThirdPartyFunctionsForRPM @@ -50,6 +50,11 @@ echo "" rpm_make() { package="$1" + + # Make sure the ThirdParty environment is up-to-date + echo "Updating the ThirdParty environment variables before building package $package" + . $WM_PROJECT_DIR/etc/settings.sh + rpmName=$package-$WM_OPTIONS.$architecture rpmFile=$buildBase/RPMS/$architecture/$rpmName.rpm @@ -121,7 +126,10 @@ rpm_build() #Build RPM package echo "Building package $package" - rpmbuild --define "_topdir $buildBase" --dbpath $buildBase/rpmDB --clean -bb ./SPECS/$specFile "$@" + #rpmbuild --define "_topdir $buildBase" --dbpath $buildBase/rpmDB --clean -bb ./SPECS/$specFile "$@" + # + # Let's keep the compilation directory alive for now in order to facilitate postmortems of failed compilations + rpmbuild --define "_topdir $buildBase" --dbpath $buildBase/rpmDB -bb ./SPECS/$specFile "$@" } # diff --git a/etc/settings.sh b/etc/settings.sh index e0d2d6831..bec6bab7e 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -55,6 +55,19 @@ _foamAddLib() done } +# Source files, possibly with some verbosity +# Yes, this is the same definition as in the file etc/bash +# We need that definition available for scripts sourcing +# settings.sh directly. +_foamSource() +{ + while [ $# -ge 1 ] + do + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" + . $1 + shift + done +} # location of the jobControl directory export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl