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(-)
This commit is contained in:
Yann E. MORIN" 2008-04-30 10:43:41 +00:00
parent dacd159a98
commit 86c54d8079
11 changed files with 237 additions and 6 deletions

View File

@ -128,3 +128,19 @@ config CC_EXTRA_CONFIG
default ""
help
Extra flags to pass onto ./configure when configuring gcc.
menuconfig CC_GCC_GMP_MPFR
bool
prompt "GMP and MPFR"
help
Recent gcc needs both GMP and MPFR to build some frontends.
Say 'Y' here if you want to build those two libraries specifically
for crosstool-NG.
Saying 'Y' is highly recommended if building gcc-4.3 or higher.
if CC_GCC_GMP_MPFR
source config/cc/gmp.in
source config/cc/mpfr.in
endif

27
config/cc/gmp.in Normal file
View File

@ -0,0 +1,27 @@
# GMP options
choice
bool
prompt "GMP version"
config GMP_V_4_2_2
bool
prompt "4.2.2"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config GMP_VERSION
string
default "4.2.2" if GMP_V_4_2_2
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!
config GMP_CHECK
bool
prompt "Check GMP"
default y
help
It is highly recommended that 'make check' is run against the newly built
GMP library. See http://gmplib.org/

32
config/cc/mpfr.in Normal file
View File

@ -0,0 +1,32 @@
# GMP options
choice
bool
prompt "MPFR version"
config MPFR_V_2_3_0
bool
prompt "2.3.0"
config MPFR_V_2_3_1
bool
prompt "2.3.1"
# CT_INSERT_VERSION_ABOVE
# Don't remove above line!
endchoice
config MPFR_VERSION
string
default "2.3.0" if MPFR_V_2_3_0
default "2.3.1" if MPFR_V_2_3_1
# CT_INSERT_VERSION_STRING_ABOVE
# Don't remove above line!
config MPFR_CHECK
bool
prompt "Check MPFR"
default y
help
It is highly recommended that 'make check' is run against the newly built
MPFR library. See http://gmplib.org/

View File

@ -0,0 +1,38 @@
Original patch from http://gmplib.org/patches/mpf_set_str.c.diff
Re-diffed to match crosstool-NG conventions.
diff -dur gmp-4.2.2.orig/mpf/set_str.c gmp-4.2.2/mpf/set_str.c
--- gmp-4.2.2.orig/mpf/set_str.c 2007-08-30 20:31:40.000000000 +0200
+++ gmp-4.2.2/mpf/set_str.c 2008-01-28 23:05:29.000000000 +0100
@@ -271,8 +271,29 @@
}
if (expptr != 0)
- /* FIXME: Should do some error checking here. */
- exp_in_base = strtol (expptr, (char **) 0, exp_base);
+ {
+ /* Scan and convert the exponent, in base exp_base. */
+ long dig, neg = -(long) ('-' == expptr[0]);
+ expptr -= neg; /* conditional increment */
+ c = (unsigned char) *expptr++;
+ dig = digit_value[c];
+ if (dig >= exp_base)
+ {
+ TMP_FREE;
+ return -1;
+ }
+ exp_in_base = dig;
+ c = (unsigned char) *expptr++;
+ dig = digit_value[c];
+ while (dig < exp_base)
+ {
+ exp_in_base = exp_in_base * exp_base;
+ exp_in_base += dig;
+ c = (unsigned char) *expptr++;
+ dig = digit_value[c];
+ }
+ exp_in_base = (exp_in_base ^ neg) - neg; /* conditional negation */
+ }
else
exp_in_base = 0;
if (dotpos != 0)

View File

@ -25,6 +25,13 @@ do_binutils() {
CT_DoStep INFO "Installing binutils"
binutils_opts=
# If GMP and MPFR were configured, then use that,
# otherwise let binutils find the system-wide libraries, if they exist.
if [ "${CT_CC_GCC_GMP_MPFR}" = "y" ]; then
binutils_opts="--with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
fi
CT_DoLog EXTRA "Configuring binutils"
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
"${CT_SRC_DIR}/${CT_BINUTILS_FILE}/configure" \
@ -34,6 +41,7 @@ do_binutils() {
--target=${CT_TARGET} \
--prefix=${CT_PREFIX_DIR} \
--disable-nls \
${binutils_opts} \
${CT_BINUTILS_EXTRA_CONFIG} \
${BINUTILS_SYSROOT_ARG} 2>&1 |CT_DoLog ALL

View File

@ -7,7 +7,7 @@ do_print_filename() {
echo "gcc-${CT_CC_VERSION}"
}
# Download final gcc
# Download gcc
do_cc_get() {
# Ah! gcc folks are kind of 'different': they store the tarballs in
# subdirectories of the same name! That's because gcc is such /crap/ that
@ -21,7 +21,7 @@ do_cc_get() {
ftp://ftp.gnu.org/gnu/gcc
}
# Extract final gcc
# Extract gcc
do_cc_extract() {
CT_ExtractAndPatch "${CT_CC_FILE}"
}
@ -62,6 +62,7 @@ do_cc_core_static() {
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}"
[ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
@ -114,6 +115,7 @@ do_cc_core_shared() {
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}"
[ "${CT_CC_CXA_ATEXIT}" = "y" ] && extra_config="${extra_config} --enable-__cxa_atexit"
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""
@ -202,12 +204,10 @@ do_cc() {
[ "${CT_CC_LANG_JAVA}" = "y" ] && lang_opt="${lang_opt},java"
[ "${CT_CC_LANG_OBJC}" = "y" ] && lang_opt="${lang_opt},objc"
[ "${CT_CC_LANG_OBJCXX}" = "y" ] && lang_opt="${lang_opt},obj-c++"
CT_Test "Building Fortran language is not yet supported. Will try..." "${CT_CC_LANG_FORTRAN}" = "y"
CT_Test "Building ADA language is not yet supported. Will try..." "${CT_CC_LANG_ADA}" = "y"
CT_Test "Building Java language is not yet supported. Will try..." "${CT_CC_LANG_JAVA}" = "y"
CT_Test "Building Objective-C language is not yet supported. Will try..." "${CT_CC_LANG_OBJC}" = "y"
CT_Test "Building Objective-C++ language is not yet supported. Will try..." "${CT_CC_LANG_OBJCXX}" = "y"
CT_Test "Building ${CT_CC_LANG_OTHERS} language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
CT_Test "Building ${CT_CC_LANG_OTHERS//,/ } language(s) is not yet supported. Will try..." -n "${CT_CC_LANG_OTHERS}"
lang_opt=`echo "${lang_opt},${CT_CC_LANG_OTHERS}" |sed -r -e 's/,+/,/g; s/,*$//;'`
extra_config="--enable-languages=${lang_opt}"
@ -219,6 +219,7 @@ do_cc() {
else
extra_config="${extra_config} --disable-multilib"
fi
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] && extra_config="${extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
CT_DoLog DEBUG "Extra config passed: \"${extra_config}\""

49
scripts/build/gmp.sh Normal file
View File

@ -0,0 +1,49 @@
# This file adds the functions to build the GMP library
# Copyright 2008 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
do_print_filename() {
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] || return 0
echo "gmp-${CT_GMP_VERSION}"
}
# Download GMP
do_gmp_get() {
CT_GetFile "${CT_GMP_FILE}" \
http://ftp.sunet.se/pub/gnu/gmp \
ftp://ftp.gnu.org/gnu/gmp
}
# Extract GMP
do_gmp_extract() {
CT_ExtractAndPatch "${CT_GMP_FILE}"
}
do_gmp() {
mkdir -p "${CT_BUILD_DIR}/build-gmp"
cd "${CT_BUILD_DIR}/build-gmp"
CT_DoStep INFO "Installing GMP"
CT_DoLog EXTRA "Configuring GMP"
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
"${CT_SRC_DIR}/${CT_GMP_FILE}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_PREFIX_DIR}" \
--disable-shared --enable-static \
--enable-fft --enable-mpbsd 2>&1 |CT_DoLog ALL
CT_DoLog EXTRA "Building GMP"
make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
if [ "${CT_GMP_CHECK}" = "y" ]; then
CT_DoLog EXTRA "Checking GMP"
make -s check 2>&1 |CT_DoLog ALL
fi
CT_DoLog EXTRA "Installing GMP"
make install 2>&1 |CT_DoLog ALL
CT_EndStep
}

47
scripts/build/mpfr.sh Normal file
View File

@ -0,0 +1,47 @@
# This file adds the functions to build the MPFR library
# Copyright 2008 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
do_print_filename() {
[ "${CT_CC_GCC_GMP_MPFR}" = "y" ] || return 0
echo "mpfr-${CT_MPFR_VERSION}"
}
# Download MPFR
do_mpfr_get() {
CT_GetFile "${CT_MPFR_FILE}" http://www.mpfr.org/mpfr-current/
}
# Extract MPFR
do_mpfr_extract() {
CT_ExtractAndPatch "${CT_MPFR_FILE}"
}
do_mpfr() {
mkdir -p "${CT_BUILD_DIR}/build-mpfr"
cd "${CT_BUILD_DIR}/build-mpfr"
CT_DoStep INFO "Installing MPFR"
CT_DoLog EXTRA "Configuring MPFR"
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
"${CT_SRC_DIR}/${CT_MPFR_FILE}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
--prefix="${CT_PREFIX_DIR}" \
--disable-shared --enable-static \
--with-gmp="${CT_PREFIX_DIR}" 2>&1 |CT_DoLog ALL
CT_DoLog EXTRA "Building MPFR"
make ${PARALLELMFLAGS} 2>&1 |CT_DoLog ALL
if [ "${CT_MPFR_CHECK}" = "y" ]; then
CT_DoLog EXTRA "Checking MPFR"
make -s check 2>&1 |CT_DoLog ALL
fi
CT_DoLog EXTRA "Installing MPFR"
make install 2>&1 |CT_DoLog ALL
CT_EndStep
}

View File

@ -73,6 +73,8 @@ CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}"
# Now, build up the variables from the user-configured options.
CT_KERNEL_FILE="${CT_KERNEL}-${CT_KERNEL_VERSION}"
CT_BINUTILS_FILE="binutils-${CT_BINUTILS_VERSION}"
CT_GMP_FILE="gmp-${CT_GMP_VERSION}"
CT_MPFR_FILE="mpfr-${CT_MPFR_VERSION}"
CT_CC_FILE="${CT_CC}-${CT_CC_VERSION}"
CT_LIBC_FILE="${CT_LIBC}-${CT_LIBC_VERSION}"
@ -417,6 +419,8 @@ fi
# Include sub-scripts instead of calling them: that way, we do not have to
# export any variable, nor re-parse the configuration and functions files.
. "${CT_LIB_DIR}/scripts/build/kernel_${CT_KERNEL}.sh"
. "${CT_LIB_DIR}/scripts/build/gmp.sh"
. "${CT_LIB_DIR}/scripts/build/mpfr.sh"
. "${CT_LIB_DIR}/scripts/build/binutils.sh"
. "${CT_LIB_DIR}/scripts/build/libc_${CT_LIBC}.sh"
. "${CT_LIB_DIR}/scripts/build/cc_${CT_CC}.sh"
@ -426,6 +430,8 @@ fi
if [ -z "${CT_RESTART}" ]; then
CT_DoStep INFO "Retrieving needed toolchain components' tarballs"
do_kernel_get
do_gmp_get
do_mpfr_get
do_binutils_get
do_cc_get
do_libc_get
@ -440,6 +446,8 @@ if [ -z "${CT_RESTART}" ]; then
fi
CT_DoStep INFO "Extracting and patching toolchain components"
do_kernel_extract
do_gmp_extract
do_mpfr_extract
do_binutils_extract
do_cc_extract
do_libc_extract
@ -455,7 +463,7 @@ if [ "${CT_ONLY_DOWNLOAD}" != "y" -a "${CT_ONLY_EXTRACT}" != "y" ]; then
do_stop=0
prev_step=
[ -n "${CT_RESTART}" ] && do_it=0 || do_it=1
# CT_STEPS comes from steps.mk!
# Aha! CT_STEPS comes from steps.mk!
for step in ${CT_STEPS}; do
if [ ${do_it} -eq 0 ]; then
if [ "${CT_RESTART}" = "${step}" ]; then

View File

@ -4,6 +4,8 @@
CT_STEPS := libc_check_config \
kernel_check_config \
kernel_headers \
gmp \
mpfr \
binutils \
cc_core_pass_1 \
libc_headers \

View File

@ -9,6 +9,7 @@ Usage: ${myname} <tool> [option] <version>
'tool' in one of:
--gcc, --binutils, --glibc, --uClibc, --linux,
--gdb, --dmalloc, --duma, --strace, --ltrace, --libelf
--gmp, --mpfr
Valid options for all tools:
--experimental, -x
@ -55,6 +56,8 @@ while [ $i -le $# ]; do
--strace) cat=STRACE; tool=strace; tool_prefix=debug tool_suffix=;;
--ltrace) cat=LTRACE; tool=ltrace; tool_prefix=debug tool_suffix=;;
--libelf) cat=LIBELF; tool=libelf; tool_prefix=tools tool_suffix=;;
--gmp) cat=GMP; tool=gmp; tool_prefix=cc; tool_suffix=;;
--mpfr) cat=MPFR; tool=mpfr; tool_prefix=cc; tool_suffix=;;
# Tools options:
-x|--experimental) EXP=1; OBS=; prompt_suffix=" (EXPERIMENTAL)";;
-o|--obsolete) OBS=1; EXP=; prompt_suffix=" (OBSOLETE)";;