Merge the fortran stuff to trunk now it works!
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Apr 30 10:43:41 2008 +0000 (2008-04-30)
changeset 4667f9bbf94b0bb
parent 465 8654a8d49ff9
child 467 374d5264fc18
Merge the fortran stuff to trunk now it works!
Fortran is not supported for all targets, though. ARM at least does not work.

/trunk/scripts/build/binutils.sh | 8 8 0 0 ++++++++
/trunk/scripts/build/cc_gcc.sh | 11 6 5 0 ++++++-----
/trunk/scripts/crosstool.sh | 10 9 1 0 +++++++++-
/trunk/tools/addToolVersion.sh | 3 3 0 0 +++
/trunk/steps.mk | 2 2 0 0 ++
/trunk/config/cc/gcc.in | 16 16 0 0 ++++++++++++++++
6 files changed, 44 insertions(+), 6 deletions(-)
config/cc/gcc.in
config/cc/gmp.in
config/cc/mpfr.in
patches/gmp/4.2.2/100-mpf_set_str.c.patch
scripts/build/binutils.sh
scripts/build/cc_gcc.sh
scripts/build/gmp.sh
scripts/build/mpfr.sh
scripts/crosstool.sh
steps.mk
tools/addToolVersion.sh
     1.1 --- a/config/cc/gcc.in	Mon Apr 28 09:27:21 2008 +0000
     1.2 +++ b/config/cc/gcc.in	Wed Apr 30 10:43:41 2008 +0000
     1.3 @@ -128,3 +128,19 @@
     1.4      default ""
     1.5      help
     1.6        Extra flags to pass onto ./configure when configuring gcc.
     1.7 +
     1.8 +menuconfig CC_GCC_GMP_MPFR
     1.9 +    bool
    1.10 +    prompt "GMP and MPFR"
    1.11 +    help
    1.12 +      Recent gcc needs both GMP and MPFR to build some frontends.
    1.13 +
    1.14 +      Say 'Y' here if you want to build those two libraries specifically
    1.15 +      for crosstool-NG.
    1.16 +
    1.17 +      Saying 'Y' is highly recommended if building gcc-4.3 or higher.
    1.18 +
    1.19 +if CC_GCC_GMP_MPFR
    1.20 +source config/cc/gmp.in
    1.21 +source config/cc/mpfr.in
    1.22 +endif
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/config/cc/gmp.in	Wed Apr 30 10:43:41 2008 +0000
     2.3 @@ -0,0 +1,27 @@
     2.4 +# GMP options
     2.5 +
     2.6 +choice
     2.7 +    bool
     2.8 +    prompt "GMP version"
     2.9 +
    2.10 +config GMP_V_4_2_2
    2.11 +    bool
    2.12 +    prompt "4.2.2"
    2.13 +
    2.14 +# CT_INSERT_VERSION_ABOVE
    2.15 +# Don't remove above line!
    2.16 +endchoice
    2.17 +
    2.18 +config GMP_VERSION
    2.19 +    string
    2.20 +    default "4.2.2" if GMP_V_4_2_2
    2.21 +# CT_INSERT_VERSION_STRING_ABOVE
    2.22 +# Don't remove above line!
    2.23 +
    2.24 +config GMP_CHECK
    2.25 +    bool
    2.26 +    prompt "Check GMP"
    2.27 +    default y
    2.28 +    help
    2.29 +      It is highly recommended that 'make check' is run against the newly built
    2.30 +      GMP library. See http://gmplib.org/
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/config/cc/mpfr.in	Wed Apr 30 10:43:41 2008 +0000
     3.3 @@ -0,0 +1,32 @@
     3.4 +# GMP options
     3.5 +
     3.6 +choice
     3.7 +    bool
     3.8 +    prompt "MPFR version"
     3.9 +
    3.10 +config MPFR_V_2_3_0
    3.11 +    bool
    3.12 +    prompt "2.3.0"
    3.13 +
    3.14 +config MPFR_V_2_3_1
    3.15 +    bool
    3.16 +    prompt "2.3.1"
    3.17 +
    3.18 +# CT_INSERT_VERSION_ABOVE
    3.19 +# Don't remove above line!
    3.20 +endchoice
    3.21 +
    3.22 +config MPFR_VERSION
    3.23 +    string
    3.24 +    default "2.3.0" if MPFR_V_2_3_0
    3.25 +    default "2.3.1" if MPFR_V_2_3_1
    3.26 +# CT_INSERT_VERSION_STRING_ABOVE
    3.27 +# Don't remove above line!
    3.28 +
    3.29 +config MPFR_CHECK
    3.30 +    bool
    3.31 +    prompt "Check MPFR"
    3.32 +    default y
    3.33 +    help
    3.34 +      It is highly recommended that 'make check' is run against the newly built
    3.35 +      MPFR library. See http://gmplib.org/
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/gmp/4.2.2/100-mpf_set_str.c.patch	Wed Apr 30 10:43:41 2008 +0000
     4.3 @@ -0,0 +1,38 @@
     4.4 +Original patch from http://gmplib.org/patches/mpf_set_str.c.diff
     4.5 +Re-diffed to match crosstool-NG conventions.
     4.6 +
     4.7 +diff -dur gmp-4.2.2.orig/mpf/set_str.c gmp-4.2.2/mpf/set_str.c
     4.8 +--- gmp-4.2.2.orig/mpf/set_str.c	2007-08-30 20:31:40.000000000 +0200
     4.9 ++++ gmp-4.2.2/mpf/set_str.c	2008-01-28 23:05:29.000000000 +0100
    4.10 +@@ -271,8 +271,29 @@
    4.11 +       }
    4.12 + 
    4.13 +     if (expptr != 0)
    4.14 +-      /* FIXME: Should do some error checking here.  */
    4.15 +-      exp_in_base = strtol (expptr, (char **) 0, exp_base);
    4.16 ++      {
    4.17 ++	/* Scan and convert the exponent, in base exp_base.  */
    4.18 ++	long dig, neg = -(long) ('-' == expptr[0]);
    4.19 ++	expptr -= neg;			/* conditional increment */
    4.20 ++	c = (unsigned char) *expptr++;
    4.21 ++	dig = digit_value[c];
    4.22 ++	if (dig >= exp_base)
    4.23 ++	  {
    4.24 ++	    TMP_FREE;
    4.25 ++	    return -1;
    4.26 ++	  }
    4.27 ++	exp_in_base = dig;
    4.28 ++	c = (unsigned char) *expptr++;
    4.29 ++	dig = digit_value[c];
    4.30 ++	while (dig < exp_base)
    4.31 ++	  {
    4.32 ++	    exp_in_base = exp_in_base * exp_base;
    4.33 ++	    exp_in_base += dig;
    4.34 ++	    c = (unsigned char) *expptr++;
    4.35 ++	    dig = digit_value[c];
    4.36 ++	  }
    4.37 ++	exp_in_base = (exp_in_base ^ neg) - neg; /* conditional negation */
    4.38 ++      }
    4.39 +     else
    4.40 +       exp_in_base = 0;
    4.41 +     if (dotpos != 0)
     5.1 --- a/scripts/build/binutils.sh	Mon Apr 28 09:27:21 2008 +0000
     5.2 +++ b/scripts/build/binutils.sh	Wed Apr 30 10:43:41 2008 +0000
     5.3 @@ -25,6 +25,13 @@
     5.4  
     5.5      CT_DoStep INFO "Installing binutils"
     5.6  
     5.7 +    binutils_opts=
     5.8 +    # If GMP and MPFR were configured, then use that,
     5.9 +    # otherwise let binutils find the system-wide libraries, if they exist.
    5.10 +    if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
    5.11 +        binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    5.12 +    fi
    5.13 +
    5.14      CT_DoLog EXTRA "Configuring binutils"
    5.15      CFLAGS="${CT_CFLAGS_FOR_HOST}"                  \
    5.16      "${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure"   \
    5.17 @@ -34,6 +41,7 @@
    5.18          --target=${CT_TARGET}                       \
    5.19          --prefix=${CT_PREFIX_DIR}                   \
    5.20          --disable-nls                               \
    5.21 +        ${binutils_opts}                            \
    5.22          ${CT_BINUTILS_EXTRA_CONFIG}                 \
    5.23          ${BINUTILS_SYSROOT_ARG}                     2>&1 |CT_DoLog ALL
    5.24  
     6.1 --- a/scripts/build/cc_gcc.sh	Mon Apr 28 09:27:21 2008 +0000
     6.2 +++ b/scripts/build/cc_gcc.sh	Wed Apr 30 10:43:41 2008 +0000
     6.3 @@ -7,7 +7,7 @@
     6.4      echo "gcc-${CT_CC_VERSION}"
     6.5  }
     6.6  
     6.7 -# Download final gcc
     6.8 +# Download gcc
     6.9  do_cc_get() {
    6.10      # Ah! gcc folks are kind of 'different': they store the tarballs in
    6.11      # subdirectories of the same name! That's because gcc is such /crap/ that
    6.12 @@ -21,7 +21,7 @@
    6.13                 ftp://ftp.gnu.org/gnu/gcc
    6.14  }
    6.15  
    6.16 -# Extract final gcc
    6.17 +# Extract gcc
    6.18  do_cc_extract() {
    6.19      CT_ExtractAndPatch "${CT_CC_FILE}"
    6.20  }
    6.21 @@ -62,6 +62,7 @@
    6.22  
    6.23      extra_config="${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
    6.24      [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
    6.25 +    [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    6.26  
    6.27      CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
    6.28  
    6.29 @@ -114,6 +115,7 @@
    6.30  
    6.31      extra_config="${CT_ARCH_WITH_ARCH} ${CT_ARCH_WITH_ABI} ${CT_ARCH_WITH_CPU} ${CT_ARCH_WITH_TUNE} ${CT_ARCH_WITH_FPU} ${CT_ARCH_WITH_FLOAT}"
    6.32      [ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
    6.33 +    [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    6.34  
    6.35      CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
    6.36  
    6.37 @@ -202,12 +204,10 @@
    6.38      [ "${CT_CC_LANG_JAVA}" = "y"     ] && lang_opt="${lang_opt},java"
    6.39      [ "${CT_CC_LANG_OBJC}" = "y"     ] && lang_opt="${lang_opt},objc"
    6.40      [ "${CT_CC_LANG_OBJCXX}" = "y"   ] && lang_opt="${lang_opt},obj-c++"
    6.41 -    CT_Test "Building Fortran language is not yet supported. Will try..." "${CT_CC_LANG_FORTRAN}" = "y"
    6.42      CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
    6.43 -    CT_Test "Building Java language is not yet supported. Will try..." "${CT_CC_LANG_JAVA}" = "y"
    6.44      CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
    6.45      CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
    6.46 -    CT_Test "Building ${CT_CC_LANG_OTHERS} language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
    6.47 +    CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
    6.48      lang_opt=`echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;'`
    6.49  
    6.50      extra_config="--enable-languages=${lang_opt}"
    6.51 @@ -219,6 +219,7 @@
    6.52      else
    6.53          extra_config="${extra_config} --disable-multilib"
    6.54      fi
    6.55 +    [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    6.56  
    6.57      CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
    6.58  
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/scripts/build/gmp.sh	Wed Apr 30 10:43:41 2008 +0000
     7.3 @@ -0,0 +1,49 @@
     7.4 +# This file adds the functions to build the GMP library
     7.5 +# Copyright 2008 Yann E. MORIN
     7.6 +# Licensed under the GPL v2. See COPYING in the root of this package
     7.7 +
     7.8 +do_print_filename() {
     7.9 +    [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] || return 0
    7.10 +    echo "gmp-${CT_GMP_VERSION}"
    7.11 +}
    7.12 +
    7.13 +# Download GMP
    7.14 +do_gmp_get() {
    7.15 +    CT_GetFile "${CT_GMP_FILE}"                 \
    7.16 +               http://ftp.sunet.se/pub/gnu/gmp  \
    7.17 +               ftp://ftp.gnu.org/gnu/gmp
    7.18 +}
    7.19 +
    7.20 +# Extract GMP
    7.21 +do_gmp_extract() {
    7.22 +    CT_ExtractAndPatch "${CT_GMP_FILE}"
    7.23 +}
    7.24 +
    7.25 +do_gmp() {
    7.26 +    mkdir -p "${CT_BUILD_DIR}/build-gmp"
    7.27 +    cd "${CT_BUILD_DIR}/build-gmp"
    7.28 +
    7.29 +    CT_DoStep INFO "Installing GMP"
    7.30 +
    7.31 +    CT_DoLog EXTRA "Configuring GMP"
    7.32 +    CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
    7.33 +    "${CT_SRC_DIR}/${CT_GMP_FILE}/configure"    \
    7.34 +        --build=${CT_BUILD}                     \
    7.35 +        --host=${CT_HOST}                       \
    7.36 +        --prefix="${CT_PREFIX_DIR}"             \
    7.37 +        --disable-shared --enable-static        \
    7.38 +        --enable-fft --enable-mpbsd             2>&1 |CT_DoLog ALL
    7.39 +
    7.40 +    CT_DoLog EXTRA "Building GMP"
    7.41 +    make ${PARALLELMFLAGS}  2>&1 |CT_DoLog ALL
    7.42 +
    7.43 +    if [ "${CT_GMP_CHECK}" = "y" ]; then
    7.44 +        CT_DoLog EXTRA "Checking GMP"
    7.45 +        make -s check       2>&1 |CT_DoLog ALL
    7.46 +    fi
    7.47 +
    7.48 +    CT_DoLog EXTRA "Installing GMP"
    7.49 +    make install            2>&1 |CT_DoLog ALL
    7.50 +
    7.51 +    CT_EndStep
    7.52 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/scripts/build/mpfr.sh	Wed Apr 30 10:43:41 2008 +0000
     8.3 @@ -0,0 +1,47 @@
     8.4 +# This file adds the functions to build the MPFR library
     8.5 +# Copyright 2008 Yann E. MORIN
     8.6 +# Licensed under the GPL v2. See COPYING in the root of this package
     8.7 +
     8.8 +do_print_filename() {
     8.9 +    [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] || return 0
    8.10 +    echo "mpfr-${CT_MPFR_VERSION}"
    8.11 +}
    8.12 +
    8.13 +# Download MPFR
    8.14 +do_mpfr_get() {
    8.15 +    CT_GetFile "${CT_MPFR_FILE}" http://www.mpfr.org/mpfr-current/
    8.16 +}
    8.17 +
    8.18 +# Extract MPFR
    8.19 +do_mpfr_extract() {
    8.20 +    CT_ExtractAndPatch "${CT_MPFR_FILE}"
    8.21 +}
    8.22 +
    8.23 +do_mpfr() {
    8.24 +    mkdir -p "${CT_BUILD_DIR}/build-mpfr"
    8.25 +    cd "${CT_BUILD_DIR}/build-mpfr"
    8.26 +
    8.27 +    CT_DoStep INFO "Installing MPFR"
    8.28 +
    8.29 +    CT_DoLog EXTRA "Configuring MPFR"
    8.30 +    CFLAGS="${CT_CFLAGS_FOR_HOST}"                          \
    8.31 +    "${CT_SRC_DIR}/${CT_MPFR_FILE}/configure"               \
    8.32 +        --build=${CT_BUILD}                                 \
    8.33 +        --host=${CT_HOST}                                   \
    8.34 +        --prefix="${CT_PREFIX_DIR}"                         \
    8.35 +        --disable-shared --enable-static                    \
    8.36 +        --with-gmp="${CT_PREFIX_DIR}"                       2>&1 |CT_DoLog ALL
    8.37 +
    8.38 +    CT_DoLog EXTRA "Building MPFR"
    8.39 +    make ${PARALLELMFLAGS}  2>&1 |CT_DoLog ALL
    8.40 +
    8.41 +    if [ "${CT_MPFR_CHECK}" = "y" ]; then
    8.42 +        CT_DoLog EXTRA "Checking MPFR"
    8.43 +        make -s check       2>&1 |CT_DoLog ALL
    8.44 +    fi
    8.45 +
    8.46 +    CT_DoLog EXTRA "Installing MPFR"
    8.47 +    make install            2>&1 |CT_DoLog ALL
    8.48 +
    8.49 +    CT_EndStep
    8.50 +}
     9.1 --- a/scripts/crosstool.sh	Mon Apr 28 09:27:21 2008 +0000
     9.2 +++ b/scripts/crosstool.sh	Wed Apr 30 10:43:41 2008 +0000
     9.3 @@ -73,6 +73,8 @@
     9.4  # Now, build up the variables from the user-configured options.
     9.5  CT_KERNEL_FILE="${CT_KERNEL}-${CT_KERNEL_VERSION}"
     9.6  CT_BINUTILS_FILE="binutils-${CT_BINUTILS_VERSION}"
     9.7 +CT_GMP_FILE="gmp-${CT_GMP_VERSION}"
     9.8 +CT_MPFR_FILE="mpfr-${CT_MPFR_VERSION}"
     9.9  CT_CC_FILE="${CT_CC}-${CT_CC_VERSION}"
    9.10  CT_LIBC_FILE="${CT_LIBC}-${CT_LIBC_VERSION}"
    9.11  
    9.12 @@ -417,6 +419,8 @@
    9.13  # Include sub-scripts instead of calling them: that way, we do not have to
    9.14  # export any variable, nor re-parse the configuration and functions files.
    9.15  . "${CT_LIB_DIR}/scripts/build/kernel_${CT_KERNEL}.sh"
    9.16 +. "${CT_LIB_DIR}/scripts/build/gmp.sh"
    9.17 +. "${CT_LIB_DIR}/scripts/build/mpfr.sh"
    9.18  . "${CT_LIB_DIR}/scripts/build/binutils.sh"
    9.19  . "${CT_LIB_DIR}/scripts/build/libc_${CT_LIBC}.sh"
    9.20  . "${CT_LIB_DIR}/scripts/build/cc_${CT_CC}.sh"
    9.21 @@ -426,6 +430,8 @@
    9.22  if [ -z "${CT_RESTART}" ]; then
    9.23      CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
    9.24      do_kernel_get
    9.25 +    do_gmp_get
    9.26 +    do_mpfr_get
    9.27      do_binutils_get
    9.28      do_cc_get
    9.29      do_libc_get
    9.30 @@ -440,6 +446,8 @@
    9.31          fi
    9.32          CT_DoStep INFO "Extracting and patching toolchain components"
    9.33          do_kernel_extract
    9.34 +        do_gmp_extract
    9.35 +        do_mpfr_extract
    9.36          do_binutils_extract
    9.37          do_cc_extract
    9.38          do_libc_extract
    9.39 @@ -455,7 +463,7 @@
    9.40      do_stop=0
    9.41      prev_step=
    9.42      [ -n "${CT_RESTART}" ] && do_it=0 || do_it=1
    9.43 -    # CT_STEPS comes from steps.mk!
    9.44 +    # Aha! CT_STEPS comes from steps.mk!
    9.45      for step in ${CT_STEPS}; do
    9.46          if [ ${do_it} -eq 0 ]; then
    9.47              if [ "${CT_RESTART}" = "${step}" ]; then
    10.1 --- a/steps.mk	Mon Apr 28 09:27:21 2008 +0000
    10.2 +++ b/steps.mk	Wed Apr 30 10:43:41 2008 +0000
    10.3 @@ -4,6 +4,8 @@
    10.4  CT_STEPS := libc_check_config   \
    10.5              kernel_check_config \
    10.6              kernel_headers      \
    10.7 +            gmp                 \
    10.8 +            mpfr                \
    10.9              binutils            \
   10.10              cc_core_pass_1      \
   10.11              libc_headers        \
    11.1 --- a/tools/addToolVersion.sh	Mon Apr 28 09:27:21 2008 +0000
    11.2 +++ b/tools/addToolVersion.sh	Wed Apr 30 10:43:41 2008 +0000
    11.3 @@ -9,6 +9,7 @@
    11.4    'tool' in one of:
    11.5      --gcc, --binutils, --glibc, --uClibc, --linux,
    11.6      --gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
    11.7 +    --gmp, --mpfr
    11.8  
    11.9    Valid options for all tools:
   11.10      --experimental, -x
   11.11 @@ -55,6 +56,8 @@
   11.12          --strace)           cat=STRACE;    tool=strace;   tool_prefix=debug    tool_suffix=;;
   11.13          --ltrace)           cat=LTRACE;    tool=ltrace;   tool_prefix=debug    tool_suffix=;;
   11.14          --libelf)           cat=LIBELF;    tool=libelf;   tool_prefix=tools    tool_suffix=;;
   11.15 +        --gmp)              cat=GMP;       tool=gmp;      tool_prefix=cc;      tool_suffix=;;
   11.16 +        --mpfr)             cat=MPFR;      tool=mpfr;     tool_prefix=cc;      tool_suffix=;;
   11.17          # Tools options:
   11.18          -x|--experimental)  EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
   11.19          -o|--obsolete)      OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;