mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
ENH: remove reliance on OpenFOAM etc/config.sh/functions file.
- similar functionality in etc/tools/ThirdPartyFunctions to improve the independence of ThirdParty while reducing clutter in the callers. - add useGcc function for convenience - mask seeing our own git-repo when building STYLE: various items - eliminate old user-editable configuration in files - now command-line only. - use *_BUILD_DIR instead of *_BINARY_DIR for more clarity of the purpose - drop use of '-q' option for wmakeCheckPwd (already has stderr redirect) - drop checkVersion for makeParaView since it stopped working properly with newer paraview version CONFIG: update list of versions
This commit is contained in:
47
makeGcc
47
makeGcc
@ -44,24 +44,25 @@
|
||||
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
|
||||
#------------------------------------------------------------------------------
|
||||
# Run from third-party directory only
|
||||
cd ${0%/*} && wmakeCheckPwd -q "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
||||
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
||||
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
}
|
||||
. etc/tools/ThirdPartyFunctions
|
||||
#------------------------------------------------------------------------------
|
||||
# Default GCC, mpfr, gmp and mpc versions from OpenFOAM etc/config.sh file
|
||||
WM_COMPILER_TYPE=ThirdParty # ensure we get the correct compiler settings
|
||||
: ${WM_COMPILER:=Gcc} # this will still fail if 'Clang' was set
|
||||
|
||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler)
|
||||
[ "${WM_COMPILER#Gcc}" = "$WM_COMPILER" ] && WM_COMPILER=Gcc # Force gcc
|
||||
WM_COMPILER_TYPE=ThirdParty # Ensure we get the correct settings
|
||||
|
||||
# Default GCC, mpfr, gmp and mpc versions from OpenFOAM etc/config.sh file:
|
||||
_foamEtc config.sh/compiler
|
||||
|
||||
gmpPACKAGE=${gmp_version:-gmp-system}
|
||||
mpfrPACKAGE=${mpfr_version:-mpfr-system}
|
||||
mpcPACKAGE=${mpc_version:-mpc-system}
|
||||
gccPACKAGE=$gcc_version
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
usage() {
|
||||
exec 1>&2
|
||||
@ -94,9 +95,9 @@ unset optThreadSafe # unset=auto
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help)
|
||||
usage
|
||||
;;
|
||||
'') ;; # Ignore empty
|
||||
-h | -help) usage ;;
|
||||
|
||||
-multi*)
|
||||
optMultilib=enable
|
||||
;;
|
||||
@ -163,6 +164,18 @@ GMP_ARCH_PATH=$installBASE/$gmpPACKAGE
|
||||
MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
|
||||
MPC_ARCH_PATH=$installBASE/$mpcPACKAGE
|
||||
|
||||
# Prefix <dir> to LD_LIBRARY_PATH, if it exists. 0 on success, 1 on failure
|
||||
addLib()
|
||||
{
|
||||
if [ -d "$1" ]
|
||||
then
|
||||
export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# ================
|
||||
# Build GMP
|
||||
@ -182,6 +195,7 @@ else
|
||||
buildDIR=$buildBASE/$gmpPACKAGE
|
||||
|
||||
cd $sourceDIR || exit 1
|
||||
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
|
||||
make distclean 2>/dev/null
|
||||
|
||||
rm -rf $buildDIR
|
||||
@ -203,10 +217,8 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -d "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" ]
|
||||
if addLib "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
||||
then
|
||||
_foamAddLib "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
||||
|
||||
configGMP=$(cat <<CONFIG_OPTIONS
|
||||
--with-gmp-include=$GMP_ARCH_PATH/include
|
||||
--with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
||||
@ -235,6 +247,7 @@ else
|
||||
buildDIR=$buildBASE/$mpfrPACKAGE
|
||||
|
||||
cd $sourceDIR || exit 1
|
||||
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
|
||||
make distclean 2>/dev/null
|
||||
|
||||
rm -rf $buildDIR
|
||||
@ -260,10 +273,8 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -d "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" ]
|
||||
if addLib "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
||||
then
|
||||
_foamAddLib "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
||||
|
||||
configMPFR=$(cat <<CONFIG_OPTIONS
|
||||
--with-mpfr-include=$MPFR_ARCH_PATH/include \
|
||||
--with-mpfr-lib=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
||||
@ -292,6 +303,7 @@ else
|
||||
buildDIR=$buildBASE/$mpcPACKAGE
|
||||
|
||||
cd $sourceDIR || exit 1
|
||||
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
|
||||
make distclean 2>/dev/null
|
||||
|
||||
rm -rf $buildDIR
|
||||
@ -313,10 +325,8 @@ else
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -d "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" ]
|
||||
if addLib "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
||||
then
|
||||
_foamAddLib "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
||||
|
||||
configMPC=$(cat <<CONFIG_OPTIONS
|
||||
--with-mpc-include=$MPC_ARCH_PATH/include \
|
||||
--with-mpc-lib=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
||||
@ -349,6 +359,7 @@ else
|
||||
buildDIR=$buildBASE/$gccPACKAGE
|
||||
|
||||
cd $sourceDIR || exit 1
|
||||
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
|
||||
make distclean 2>/dev/null
|
||||
|
||||
rm -rf $buildDIR
|
||||
|
||||
Reference in New Issue
Block a user