143 lines
3.5 KiB
Bash
Executable File
143 lines
3.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#------------------------------------------------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
|
# \\/ M anipulation |
|
|
#------------------------------------------------------------------------------
|
|
# 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 2 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, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#
|
|
# Script
|
|
# makeGcc
|
|
#
|
|
# Description
|
|
# Build script for gmp, mpfr and gcc-4.3.? and gcc-4.4.?
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
|
|
gmpVERSION=gmp-4.2.4
|
|
mpfrVERSION=mpfr-2.4.1
|
|
gccVERSION="$1"
|
|
|
|
usage() {
|
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
cat<<USAGE
|
|
|
|
usage: ${0##*/} <gcc-4.?.?> ...
|
|
|
|
* build gmp, mpfr and gcc-4.3.? and gcc-4.4.?
|
|
|
|
USAGE
|
|
exit 1
|
|
}
|
|
|
|
[ "$#" -eq 1 ] || usage "gcc version not provided"
|
|
|
|
|
|
#
|
|
# Set the number of cores to build on
|
|
#
|
|
WM_NCOMPPROCS=1
|
|
|
|
if [ -r /proc/cpuinfo ]
|
|
then
|
|
WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
|
|
[ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8
|
|
fi
|
|
|
|
echo "Building on " $WM_NCOMPPROCS " cores"
|
|
|
|
GCC_DIR=$WM_THIRD_PARTY_DIR/$gccVERSION
|
|
GMP_DIR=$WM_THIRD_PARTY_DIR/$gmpVERSION
|
|
MPFR_DIR=$WM_THIRD_PARTY_DIR/$mpfrVERSION
|
|
|
|
GCCROOT=${GCC_DIR}/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
|
GMPROOT=${GMP_DIR}/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
|
MPFRROOT=${MPFR_DIR}/platforms/$WM_ARCH$WM_COMPILER_ARCH
|
|
|
|
#
|
|
# Bulid GMP
|
|
#
|
|
if [ ! -d $GMPROOT ]
|
|
then
|
|
(
|
|
cd $GMP_DIR \
|
|
&& make distclean \
|
|
&& mkdir $GMP_DIR/build \
|
|
&& cd $GMP_DIR/build \
|
|
&& ../configure ABI=$ABI --prefix=$GMPROOT \
|
|
&& make -j $WM_NCOMPPROCS \
|
|
&& make install
|
|
|
|
echo " Finished building gmp."
|
|
)
|
|
else
|
|
echo " gmp already built."
|
|
fi
|
|
|
|
export LD_LIBRARY_PATH="$GMPROOT/lib:$LD_LIBRARY_PATH"
|
|
|
|
#
|
|
# Build MPFR
|
|
#
|
|
if [ ! -d $MPFRROOT ]
|
|
then
|
|
(
|
|
cd $MPFR_DIR \
|
|
&& make distclean \
|
|
&& mkdir $MPFR_DIR/build \
|
|
&& cd $MPFR_DIR/build \
|
|
&& ../configure ABI=$ABI --prefix=$MPFRROOT --with-gmp=$GMPROOT \
|
|
&& make -j $WM_NCOMPPROCS \
|
|
&& make install
|
|
|
|
echo " Finished building mpfr."
|
|
)
|
|
else
|
|
echo " mprf already built."
|
|
fi
|
|
|
|
export LD_LIBRARY_PATH="$MPFRROOT/lib:$LD_LIBRARY_PATH"
|
|
|
|
#
|
|
# Build GCC
|
|
#
|
|
if [ ! -d $GCCROOT ]
|
|
then
|
|
(
|
|
cd $GCC_DIR \
|
|
&& make distclean \
|
|
&& mkdir $GCC_DIR/build \
|
|
&& cd $GCC_DIR/build \
|
|
&& ../configure --enable-languages=c,c++ --with-pkgversion='OpenFOAM' \
|
|
--enable-__cxa_atexit --enable-libstdcxx-allocator=new \
|
|
--with-system-zlib --prefix=$GCCROOT \
|
|
--with-mpfr=$MPFRROOT --with-gmp=$GMPROOT \
|
|
&& make -j $WM_NCOMPPROCS \
|
|
&& make install
|
|
|
|
echo " Finished building gcc."
|
|
)
|
|
else
|
|
echo " gcc already built."
|
|
fi
|
|
|
|
|
|
# ----------------------------------------------------------------- end-of-file
|