#!/bin/sh #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # # OpenFOAM is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with OpenFOAM. If not, see . # # Script # makeGcc # # Description # Build script gcc and gmp, mpfr, mpc. # # To force building against the system gmp/mpfr/mpc libraries, # use a corresponding '*-system' version. For example, # # makeGcc gmp-system # # or use the '-system' options to use system libraries everywhere. # # The WM_COMPILER value can also be used specify a known gcc version. # For example (also compiling against system gmp/mpfr/mpc), # # WM_COMPILER=Gcc51 ./makeGcc -system # #------------------------------------------------------------------------------ # get default GCC, mpfr, gmp and mpc versions 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) gmpPACKAGE=${gmp_version:-gmp-system} mpfrPACKAGE=${mpfr_version:-mpfr-system} mpcPACKAGE=${mpc_version:-mpc-system} gccPACKAGE=$gcc_version #------------------------------------------------------------------------------ # Run from third-party directory only wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 } . etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ Script=${0##*/} usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR set -x $sourceDIR/configure ABI=$ABI \ --prefix=$GMP_ARCH_PATH \ --libdir=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ --enable-cxx \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $gmpPACKAGE" ) || { echo "Error building: $gmpPACKAGE" exit 1 } fi if [ -d "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" ] then _foamAddLib "$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" configGMP=$(cat </dev/null rm -rf $buildDIR 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 \ $configGMP $configOpt \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $mpfrPACKAGE" ) || { echo "Error building: $mpfrPACKAGE" exit 1 } fi if [ -d "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" ] then _foamAddLib "$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" configMPFR=$(cat </dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR set -x $sourceDIR/configure ABI=$ABI \ --prefix=$MPC_ARCH_PATH \ --libdir=$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \ $configGMP $configMPFR \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $mpcPACKAGE" ) || { echo "Error building: $mpcPACKAGE" exit 1 } fi if [ -d "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" ] then _foamAddLib "$MPC_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" configMPC=$(cat </dev/null rm -rf $buildDIR mkdir -p $buildDIR cd $buildDIR unset configOpt # with/without multi-lib (32-bit support on 64-bit systems) [ -n "$optMultilib" ] && configOpt="--${optMultilib}-multilib" set -x $sourceDIR/configure \ --prefix=$GCC_ARCH_PATH \ --with-pkgversion=OpenFOAM \ --enable-languages=c,c++ \ --enable-__cxa_atexit \ --enable-libstdcxx-allocator=new \ --with-system-zlib \ $configGMP $configMPFR $configMPC $configOpt \ MAKEINFO=missing \ && make -j $WM_NCOMPPROCS \ && make install \ && echo "Built: $gccPACKAGE" ) || { echo "Error building: $gccPACKAGE" exit 1 } fi #------------------------------------------------------------------------------