GMP and MPFR are no longer a sub-component of gcc (config-wise).
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jun 20 15:16:43 2008 +0000 (2008-06-20)
changeset 6021968d150a34f
parent 601 d3f712796549
child 603 15549c6126c6
GMP and MPFR are no longer a sub-component of gcc (config-wise).
Build and install GMP and MPFR for the target.
Use the target GMP and MPFR to build the native gdb.
Have separate extra_config for cross gdb, native gdb and gdbserver.
Check native GMP and MPFR in //.

/trunk/scripts/build/debug/300-gdb.sh | 27 19 8 0 ++++++++++++++++-------
/trunk/scripts/build/gmp.sh | 47 39 8 0 ++++++++++++++++++++++++++++++++-------
/trunk/scripts/build/mpfr.sh | 49 40 9 0 +++++++++++++++++++++++++++++++++--------
/trunk/steps.mk | 2 2 0 0 ++
/trunk/config/cc/gcc.in | 18 1 17 0 +--------------
/trunk/config/debug/gdb.in | 6 1 5 0 +----
/trunk/config/config.in | 1 1 0 0 +
/trunk/config/gmp_mpfr.in | 34 34 0 0 ++++++++++++++++++++++++++++
8 files changed, 137 insertions(+), 47 deletions(-)
config/cc/gcc.in
config/config.in
config/debug/gdb.in
config/gmp_mpfr.in
scripts/build/debug/300-gdb.sh
scripts/build/gmp.sh
scripts/build/mpfr.sh
steps.mk
     1.1 --- a/config/cc/gcc.in	Fri Jun 20 14:00:01 2008 +0000
     1.2 +++ b/config/cc/gcc.in	Fri Jun 20 15:16:43 2008 +0000
     1.3 @@ -120,7 +120,7 @@
     1.4  config CC_GCC_4_3_or_later
     1.5      bool
     1.6      default n
     1.7 -    select CC_GCC_GMP_MPFR
     1.8 +    select GMP_MPFR
     1.9  
    1.10  config CC_CXA_ATEXIT
    1.11      bool
    1.12 @@ -166,19 +166,3 @@
    1.13      default ""
    1.14      help
    1.15        Specify the URL that users should visit if they wish to report a bug.
    1.16 -
    1.17 -menuconfig CC_GCC_GMP_MPFR
    1.18 -    bool
    1.19 -    prompt "GMP and MPFR"
    1.20 -    help
    1.21 -      Recent gcc needs both GMP and MPFR to build some frontends.
    1.22 -
    1.23 -      Say 'Y' here if you want to build those two libraries specifically
    1.24 -      for crosstool-NG.
    1.25 -
    1.26 -      Saying 'Y' is highly recommended if building gcc-4.3 or higher.
    1.27 -
    1.28 -if CC_GCC_GMP_MPFR
    1.29 -source config/cc/gmp.in
    1.30 -source config/cc/mpfr.in
    1.31 -endif
     2.1 --- a/config/config.in	Fri Jun 20 14:00:01 2008 +0000
     2.2 +++ b/config/config.in	Fri Jun 20 15:16:43 2008 +0000
     2.3 @@ -2,6 +2,7 @@
     2.4  source config/target.in
     2.5  source config/toolchain.in
     2.6  source config/kernel.in
     2.7 +source config/gmp_mpfr.in
     2.8  source config/binutils.in
     2.9  source config/cc.in
    2.10  source config/libc.in
     3.1 --- a/config/debug/gdb.in	Fri Jun 20 14:00:01 2008 +0000
     3.2 +++ b/config/debug/gdb.in	Fri Jun 20 15:16:43 2008 +0000
     3.3 @@ -33,6 +33,7 @@
     3.4      bool
     3.5      prompt "Native gdb"
     3.6      default n
     3.7 +    select GMP_MPFR_TARGET if GMP_MPFR
     3.8      help
     3.9        Build and install a native gdb for the target, to run on the target.
    3.10  
    3.11 @@ -123,10 +124,6 @@
    3.12      bool
    3.13      prompt "ncurses version"
    3.14  
    3.15 -config NCURSES_V_4_2
    3.16 -    bool
    3.17 -    prompt "4.2"
    3.18 -
    3.19  config NCURSES_V_5_6
    3.20      bool
    3.21      prompt "5.6"
    3.22 @@ -135,7 +132,6 @@
    3.23  
    3.24  config NCURSES_VERSION
    3.25      string
    3.26 -    default "4.2" if NCURSES_V_4_2
    3.27      default "5.6" if NCURSES_V_5_6
    3.28  
    3.29  endif # GDB_NATIVE --> ncurses
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/config/gmp_mpfr.in	Fri Jun 20 15:16:43 2008 +0000
     4.3 @@ -0,0 +1,34 @@
     4.4 +# GMP and MPFR libraries config options
     4.5 +
     4.6 +menu "GMP and MPFR"
     4.7 +
     4.8 +config GMP_MPFR
     4.9 +    bool
    4.10 +    prompt "GMP and MPFR"
    4.11 +    help
    4.12 +      Recent gcc needs both GMP and MPFR to build some frontends.
    4.13 +
    4.14 +      Say 'Y' here if you want to build those two libraries specifically
    4.15 +      for crosstool-NG.
    4.16 +
    4.17 +      The packages that can use GMP and MPFR are:
    4.18 +        - binutils
    4.19 +        - gcc
    4.20 +        - gdb
    4.21 +
    4.22 +config GMP_MPFR_TARGET
    4.23 +    bool
    4.24 +    prompt "Build libraries for the target"
    4.25 +    depends on GMP_MPFR
    4.26 +    default n
    4.27 +    help
    4.28 +      Also build libraries for the target. This can be usefull if you want
    4.29 +      to later build a compiler that will run on the target, or if you want
    4.30 +      to run gdb natively on the target.
    4.31 +
    4.32 +if GMP_MPFR
    4.33 +source config/cc/gmp.in
    4.34 +source config/cc/mpfr.in
    4.35 +endif
    4.36 +
    4.37 +endmenu
     5.1 --- a/scripts/build/debug/300-gdb.sh	Fri Jun 20 14:00:01 2008 +0000
     5.2 +++ b/scripts/build/debug/300-gdb.sh	Fri Jun 20 15:16:43 2008 +0000
     5.3 @@ -51,12 +51,13 @@
     5.4          mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
     5.5          cd "${CT_BUILD_DIR}/build-gdb-cross"
     5.6  
     5.7 +        cross_extra_config="${extra_config}"
     5.8          if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
     5.9 -            extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    5.10 +            cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    5.11          fi
    5.12          case "${CT_THREADS}" in
    5.13 -            none)   extra_config="${extra_config} --disable-threads";;
    5.14 -            *)      extra_config="${extra_config} --enable-threads";;
    5.15 +            none)   cross_extra_config="${cross_extra_config} --disable-threads";;
    5.16 +            *)      cross_extra_config="${cross_extra_config} --enable-threads";;
    5.17          esac
    5.18  
    5.19          CC_for_gdb=
    5.20 @@ -66,6 +67,8 @@
    5.21              LD_for_gdb="ld -static"
    5.22          fi
    5.23  
    5.24 +        CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
    5.25 +
    5.26          CC="${CC_for_gdb}"                              \
    5.27          LD="${LD_for_gdb}"                              \
    5.28          "${gdb_src_dir}/configure"                      \
    5.29 @@ -74,7 +77,7 @@
    5.30              --target=${CT_TARGET}                       \
    5.31              --prefix="${CT_PREFIX_DIR}"                 \
    5.32              --with-build-sysroot="${CT_SYSROOT_DIR}"    \
    5.33 -            ${extra_config}                             2>&1 |CT_DoLog ALL
    5.34 +            ${cross_extra_config}                       2>&1 |CT_DoLog ALL
    5.35  
    5.36          CT_DoLog EXTRA "Building cross-gdb"
    5.37          make ${PARALLELMFLAGS}                          2>&1 |CT_DoLog ALL
    5.38 @@ -123,10 +126,14 @@
    5.39          mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
    5.40          cd "${CT_BUILD_DIR}/build-gdb-native"
    5.41  
    5.42 +        native_extra_config="${extra_config}"
    5.43          case "${CT_THREADS}" in
    5.44 -            none)   extra_config="${extra_config} --disable-threads";;
    5.45 -            *)      extra_config="${extra_config} --enable-threads";;
    5.46 +            none)   native_extra_config="${native_extra_config} --disable-threads";;
    5.47 +            *)      native_extra_config="${native_extra_config} --enable-threads";;
    5.48          esac
    5.49 +        if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
    5.50 +            native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
    5.51 +        fi
    5.52  
    5.53          CC_for_gdb=
    5.54          LD_for_gdb=
    5.55 @@ -137,6 +144,8 @@
    5.56  
    5.57          export ac_cv_func_strncmp_works=yes
    5.58  
    5.59 +        CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
    5.60 +
    5.61          CC="${CC_for_gdb}"                              \
    5.62          LD="${LD_for_gdb}"                              \
    5.63          "${gdb_src_dir}/configure"                      \
    5.64 @@ -153,7 +162,7 @@
    5.65              --disable-werror                            \
    5.66              --without-included-gettext                  \
    5.67              --without-develop                           \
    5.68 -            ${extra_config}                             2>&1 |CT_DoLog ALL
    5.69 +            ${native_extra_config}                      2>&1 |CT_DoLog ALL
    5.70  
    5.71          CT_DoLog EXTRA "Building native gdb"
    5.72          make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
    5.73 @@ -186,6 +195,8 @@
    5.74              gdbserver_LDFLAGS=-static
    5.75          fi
    5.76  
    5.77 +        gdbserver_extra_config="${extra_config}"
    5.78 +
    5.79          LDFLAGS="${gdbserver_LDFLAGS}"                  \
    5.80          "${gdb_src_dir}/gdb/gdbserver/configure"        \
    5.81              --build=${CT_BUILD}                         \
    5.82 @@ -203,7 +214,7 @@
    5.83              --without-x                                 \
    5.84              --without-included-gettext                  \
    5.85              --without-develop                           \
    5.86 -            ${extra_config}                             2>&1 |CT_DoLog ALL
    5.87 +            ${gdbserver_extra_config}                   2>&1 |CT_DoLog ALL
    5.88  
    5.89          CT_DoLog EXTRA "Building gdbserver"
    5.90          make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC} 2>&1 |CT_DoLog ALL
     6.1 --- a/scripts/build/gmp.sh	Fri Jun 20 14:00:01 2008 +0000
     6.2 +++ b/scripts/build/gmp.sh	Fri Jun 20 15:16:43 2008 +0000
     6.3 @@ -2,9 +2,17 @@
     6.4  # Copyright 2008 Yann E. MORIN
     6.5  # Licensed under the GPL v2. See COPYING in the root of this package
     6.6  
     6.7 -if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
     6.8 +do_print_filename() { :; }
     6.9 +do_gmp_get() { :; }
    6.10 +do_gmp_extract() { :; }
    6.11 +do_gmp() { :; }
    6.12 +do_gmp_target() { :; }
    6.13 +
    6.14 +# Overide functions depending on configuration
    6.15 +if [ "${CT_GMP_MPFR}" = "y" ]; then
    6.16  
    6.17  do_print_filename() {
    6.18 +    [ "${CT_GMP_MPFR}" = "y" ] || return 0
    6.19      echo "gmp-${CT_GMP_VERSION}"
    6.20  }
    6.21  
    6.22 @@ -38,7 +46,7 @@
    6.23  
    6.24      if [ "${CT_GMP_CHECK}" = "y" ]; then
    6.25          CT_DoLog EXTRA "Checking GMP"
    6.26 -        make -s check       2>&1 |CT_DoLog ALL
    6.27 +        make ${PARALLELMFLAGS} -s check 2>&1 |CT_DoLog ALL
    6.28      fi
    6.29  
    6.30      CT_DoLog EXTRA "Installing GMP"
    6.31 @@ -47,11 +55,34 @@
    6.32      CT_EndStep
    6.33  }
    6.34  
    6.35 -else # Mo GMP 
    6.36 +if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
    6.37  
    6.38 -do_print_filename() { :; }
    6.39 -do_gmp_get() { :; }
    6.40 -do_gmp_extract() { :; }
    6.41 -do_gmp() { :; }
    6.42 +do_gmp_target() {
    6.43 +    mkdir -p "${CT_BUILD_DIR}/build-gmp-target"
    6.44 +    cd "${CT_BUILD_DIR}/build-gmp-target"
    6.45  
    6.46 -fi
    6.47 +    CT_DoStep INFO "Installing GMP for the target"
    6.48 +
    6.49 +    CT_DoLog EXTRA "Configuring GMP"
    6.50 +    CFLAGS="${CT_CFLAGS_FOR_TARGET}"            \
    6.51 +    "${CT_SRC_DIR}/${CT_GMP_FILE}/configure"    \
    6.52 +        --build=${CT_BUILD}                     \
    6.53 +        --host=${CT_TARGET}                     \
    6.54 +        --prefix=/usr                           \
    6.55 +        --disable-shared --enable-static        \
    6.56 +        --enable-fft --enable-mpbsd             2>&1 |CT_DoLog ALL
    6.57 +
    6.58 +    CT_DoLog EXTRA "Building GMP"
    6.59 +    make ${PARALLELMFLAGS}  2>&1 |CT_DoLog ALL
    6.60 +
    6.61 +    # Not possible to check MPFR while X-compiling
    6.62 +
    6.63 +    CT_DoLog EXTRA "Installing GMP"
    6.64 +    make DESTDIR="${CT_SYSROOT_DIR}" install    2>&1 |CT_DoLog ALL
    6.65 +
    6.66 +    CT_EndStep
    6.67 +}
    6.68 +
    6.69 +fi # CT_GMP_MPFR_TARGET == y
    6.70 +
    6.71 +fi # CT_GMP_MPFR == y
     7.1 --- a/scripts/build/mpfr.sh	Fri Jun 20 14:00:01 2008 +0000
     7.2 +++ b/scripts/build/mpfr.sh	Fri Jun 20 15:16:43 2008 +0000
     7.3 @@ -2,10 +2,17 @@
     7.4  # Copyright 2008 Yann E. MORIN
     7.5  # Licensed under the GPL v2. See COPYING in the root of this package
     7.6  
     7.7 -if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
     7.8 +do_print_filename() { :; }
     7.9 +do_mpfr_get() { :; }
    7.10 +do_mpfr_extract() { :; }
    7.11 +do_mpfr() { :; }
    7.12 +do_mpfr_target() { :; }
    7.13 +
    7.14 +# Overide function depending on configuration
    7.15 +if [ "${CT_GMP_MPFR}" = "y" ]; then
    7.16  
    7.17  do_print_filename() {
    7.18 -    [ "${CT_CC_GCC_GMP_MPFR}" = "y" ] || return 0
    7.19 +    [ "${CT_GMP_MPFR}" = "y" ] || return 0
    7.20      echo "mpfr-${CT_MPFR_VERSION}"
    7.21  }
    7.22  
    7.23 @@ -57,7 +64,7 @@
    7.24  
    7.25      if [ "${CT_MPFR_CHECK}" = "y" ]; then
    7.26          CT_DoLog EXTRA "Checking MPFR"
    7.27 -        make -s check       2>&1 |CT_DoLog ALL
    7.28 +        make ${PARALLELMFLAGS} -s check 2>&1 |CT_DoLog ALL
    7.29      fi
    7.30  
    7.31      CT_DoLog EXTRA "Installing MPFR"
    7.32 @@ -66,11 +73,35 @@
    7.33      CT_EndStep
    7.34  }
    7.35  
    7.36 -else # No MPFR
    7.37 +if [ "${CT_GMP_MPFR_TARGET}" = "y" ]; then
    7.38  
    7.39 -do_print_filename() { :; }
    7.40 -do_mpfr_get() { :; }
    7.41 -do_mpfr_extract() { :; }
    7.42 -do_mpfr() { :; }
    7.43 +do_mpfr_target() {
    7.44 +    mkdir -p "${CT_BUILD_DIR}/build-mpfr-target"
    7.45 +    cd "${CT_BUILD_DIR}/build-mpfr-target"
    7.46  
    7.47 -fi
    7.48 +    CT_DoStep INFO "Installing MPFR for the target"
    7.49 +
    7.50 +    CT_DoLog EXTRA "Configuring MPFR"
    7.51 +    CFLAGS="${CT_CFLAGS_FOR_TARGET}"                        \
    7.52 +    "${CT_SRC_DIR}/${CT_MPFR_FILE}/configure"               \
    7.53 +        --build=${CT_BUILD}                                 \
    7.54 +        --host=${CT_TARGET}                                 \
    7.55 +        --prefix=/usr                                       \
    7.56 +        --enable-thread-safe                                \
    7.57 +        --disable-shared --enable-static                    \
    7.58 +        --with-gmp="${CT_SYSROOT_DIR}/usr"                  2>&1 |CT_DoLog ALL
    7.59 +
    7.60 +    CT_DoLog EXTRA "Building MPFR"
    7.61 +    make ${PARALLELMFLAGS}  2>&1 |CT_DoLog ALL
    7.62 +
    7.63 +    # Not possible to check MPFR while X-compiling
    7.64 +
    7.65 +    CT_DoLog EXTRA "Installing MPFR"
    7.66 +    make DESTDIR="${CT_SYSROOT_DIR}" install    2>&1 |CT_DoLog ALL
    7.67 +
    7.68 +    CT_EndStep
    7.69 +}
    7.70 +
    7.71 +fi # CT_GMP_MPFR_TARGET == y
    7.72 +
    7.73 +fi # CT_GMP_MPFR == y
     8.1 --- a/steps.mk	Fri Jun 20 14:00:01 2008 +0000
     8.2 +++ b/steps.mk	Fri Jun 20 15:16:43 2008 +0000
     8.3 @@ -15,6 +15,8 @@
     8.4              cc                  \
     8.5              libc_finish         \
     8.6              binutils_target     \
     8.7 +            gmp_target          \
     8.8 +            mpfr_target         \
     8.9              tools               \
    8.10              debug               \
    8.11