ENH: support use of system gmp/mpfr/mpc with ThirdParty gcc

- not previously possible to configure a third-party gcc
  with system gmp/mpfr/mpc.
  This makes it easier to switch between compilers for testing.
This commit is contained in:
mark
2016-06-16 17:51:56 +02:00
parent 5d63dd1b5a
commit b66ec91d01
3 changed files with 103 additions and 27 deletions

View File

@ -61,6 +61,19 @@ then
fi fi
# Test if it matches "*-none"
_foamIsNone()
{
test "${1##*-}" = none
}
# Test if it matches "*-system"
_foamIsSystem()
{
test "${1##*-}" = system
}
# #
# Download file $1 from url $2 into download/ directory # Download file $1 from url $2 into download/ directory
# #

View File

@ -59,15 +59,17 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
} }
. etc/tools/ThirdPartyFunctions . etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script="${0##*/}"
usage() { usage() {
exec 1>&2 exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION] usage: $Script [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION]
options: options:
-gcc force g++ instead of the value from \$WM_CXX -gcc force g++ instead of the value from \$WM_CXX
-system use system versions for boost/gmp/mpfr
-help -help
* build CGAL with * build CGAL with
@ -77,9 +79,9 @@ options:
$mpfrPACKAGE $mpfrPACKAGE
Normally builds against ThirdParty boost and gmp/mpfr when possible. Normally builds against ThirdParty boost and gmp/mpfr when possible.
To override this behaviour (and use the system boost and/o gmp/mpfr), To override this behaviour (and use the system boost and/or gmp/mpfr),
simply specify a 'system' version. For example, simply specify a 'system' version. For example,
${0##*/} boost-system gmp-system $Script boost-system gmp-system
Note: mixing system and ThirdParty for gmp/mpfr is not supported. Note: mixing system and ThirdParty for gmp/mpfr is not supported.
@ -106,11 +108,17 @@ do
export CXX=g++ # use g++ export CXX=g++ # use g++
shift shift
;; ;;
gmp-[4-9]* | gmp-sys*) -sys*)
gmpPACKAGE="gmp-system"
mpfrPACKAGE="mpfr-system"
boostPACKAGE="boost-system"
shift
;;
gmp-[4-9]* | gmp-system)
gmpPACKAGE="${1%%/}" gmpPACKAGE="${1%%/}"
shift shift
;; ;;
mpfr-[2-9]* | mpfr-sys*) mpfr-[2-9]* | mpfr-system)
mpfrPACKAGE="${1%%/}" mpfrPACKAGE="${1%%/}"
shift shift
;; ;;
@ -118,7 +126,7 @@ do
cgalPACKAGE="${1%%/}" cgalPACKAGE="${1%%/}"
shift shift
;; ;;
boost-[0-9]* | boost_[0-9]* | boost-sys* ) boost-[0-9]* | boost_[0-9]* | boost-system )
boostPACKAGE="${1%%/}" boostPACKAGE="${1%%/}"
shift shift
;; ;;
@ -146,12 +154,27 @@ if [ -d "$BOOST_ARCH_PATH" ]
then then
boostInc="$BOOST_ARCH_PATH/include" boostInc="$BOOST_ARCH_PATH/include"
boostLib="$BOOST_ARCH_PATH/lib" boostLib="$BOOST_ARCH_PATH/lib"
elif [ -d "$BOOST_SOURCE_DIR" ] elif _foamIsSystem $BOOST_ARCH_PATH
then then
echo "Using boost-system"
boostInc="/usr/include"
# For completeness:
# 64-bit needs lib64, but 32-bit needs lib (not lib32)
if [ "$WM_ARCH_OPTION" = 64 ]
then
boostLib="/usr/lib$WM_ARCH_OPTION"
else
boostLib="/usr/lib"
fi
else
echo "Starting build: boost"
echo
boostInc="$BOOST_ARCH_PATH/include" boostInc="$BOOST_ARCH_PATH/include"
boostLib="$BOOST_ARCH_PATH/lib" boostLib="$BOOST_ARCH_PATH/lib"
echo "Starting build: boost"
( (
cd $BOOST_SOURCE_DIR || exit 1 cd $BOOST_SOURCE_DIR || exit 1
@ -167,17 +190,13 @@ then
echo "Error building: boost" echo "Error building: boost"
exit 1 exit 1
} }
else fi
boostInc="/usr/include"
# For completeness: # nothing to build
# 64-bit needs lib64, but 32-bit needs lib (not lib32) if _foamIsSystem "$cgalPACKAGE"
if [ "$WM_ARCH_OPTION" = 64 ] then
then echo "Using CGAL-system"
boostLib="/usr/lib$WM_ARCH_OPTION" exit 0
else
boostLib="/usr/lib"
fi
fi fi
# nothing left to build # nothing left to build
@ -242,7 +261,7 @@ MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
cd $CGAL_BINARY_DIR || exit 1 cd $CGAL_BINARY_DIR || exit 1
unset configBoost configGmpMpfr unset configBoost configGmp configMpfr
echo "----" echo "----"
echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION_NO" echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION_NO"
echo " Source : $CGAL_SOURCE_DIR" echo " Source : $CGAL_SOURCE_DIR"
@ -271,22 +290,32 @@ CMAKE_OPTIONS
) )
fi fi
if [ -d "$GMP_ARCH_PATH" -a -d "$MPFR_ARCH_PATH" ] if [ -d "$GMP_ARCH_PATH" ]
then then
echo " ThirdParty : gmp/mpfr" echo " ThirdParty : gmp"
configGmpMpfr=$(cat <<CMAKE_OPTIONS configGmp=$(cat <<CMAKE_OPTIONS
-DGMP_INCLUDE_DIR=$GMP_ARCH_PATH/include -DGMP_INCLUDE_DIR=$GMP_ARCH_PATH/include
-DGMP_LIBRARIES_DIR=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH -DGMP_LIBRARIES_DIR=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
-DGMP_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmp.so -DGMP_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmp.so
-DGMPXX_INCLUDE_DIR=$GMP_ARCH_PATH/include -DGMPXX_INCLUDE_DIR=$GMP_ARCH_PATH/include
-DGMPXX_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmpxx.so -DGMPXX_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmpxx.so
CMAKE_OPTIONS
)
else
echo " system : gmp"
fi
if [ -d "$MPFR_ARCH_PATH" ]
then
echo " ThirdParty : mpfr"
configMpfr=$(cat <<CMAKE_OPTIONS
-DMPFR_INCLUDE_DIR=$MPFR_ARCH_PATH/include -DMPFR_INCLUDE_DIR=$MPFR_ARCH_PATH/include
-DMPFR_LIBRARIES_DIR=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH -DMPFR_LIBRARIES_DIR=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
-DMPFR_LIBRARIES=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpfr.so -DMPFR_LIBRARIES=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpfr.so
CMAKE_OPTIONS CMAKE_OPTIONS
) )
else else
echo " system : gmp/mpfr" echo " system : mpfr"
fi fi
echo "----" echo "----"
@ -295,7 +324,7 @@ CMAKE_OPTIONS
-DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \ -DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DWITH_CGAL_Qt5=OFF \ -DWITH_CGAL_Qt5=OFF \
$configBoost $configGmpMpfr \ $configBoost $configGmp $configMpfr \
$CGAL_SOURCE_DIR \ $CGAL_SOURCE_DIR \
&& make -j $WM_NCOMPPROCS \ && make -j $WM_NCOMPPROCS \
&& make install || exit 1 && make install || exit 1

40
makeGcc
View File

@ -28,6 +28,10 @@
# Description # Description
# Build script gcc and gmp, mpfr, mpc. # Build script gcc and gmp, mpfr, mpc.
# #
# Normally builds against ThirdParty gmp/mpfr when possible.
# To override this behaviour (and use the system gmp/mpfr/mpc),
# simply specify a 'system' version. For example,
# makeGcc gmp-system
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# get default GCC, mpfr, gmp and mpc versions # get default GCC, mpfr, gmp and mpc versions
@ -62,6 +66,7 @@ usage() {
usage: $Script [OPTION] [gcc-VERSION] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION] usage: $Script [OPTION] [gcc-VERSION] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION]
options: options:
-no-multilib for 64-bit systems without 32-bit support -no-multilib for 64-bit systems without 32-bit support
-system use system versions for gmp/mpfr/mpc
-help -help
* build combinations of gmp, mpfr, mpc and gcc * build combinations of gmp, mpfr, mpc and gcc
@ -88,15 +93,21 @@ do
GCC_BUILD_OPTIONS="--disable-multilib" GCC_BUILD_OPTIONS="--disable-multilib"
shift shift
;; ;;
gmp-[4-9]*) -sys*)
gmpPACKAGE="gmp-system"
mpfrPACKAGE="mpfr-system"
mpcPACKAGE="mpc-system"
shift
;;
gmp-[4-9]* | gmp-system)
gmpPACKAGE="${1%%/}" gmpPACKAGE="${1%%/}"
shift shift
;; ;;
mpfr-[2-9]*) mpfr-[2-9]* | mpfr-system)
mpfrPACKAGE="${1%%/}" mpfrPACKAGE="${1%%/}"
shift shift
;; ;;
mpc-[0-9]*) mpc-[0-9]* | mpc-system)
mpcPACKAGE="${1%%/}" mpcPACKAGE="${1%%/}"
shift shift
;; ;;
@ -116,6 +127,15 @@ then
exit 1 exit 1
fi fi
cat<<SUMMARY
GCC configuration
------------------
GCC = $gccPACKAGE
GMP = $gmpPACKAGE
MPFR = $mpfrPACKAGE
MPC = $mpcPACKAGE
------------------
SUMMARY
# Set 32 or 64 bit ABI # Set 32 or 64 bit ABI
case "$WM_ARCH_OPTION" in case "$WM_ARCH_OPTION" in
@ -138,6 +158,7 @@ GMP_ARCH_PATH=$installBASE/$gmpPACKAGE
MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
MPC_ARCH_PATH=$installBASE/$mpcPACKAGE MPC_ARCH_PATH=$installBASE/$mpcPACKAGE
# ================ # ================
# Build GMP # Build GMP
# ================ # ================
@ -145,6 +166,9 @@ echo "---------------"
if [ -d $GMP_ARCH_PATH ] if [ -d $GMP_ARCH_PATH ]
then then
echo "Already built: $gmpPACKAGE" echo "Already built: $gmpPACKAGE"
elif _foamIsSystem $GMP_ARCH_PATH
then
echo "Using gmp-system"
else else
echo "Starting build: $gmpPACKAGE" echo "Starting build: $gmpPACKAGE"
echo echo
@ -186,6 +210,9 @@ echo "---------------"
if [ -d $MPFR_ARCH_PATH ] if [ -d $MPFR_ARCH_PATH ]
then then
echo "Already built: $mpfrPACKAGE" echo "Already built: $mpfrPACKAGE"
elif _foamIsSystem $MPFR_ARCH_PATH
then
echo "Using mpfr-system"
else else
echo "Starting build: $mpfrPACKAGE" echo "Starting build: $mpfrPACKAGE"
echo echo
@ -228,6 +255,9 @@ echo "---------------"
if [ -d $MPC_ARCH_PATH ] if [ -d $MPC_ARCH_PATH ]
then then
echo "Already built: $mpcPACKAGE" echo "Already built: $mpcPACKAGE"
elif _foamIsSystem $MPC_ARCH_PATH
then
echo "Using mpc-system"
else else
echo "Starting build: $mpcPACKAGE" echo "Starting build: $mpcPACKAGE"
echo echo
@ -290,6 +320,10 @@ else
mkdir -p $buildDIR mkdir -p $buildDIR
cd $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
set -x set -x
$sourceDIR/configure \ $sourceDIR/configure \
--prefix=$GCC_ARCH_PATH \ --prefix=$GCC_ARCH_PATH \