ENH: improve test for existing libraries (fixes #56)

- check lib as well as lib64

- support -force option in a few more places
This commit is contained in:
Mark Olesen
2020-08-10 13:02:47 +02:00
parent 9a8a4852bc
commit 11e3723f10
9 changed files with 195 additions and 123 deletions

View File

@ -27,15 +27,23 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] \ [ -d "$dir/include" ] || exit 2
&& [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
then package="adios2"
echo " adios2 include: $dir/include" libName="libadios2"
echo " adios2 library: $dir/lib$WM_COMPILER_LIB_ARCH" for lib in \
exit 0 "$dir/lib/$libName$EXT_SO" \
else "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
exit 2 ;
fi do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
@ -135,10 +143,12 @@ echo
# - for mpi-specific library locations # - for mpi-specific library locations
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -f "$ADIOS2_ARCH_PATH/include/adios2.h" ] \ && [ -f "$ADIOS2_ARCH_PATH/include/adios2.h" ] \
&& [ -r "$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ] && {
[ -r "$ADIOS2_ARCH_PATH/lib/libadios2$EXT_SO" ] \
|| [ -r "$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
}
then then
echo " ADIOS2 header in $ADIOS2_ARCH_PATH/include" echo " ADIOS2 already built : $ADIOS2_ARCH_PATH"
echo " ADIOS2 libs in $ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
else else
# CMake options often lag the configure ones # CMake options often lag the configure ones
echo "Starting build: $adiosPACKAGE (using cmake)" echo "Starting build: $adiosPACKAGE (using cmake)"

View File

@ -35,7 +35,10 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; } [ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] && [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL$EXT_SO" ] [ -d "$dir/include" ] || exit 2
# 2020-08-10: Needs reworking for header-only installations!
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL$EXT_SO" ]
then then
echo " CGAL include: $dir/include" echo " CGAL include: $dir/include"
echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH" echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH"
@ -115,7 +118,7 @@ USAGE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optHeadersOnly optToolset unset optForce optHeadersOnly optToolset
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -124,6 +127,7 @@ do
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help) usage ;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;;
-cmake) -cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
@ -243,16 +247,17 @@ then
fi fi
# Use lib/ when lib64/ does not exist # Use lib/ when lib64/ does not exist
[ ! -d "$boostLib" -a -d "$libdir" ] && boostLib="$libdir" [ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir"
elif [ -f "$boostInc/boost/version.hpp" ] elif [ -z "$optForce" ] \
&& [ -f "$boostInc/boost/version.hpp" ]
then then
echo "Using $boostPACKAGE" echo "Using $boostPACKAGE"
libdir="$BOOST_ARCH_PATH/lib" libdir="$BOOST_ARCH_PATH/lib"
# Use lib when lib64 does not exist # Use lib when lib64 does not exist
[ ! -d "$boostLib" -a -d "$libdir" ] && boostLib="$libdir" [ -d "$libdir" -a ! -d "$boostLib" ] && boostLib="$libdir"
else else
echo "Starting build: $boostPACKAGE" echo "Starting build: $boostPACKAGE"
@ -263,11 +268,7 @@ else
# Configuration options: # Configuration options:
unset buildOpt unset buildOpt
cd "$BOOST_SOURCE_DIR" || exit # Compiler-specific adjustments
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
rm -rf $BOOST_ARCH_PATH
case "$WM_COMPILER" in case "$WM_COMPILER" in
(Arm*) (Arm*)
# Toolset for bootstrap # Toolset for bootstrap
@ -306,6 +307,14 @@ else
;; ;;
esac esac
# End of configuration options
# ----------------------------
cd "$BOOST_SOURCE_DIR" || exit
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
rm -rf "$BOOST_ARCH_PATH"
./bootstrap.sh \ ./bootstrap.sh \
--prefix="$BOOST_ARCH_PATH" \ --prefix="$BOOST_ARCH_PATH" \
--libdir="$boostLib" \ --libdir="$boostLib" \
@ -481,13 +490,13 @@ cgalIsCurrent()
} }
if cgalIsCurrent if [ -z "$optForce" ] \
&& cgalIsCurrent
then then
echo " ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping" echo " ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping"
echo echo
exit 0 exit 0
fi else
( (
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
if [ -d "$CGAL_BUILD_DIR" ] if [ -d "$CGAL_BUILD_DIR" ]
@ -604,6 +613,7 @@ CMAKE_OPTIONS
unset cmakeDefs unset cmakeDefs
# Compiler-specific adjustments
case "$WM_COMPILER" in case "$WM_COMPILER" in
(Mingw*) (Mingw*)
cmakeDefs="$cmakeDefs -DCMAKE_SYSTEM_NAME=Windows" cmakeDefs="$cmakeDefs -DCMAKE_SYSTEM_NAME=Windows"
@ -658,5 +668,6 @@ CMAKE_OPTIONS
echo "Done CGAL" echo "Done CGAL"
) )
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -28,15 +28,23 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] \ [ -d "$dir/include" ] || exit 2
&& [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ]
then package="fftw"
echo " fftw include: $dir/include" libName="libfftw3"
echo " fftw library: $dir/lib$WM_COMPILER_LIB_ARCH" for lib in \
exit 0 "$dir/lib/$libName$EXT_SO" \
else "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
exit 2 ;
fi do
if [ -r "$lib" ]
then
echo " $package include: $dir/include"
echo " $package library: ${lib%/*}"
exit 0
fi
done
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
@ -127,9 +135,13 @@ FFTW_SOURCE_DIR=$sourceBASE/$fftwPACKAGE
FFTW_ARCH_PATH=$installBASE/$fftwPACKAGE FFTW_ARCH_PATH=$installBASE/$fftwPACKAGE
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ] && {
[ -r "$FFTW_ARCH_PATH/lib/libfftw3$EXT_SO" ] \
|| [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3$EXT_SO" ] \
|| [ -r "$FFTW_ARCH_PATH/bin/libfftw3-3$EXT_SO" ] # Windows
}
then then
echo "Already has FFTW shared library" echo "FFTW already built : $FFTW_ARCH_PATH"
else else
echo "Starting build: FFTW ($fftwPACKAGE)" echo "Starting build: FFTW ($fftwPACKAGE)"
echo echo

View File

@ -28,24 +28,25 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] [ -d "$dir/include" ] || exit 2
then
for lib in \ package="kahip"
$FOAM_EXT_LIBBIN/libkahip$EXT_SO \ libName="libkahip"
$dir/lib/libkahip.a \ for lib in \
$dir/lib/libkahip$EXT_SO \ "$FOAM_EXT_LIBBIN/$libName$EXT_SO" \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip.a \ "$dir/lib/$libName.a" \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip$EXT_SO \ "$dir/lib/$libName$EXT_SO" \
; "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
do "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
if [ -r "$lib" ] ;
then do
echo " kahip include: $dir/include" if [ -r "$lib" ]
echo " kahip library: ${lib%/*}" then
exit 0 echo " $package include: $dir/include"
fi echo " $package library: ${lib%/*}"
done exit 0
fi fi
done
exit 2 exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -28,24 +28,25 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" ] [ -d "$dir/include" ] || exit 2
then
for lib in \ package="metis"
$FOAM_EXT_LIBBIN/libmetis$EXT_SO \ libName="libmetis"
$dir/lib/libmetis.a \ for lib in \
$dir/lib/libmetis$EXT_SO \ "$FOAM_EXT_LIBBIN/$libName$EXT_SO" \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis.a \ "$dir/lib/$libName.a" \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis$EXT_SO \ "$dir/lib/$libName$EXT_SO" \
; "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
do "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
if [ -r "$lib" ] ;
then do
echo " metis include: $dir/include" if [ -r "$lib" ]
echo " metis library: ${lib%/*}" then
exit 0 echo " $package include: $dir/include"
fi echo " $package library: ${lib%/*}"
done exit 0
fi fi
done
exit 2 exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -138,12 +138,13 @@ install()
# - for shared library # - for shared library
# - for mpi-specific library locations # - for mpi-specific library locations
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -f "$MGRIDGEN_ARCH_PATH/include/mgridgen.h" \ && [ -f "$MGRIDGEN_ARCH_PATH/include/mgridgen.h" ] \
&& [ -r "$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmgrid.a" ] && {
[ -r "$MGRIDGEN_ARCH_PATH/lib/libmgrid.a" ] \
|| [ -r "$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmgrid.a" ]
}
then then
echo " MGridGen header in $MGRIDGEN_ARCH_PATH/include" echo " MGridGen already built : $MGRIDGEN_ARCH_PATH"
echo " MGridGen libs in $MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
echo
else else
( (
cd "$MGRIDGEN_SOURCE_DIR" || exit cd "$MGRIDGEN_SOURCE_DIR" || exit

View File

@ -28,18 +28,24 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
then package="mpich"
echo "Have mpich shared library (${dir##*/})" libName="libmpi"
exit 0 for lib in \
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] "$dir/lib/$libName.a" \
then "$dir/lib/$libName$EXT_SO" \
echo "Have mpich static library (${dir##*/})" "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
exit 0 "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
else ;
echo "No mpich libraries found: ${dir:-not-specified}" do
exit 2 if [ -r "$lib" ]
fi then
echo "Have $package shared library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
@ -133,13 +139,19 @@ MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE MPI_ARCH_PATH=$installBASE/$mpiPACKAGE
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ] && {
[ -r "$MPI_ARCH_PATH/lib/libmpi$EXT_SO" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then then
echo "Already has shared library" echo "Already has shared library: $MPI_ARCH_PATH"
elif [ -z "$optForce" ] \ elif [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] && {
[ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then then
echo "Already has static library" echo "Already has static library: $MPI_ARCH_PATH"
else else
echo "Starting build: $WM_MPLIB ($mpiPACKAGE)" echo "Starting build: $WM_MPLIB ($mpiPACKAGE)"
echo echo

View File

@ -28,18 +28,24 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
then package="mvapich"
echo "Have mpich shared library (${dir##*/})" libName="libmpi"
exit 0 for lib in \
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] "$dir/lib/$libName.a" \
then "$dir/lib/$libName$EXT_SO" \
echo "Have mpich static library (${dir##*/})" "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
exit 0 "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
else ;
echo "No mpich libraries found: ${dir:-not-specified}" do
exit 2 if [ -r "$lib" ]
fi then
echo "Have $package library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
@ -137,13 +143,19 @@ MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE MPI_ARCH_PATH=$installBASE/$mpiPACKAGE
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ] && {
[ -r "$MPI_ARCH_PATH/lib/libmpi$EXT_SO" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then then
echo "Already has shared library" echo "Already has shared library: $MPI_ARCH_PATH"
elif [ -z "$optForce" ] \ elif [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] && {
[ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then then
echo "Already has static library" echo "Already has static library: $MPI_ARCH_PATH"
else else
echo "Starting build: $WM_MPLIB ($mpiPACKAGE)" echo "Starting build: $WM_MPLIB ($mpiPACKAGE)"
echo echo

View File

@ -28,18 +28,24 @@ if [ "$1" = "-test" ]
then then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="${2%/}" # <- *_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
then package="openmpi"
echo " Have openmpi shared library (${dir##*/})" libName="libmpi"
exit 0 for lib in \
elif [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] "$dir/lib/$libName.a" \
then "$dir/lib/$libName$EXT_SO" \
echo " Have openmpi static library (${dir##*/})" "$dir/lib$WM_COMPILER_LIB_ARCH/$libName.a" \
exit 0 "$dir/lib$WM_COMPILER_LIB_ARCH/$libName$EXT_SO" \
else ;
echo "No openmpi libraries found: ${dir:-not-specified}" do
exit 2 if [ -r "$lib" ]
fi then
echo "Have $package library (${dir##*/})"
exit 0
fi
done
echo "No $package libraries found: ${dir:-not-specified}"
exit 2
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Run from third-party directory only # Run from third-party directory only
@ -139,11 +145,17 @@ MPI_SOURCE_DIR=$sourceBASE/$mpiPACKAGE
MPI_ARCH_PATH=$installBASE/$mpiPACKAGE MPI_ARCH_PATH=$installBASE/$mpiPACKAGE
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ] && {
[ -r "$MPI_ARCH_PATH/lib/libmpi$EXT_SO" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi$EXT_SO" ]
}
then then
echo "Already has shared library: $MPI_ARCH_PATH" echo "Already has shared library: $MPI_ARCH_PATH"
elif [ -z "$optForce" ] \ elif [ -z "$optForce" ] \
&& [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ] && {
[ -r "$MPI_ARCH_PATH/lib/libmpi.a" ] \
|| [ -r "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpi.a" ]
}
then then
echo "Already has static library: $MPI_ARCH_PATH" echo "Already has static library: $MPI_ARCH_PATH"
else else