mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
ENH: improve flexibility of makeGcc for non-gcc builds
- ThirdParty GMP/MPFR may be needed when making CGAL, but previously no convenient means of compiling them without also compiling a ThirdParty GCC. Now support the combination of building GMP or MPFR, without needing to build GCC as well. This could benefit people using clang. - add a '-no-theadsafe' option when building MPFR via the makeGcc script. This may help avoid conflicts with existing, older, non-thread-safe system MPFR libraries.
This commit is contained in:
64
makeGcc
64
makeGcc
@ -4,7 +4,7 @@
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -74,6 +74,7 @@ usage: $Script [OPTION] [gcc-VERSION] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION]
|
||||
options:
|
||||
-multilib for 64-bit systems with 32-bit support required
|
||||
-no-multilib for 64-bit systems without 32-bit support (DEFAULT)
|
||||
-no-threadsafe disable mpfr thread-safe (default is auto-detect)
|
||||
-system use system versions for gmp/mpfr/mpc
|
||||
-help
|
||||
|
||||
@ -90,6 +91,7 @@ USAGE
|
||||
|
||||
# build 32-bit libraries on 64-bit systems (normally not needed)
|
||||
optMultilib=disable
|
||||
unset optThreadSafe # unset=auto
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
@ -104,6 +106,9 @@ do
|
||||
-no-multi*)
|
||||
optMultilib=disable
|
||||
;;
|
||||
-no-thread*)
|
||||
optThreadSafe=disable
|
||||
;;
|
||||
-sys*)
|
||||
gmpPACKAGE="gmp-system"
|
||||
mpfrPACKAGE="mpfr-system"
|
||||
@ -118,7 +123,7 @@ do
|
||||
mpc-[0-9]* | mpc-system)
|
||||
mpcPACKAGE="${1%%/}"
|
||||
;;
|
||||
gcc-[4-9]*)
|
||||
gcc-[4-9]* | gcc-system)
|
||||
gccPACKAGE="${1%%/}"
|
||||
;;
|
||||
*)
|
||||
@ -203,6 +208,14 @@ fi
|
||||
if [ -d "$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
|
||||
CONFIG_OPTIONS
|
||||
)
|
||||
else
|
||||
unset configGMP
|
||||
fi
|
||||
|
||||
|
||||
@ -230,12 +243,15 @@ else
|
||||
mkdir -p $buildDIR
|
||||
cd $buildDIR
|
||||
|
||||
unset configOpt
|
||||
# explicitly enable/disable thread-safe
|
||||
[ -n "$optThreadSafe" ] && configOpt="--${optThreadSafe}-thread-safe"
|
||||
|
||||
set -x
|
||||
$sourceDIR/configure ABI=$ABI \
|
||||
--prefix=$MPFR_ARCH_PATH \
|
||||
--libdir=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--with-gmp-include=$GMP_ARCH_PATH/include \
|
||||
--with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--prefix=$MPFR_ARCH_PATH \
|
||||
--libdir=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
$configGMP $configOpt \
|
||||
&& make -j $WM_NCOMPPROCS \
|
||||
&& make install \
|
||||
&& echo "Built: $mpfrPACKAGE"
|
||||
@ -248,6 +264,14 @@ fi
|
||||
if [ -d "$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
|
||||
CONFIG_OPTIONS
|
||||
)
|
||||
else
|
||||
unset configMPFR
|
||||
fi
|
||||
|
||||
|
||||
@ -279,10 +303,7 @@ else
|
||||
$sourceDIR/configure ABI=$ABI \
|
||||
--prefix=$MPC_ARCH_PATH \
|
||||
--libdir=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--with-gmp-include=$GMP_ARCH_PATH/include \
|
||||
--with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--with-mpfr-include=$MPFR_ARCH_PATH/include \
|
||||
--with-mpfr-lib=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
$configGMP $configMPFR \
|
||||
&& make -j $WM_NCOMPPROCS \
|
||||
&& make install \
|
||||
&& echo "Built: $mpcPACKAGE"
|
||||
@ -295,6 +316,14 @@ fi
|
||||
if [ -d "$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
|
||||
CONFIG_OPTIONS
|
||||
)
|
||||
else
|
||||
unset configMPC
|
||||
fi
|
||||
|
||||
|
||||
@ -309,6 +338,9 @@ echo "---------------"
|
||||
if [ -d $GCC_ARCH_PATH ]
|
||||
then
|
||||
echo "Already built: $gccPACKAGE"
|
||||
elif _foamIsSystem $GCC_ARCH_PATH
|
||||
then
|
||||
echo "Using gcc-system"
|
||||
else
|
||||
echo "Starting build: $gccPACKAGE"
|
||||
echo
|
||||
@ -323,10 +355,6 @@ else
|
||||
mkdir -p $buildDIR
|
||||
cd $buildDIR
|
||||
|
||||
_foamIsSystem "$GMP_ARCH_PATH" && GMP_ARCH_PATH=/usr # revert to system
|
||||
_foamIsSystem "$MPFR_ARCH_PATH" && MPFR_ARCH_PATH=/usr # revert to system
|
||||
_foamIsSystem "$MPC_ARCH_PATH" && MPC_ARCH_PATH=/usr # revert to system
|
||||
|
||||
unset configOpt
|
||||
# with/without multi-lib (32-bit support on 64-bit systems)
|
||||
[ -n "$optMultilib" ] && configOpt="--${optMultilib}-multilib"
|
||||
@ -334,18 +362,12 @@ else
|
||||
set -x
|
||||
$sourceDIR/configure \
|
||||
--prefix=$GCC_ARCH_PATH \
|
||||
--with-gmp-include=$GMP_ARCH_PATH/include \
|
||||
--with-gmp-lib=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--with-mpfr-include=$MPFR_ARCH_PATH/include \
|
||||
--with-mpfr-lib=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--with-mpc-include=$MPC_ARCH_PATH/include \
|
||||
--with-mpc-lib=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
||||
--with-pkgversion=OpenFOAM \
|
||||
--enable-languages=c,c++ \
|
||||
--enable-__cxa_atexit \
|
||||
--enable-libstdcxx-allocator=new \
|
||||
--with-system-zlib \
|
||||
$configOpt \
|
||||
$configGMP $configMPFR $configMPC $configOpt \
|
||||
MAKEINFO=missing \
|
||||
&& make -j $WM_NCOMPPROCS \
|
||||
&& make install \
|
||||
|
||||
Reference in New Issue
Block a user