diff options
-rw-r--r-- | config/cc.in | 3 | ||||
-rw-r--r-- | config/cc/gcc.in | 109 | ||||
-rw-r--r-- | config/cc/gcc.in.2 | 10 | ||||
-rw-r--r-- | patches/ncurses/5.9/100-ncurses-5.9-gcc5-buildfixes-1.patch | 39 | ||||
-rw-r--r-- | scripts/build/cc.sh | 58 | ||||
-rw-r--r-- | scripts/build/cc/100-gcc.sh (renamed from scripts/build/cc/gcc.sh) | 140 | ||||
-rw-r--r-- | scripts/build/debug/300-gdb.sh | 8 | ||||
-rw-r--r-- | scripts/build/internals.sh | 54 | ||||
-rw-r--r-- | scripts/build/test_suite/gcc.sh | 8 | ||||
-rw-r--r-- | scripts/crosstool-NG.sh.in | 10 | ||||
-rwxr-xr-x | scripts/gen_in_frags.sh | 3 | ||||
-rwxr-xr-x | scripts/showSamples.sh | 22 |
12 files changed, 291 insertions, 173 deletions
diff --git a/config/cc.in b/config/cc.in index aca8380e..5603738f 100644 --- a/config/cc.in +++ b/config/cc.in @@ -4,6 +4,7 @@ menu "C compiler" config CC string + default "gcc" config CC_VERSION string @@ -134,6 +135,4 @@ config CC_LANG_OTHERS Eg. gcc-4.1+ has a toy programming language, treelang. As it is not useful in real life, it is not available in the selection above. -source "config.gen/cc.in.2" - endmenu diff --git a/config/cc/gcc.in b/config/cc/gcc.in index a91e1431..c03ffa5e 100644 --- a/config/cc/gcc.in +++ b/config/cc/gcc.in @@ -1,5 +1,6 @@ # Compiler options # +## default y ## select CC_SUPPORT_CXX ## select CC_SUPPORT_FORTRAN ## select CC_SUPPORT_JAVA @@ -36,256 +37,256 @@ choice # Don't remove next line # CT_INSERT_VERSION_BELOW -config CC_V_5_1 +config CC_GCC_V_5_1 bool prompt "5.1.0" select CC_GCC_5_1 -config CC_V_linaro_4_9 +config CC_GCC_V_linaro_4_9 bool prompt "linaro-4.9-2015.03" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_9 -config CC_V_4_9_2 +config CC_GCC_V_4_9_2 bool prompt "4.9.2" select CC_GCC_4_9 -config CC_V_4_9_1 +config CC_GCC_V_4_9_1 bool prompt "4.9.1" select CC_GCC_4_9 -config CC_V_4_9_0 +config CC_GCC_V_4_9_0 bool prompt "4.9.0" select CC_GCC_4_9 -config CC_V_linaro_4_8 +config CC_GCC_V_linaro_4_8 bool prompt "linaro-4.8-2015.02" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_8 -config CC_V_4_8_4 +config CC_GCC_V_4_8_4 bool prompt "4.8.4" select CC_GCC_4_8 -config CC_V_4_8_3 +config CC_GCC_V_4_8_3 bool prompt "4.8.3" select CC_GCC_4_8 -config CC_V_4_8_2 +config CC_GCC_V_4_8_2 bool prompt "4.8.2" select CC_GCC_4_8 -config CC_V_4_8_1 +config CC_GCC_V_4_8_1 bool prompt "4.8.1" select CC_GCC_4_8 -config CC_V_4_8_0 +config CC_GCC_V_4_8_0 bool prompt "4.8.0" select CC_GCC_4_8 -config CC_V_linaro_4_7 +config CC_GCC_V_linaro_4_7 bool prompt "linaro-4.7-2014.06" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_7 -config CC_V_4_7_4 +config CC_GCC_V_4_7_4 bool prompt "4.7.4" select CC_GCC_4_7 -config CC_V_4_7_3 +config CC_GCC_V_4_7_3 bool prompt "4.7.3" select CC_GCC_4_7 -config CC_V_4_7_2 +config CC_GCC_V_4_7_2 bool prompt "4.7.2" select CC_GCC_4_7 -config CC_V_4_7_1 +config CC_GCC_V_4_7_1 bool prompt "4.7.1" select CC_GCC_4_7 -config CC_V_4_7_0 +config CC_GCC_V_4_7_0 bool prompt "4.7.0" select CC_GCC_4_7 -config CC_V_linaro_4_6 +config CC_GCC_V_linaro_4_6 bool prompt "linaro-4.6-2013.05" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_6 -config CC_V_4_6_4 +config CC_GCC_V_4_6_4 bool prompt "4.6.4" select CC_GCC_4_6 -config CC_V_4_6_3 +config CC_GCC_V_4_6_3 bool prompt "4.6.3" select CC_GCC_4_6 -config CC_V_4_6_2 +config CC_GCC_V_4_6_2 bool prompt "4.6.2" select CC_GCC_4_6 -config CC_V_4_6_1 +config CC_GCC_V_4_6_1 bool prompt "4.6.1" select CC_GCC_4_6 -config CC_V_4_6_0 +config CC_GCC_V_4_6_0 bool prompt "4.6.0" select CC_GCC_4_6 -config CC_V_linaro_4_5 +config CC_GCC_V_linaro_4_5 bool prompt "linaro-4.5-2012.03" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_5 -config CC_V_4_5_3 +config CC_GCC_V_4_5_3 bool prompt "4.5.3" select CC_GCC_4_5 -config CC_V_4_5_2 +config CC_GCC_V_4_5_2 bool prompt "4.5.2" select CC_GCC_4_5 -config CC_V_4_5_1 +config CC_GCC_V_4_5_1 bool prompt "4.5.1" select CC_GCC_4_5 -config CC_V_4_5_0 +config CC_GCC_V_4_5_0 bool prompt "4.5.0" select CC_GCC_4_5 -config CC_V_linaro_4_4 +config CC_GCC_V_linaro_4_4 bool prompt "linaro-4.4-2011.02-0" depends on CC_GCC_SHOW_LINARO select CC_GCC_4_4 -config CC_V_4_4_7 +config CC_GCC_V_4_4_7 bool prompt "4.4.7" select CC_GCC_4_4 -config CC_V_4_4_6 +config CC_GCC_V_4_4_6 bool prompt "4.4.6" select CC_GCC_4_4 -config CC_V_4_4_5 +config CC_GCC_V_4_4_5 bool prompt "4.4.5" select CC_GCC_4_4 -config CC_V_4_4_4 +config CC_GCC_V_4_4_4 bool prompt "4.4.4" select CC_GCC_4_4 -config CC_V_4_4_3 +config CC_GCC_V_4_4_3 bool prompt "4.4.3" select CC_GCC_4_4 -config CC_V_4_4_2 +config CC_GCC_V_4_4_2 bool prompt "4.4.2" select CC_GCC_4_4 -config CC_V_4_4_1 +config CC_GCC_V_4_4_1 bool prompt "4.4.1" select CC_GCC_4_4 -config CC_V_4_4_0 +config CC_GCC_V_4_4_0 bool prompt "4.4.0" select CC_GCC_4_4 -config CC_V_4_3_6 +config CC_GCC_V_4_3_6 bool prompt "4.3.6" select CC_GCC_4_3 -config CC_V_4_3_5 +config CC_GCC_V_4_3_5 bool prompt "4.3.5" select CC_GCC_4_3 -config CC_V_4_3_4 +config CC_GCC_V_4_3_4 bool prompt "4.3.4" select CC_GCC_4_3 -config CC_V_4_3_3 +config CC_GCC_V_4_3_3 bool prompt "4.3.3" select CC_GCC_4_3 -config CC_V_4_3_2 +config CC_GCC_V_4_3_2 bool prompt "4.3.2" select CC_GCC_4_3 -config CC_V_4_3_1 +config CC_GCC_V_4_3_1 bool prompt "4.3.1" select CC_GCC_4_3 -config CC_V_4_2_4 +config CC_GCC_V_4_2_4 bool prompt "4.2.4" select CC_GCC_4_2 # We need that one, it's the only version with avr32 support # because we have a patch for it -config CC_V_4_2_2 +config CC_GCC_V_4_2_2 bool prompt "4.2.2" select CC_GCC_4_2 -config CC_V_4_1_2 +config CC_GCC_V_4_1_2 bool prompt "4.1.2 (OBSOLETE)" depends on OBSOLETE -config CC_V_4_0_4 +config CC_GCC_V_4_0_4 bool prompt "4.0.4 (OBSOLETE)" depends on OBSOLETE -config CC_V_3_4_6 +config CC_GCC_V_3_4_6 bool prompt "3.4.6 (OBSOLETE)" depends on OBSOLETE -config CC_CUSTOM +config CC_GCC_CUSTOM bool prompt "Custom gcc" depends on EXPERIMENTAL @@ -293,9 +294,9 @@ config CC_CUSTOM endchoice -if CC_CUSTOM +if CC_GCC_CUSTOM -config CC_CUSTOM_LOCATION +config CC_GCC_CUSTOM_LOCATION string prompt "Full path to custom gcc source" default "" @@ -303,7 +304,7 @@ config CC_CUSTOM_LOCATION Enter the path to the directory (or tarball) of your source for gcc, or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/gcc -endif #CC_CUSTOM +endif #CC_GCC_CUSTOM config CC_GCC_4_2 bool @@ -527,7 +528,7 @@ config CC_GCC_HAS_LIBQUADMATH config CC_GCC_HAS_LIBSANITIZER bool -config CC_VERSION +config CC_GCC_VERSION string # Don't remove next line # CT_INSERT_VERSION_STRING_BELOW @@ -591,3 +592,5 @@ config CC_LANG_JAVA_USE_ECJ # Fortran always requires GMP+MPFR, whatever the gcc version config CC_LANG_FORTRAN select CC_GCC_USE_GMP_MPFR + +source "config/cc/gcc.in.2" diff --git a/config/cc/gcc.in.2 b/config/cc/gcc.in.2 index b088515c..fb19938e 100644 --- a/config/cc/gcc.in.2 +++ b/config/cc/gcc.in.2 @@ -1,6 +1,6 @@ # gcc configuration options -config CC_ENABLE_CXX_FLAGS +config CC_GCC_ENABLE_CXX_FLAGS string prompt "Flags to pass to --enable-cxx-flags" default "" @@ -11,7 +11,7 @@ config CC_ENABLE_CXX_FLAGS Note: just pass in the option _value_, that is only the part that goes after the '=' sign. -config CC_CORE_EXTRA_CONFIG_ARRAY +config CC_GCC_CORE_EXTRA_CONFIG_ARRAY string prompt "Core gcc extra config" default "" @@ -26,7 +26,7 @@ config CC_CORE_EXTRA_CONFIG_ARRAY if they are properly quoted (or escaped, but prefer quotes). Eg.: --with-foo="1st arg with 4 spaces" --with-bar=2nd-arg-without-space -config CC_EXTRA_CONFIG_ARRAY +config CC_GCC_EXTRA_CONFIG_ARRAY string prompt "gcc extra config" default "" @@ -38,9 +38,9 @@ config CC_EXTRA_CONFIG_ARRAY --with-foo="1st arg with 4 spaces" --with-bar=2nd-arg-without-space config STATIC_TOOLCHAIN - select CC_STATIC_LIBSTDCXX if CC_GCC_4_4_or_later + select CC_GCC_STATIC_LIBSTDCXX if CC_GCC_4_4_or_later -config CC_STATIC_LIBSTDCXX +config CC_GCC_STATIC_LIBSTDCXX bool prompt "Link libstdc++ statically into the gcc binary" default y diff --git a/patches/ncurses/5.9/100-ncurses-5.9-gcc5-buildfixes-1.patch b/patches/ncurses/5.9/100-ncurses-5.9-gcc5-buildfixes-1.patch new file mode 100644 index 00000000..be64931f --- /dev/null +++ b/patches/ncurses/5.9/100-ncurses-5.9-gcc5-buildfixes-1.patch @@ -0,0 +1,39 @@ +Submitted By: Douglas R. Reno <renodr2002@gmail.com> +Date: 2015-04-15 +Initial Package Version: 5.9 +Upstream Status: Unknown +Origin: ftp://invisible-island.net/ncurses/5.9/ncurses-5.9-20141206.patch.gz +Description: Fixes a compilation issue with GCC 5.1. Note that this patch was trimmed from the above patch. + +Index: ncurses-5.9/ncurses/base/MKlib_gen.sh +=========================================================================================== + +--- ncurses-5.9-20141129+/ncurses/base/MKlib_gen.sh 2011-06-04 19:14:08.000000000 +0000 ++++ ncurses-5.9-20141206/ncurses/base/MKlib_gen.sh 2014-12-06 18:56:25.000000000 +0000 +@@ -474,11 +474,22 @@ + -e 's/gen_$//' \ + -e 's/ / /g' >>$TMP + ++cat >$ED1 <<EOF ++s/ / /g ++s/^ // ++s/ $// ++s/P_NCURSES_BOOL/NCURSES_BOOL/g ++EOF ++ ++# A patch discussed here: ++# https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02185.html ++# introduces spurious #line markers. Work around that by ignoring the system's ++# attempt to define "bool" and using our own symbol here. ++sed -e 's/bool/P_NCURSES_BOOL/g' $TMP > $ED2 ++cat $ED2 >$TMP ++ + $preprocessor $TMP 2>/dev/null \ +-| sed \ +- -e 's/ / /g' \ +- -e 's/^ //' \ +- -e 's/_Bool/NCURSES_BOOL/g' \ ++| sed -f $ED1 \ + | $AWK -f $AW2 \ + | sed -f $ED3 \ + | sed \ diff --git a/scripts/build/cc.sh b/scripts/build/cc.sh new file mode 100644 index 00000000..3c8aaefc --- /dev/null +++ b/scripts/build/cc.sh @@ -0,0 +1,58 @@ +# Wrapper to build the companion tools facilities + +# List all companion tools facilities, and parse their scripts +CT_CC_FACILITY_LIST= +for f in "${CT_LIB_DIR}/scripts/build/cc/"*.sh; do + _f="$(basename "${f}" .sh)" + _f="${_f#???-}" + __f="CT_CC_${_f}" + if [ "${!__f}" = "y" ]; then + CT_DoLog DEBUG "Enabling cc '${_f}'" + . "${f}" + CT_CC_FACILITY_LIST="${CT_CC_FACILITY_LIST} ${_f}" + else + CT_DoLog DEBUG "Disabling cc '${_f}'" + fi +done + +# Download the cc facilities +do_cc_get() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_get + done +} + +# Extract and patch the cc facilities +do_cc_extract() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_extract + done +} + +# Core pass 1 the cc facilities +do_cc_core_pass_1() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_core_pass_1 + done +} + +# Core pass 2 the cc facilities +do_cc_core_pass_2() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_core_pass_2 + done +} + +# Build for build the cc facilities +do_cc_for_build() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_for_build + done +} + +# Build for host the cc facilities +do_cc_for_host() { + for f in ${CT_CC_FACILITY_LIST}; do + do_${f}_for_host + done +} diff --git a/scripts/build/cc/gcc.sh b/scripts/build/cc/100-gcc.sh index 835aea06..f6ea34ea 100644 --- a/scripts/build/cc/gcc.sh +++ b/scripts/build/cc/100-gcc.sh @@ -3,15 +3,15 @@ # Licensed under the GPL v2. See COPYING in the root of this package # Download gcc -do_cc_get() { +do_gcc_get() { local linaro_version="" local linaro_series="" - if [ "${CT_CC_CUSTOM}" = "y" ]; then - CT_GetCustom "gcc" "${CT_CC_VERSION}" "${CT_CC_CUSTOM_LOCATION}" + if [ "${CT_CC_GCC_CUSTOM}" = "y" ]; then + CT_GetCustom "gcc" "${CT_CC_GCC_VERSION}" "${CT_CC_GCC_CUSTOM_LOCATION}" else # Account for the Linaro versioning - linaro_version="$( echo "${CT_CC_VERSION}" \ + linaro_version="$( echo "${CT_CC_GCC_VERSION}" \ |${sed} -r -e 's/^linaro-//;' \ )" linaro_series="$( echo "${linaro_version}" \ @@ -21,13 +21,13 @@ do_cc_get() { # The official gcc hosts put gcc under a gcc/release/ directory, # whereas the mirrors put it in the gcc/ directory. # Also, Split out linaro mirrors, so that downloads happen faster. - if [ x"${linaro_version}" = x"${CT_CC_VERSION}" ]; then - CT_GetFile "gcc-${CT_CC_VERSION}" \ - {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_VERSION} \ - ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_VERSION} + if [ x"${linaro_version}" = x"${CT_CC_GCC_VERSION}" ]; then + CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ + {http,ftp,https}://ftp.gnu.org/gnu/gcc/gcc-${CT_CC_GCC_VERSION} \ + ftp://{gcc.gnu.org,sourceware.org}/pub/gcc/releases/gcc-${CT_CC_GCC_VERSION} else - YYMM=`echo ${CT_CC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'` - CT_GetFile "gcc-${CT_CC_VERSION}" \ + YYMM=`echo ${CT_CC_GCC_VERSION} |cut -d- -f3 |${sed} -e 's,^..,,'` + CT_GetFile "gcc-${CT_CC_GCC_VERSION}" \ "http://launchpad.net/gcc-linaro/${linaro_series}/${linaro_version}/+download" \ https://releases.linaro.org/${YYMM}/components/toolchain/gcc-linaro/${linaro_series} \ http://cbuild.validation.linaro.org/snapshots @@ -47,21 +47,21 @@ do_cc_get() { } # Extract gcc -do_cc_extract() { +do_gcc_extract() { # If using custom directory location, nothing to do - if [ "${CT_CC_CUSTOM}" = "y" \ - -a -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}" ]; then + if [ "${CT_CC_GCC_CUSTOM}" = "y" \ + -a -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}" ]; then return 0 fi - CT_Extract "gcc-${CT_CC_VERSION}" - CT_Patch "gcc" "${CT_CC_VERSION}" + CT_Extract "gcc-${CT_CC_GCC_VERSION}" + CT_Patch "gcc" "${CT_CC_GCC_VERSION}" # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree if [ "${CT_CC_LANG_JAVA_USE_ECJ}" = "y" \ - -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" \ + -a ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" \ ]; then - CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/ecj.jar" + CT_DoExecLog ALL cp -v "${CT_TARBALLS_DIR}/ecj-latest.jar" "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/ecj.jar" fi } @@ -86,7 +86,7 @@ cc_gcc_lang_list() { #------------------------------------------------------------------------------ # Core gcc pass 1 -do_cc_core_pass_1() { +do_gcc_core_pass_1() { local -a core_opts if [ "${CT_CC_CORE_PASS_1_NEEDED}" != "y" ]; then @@ -101,17 +101,17 @@ do_cc_core_pass_1() { core_opts+=( "ldflags=${CT_LDFLAGS_FOR_HOST}" ) core_opts+=( "lang_list=c" ) - CT_DoStep INFO "Installing pass-1 core C compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-1" + CT_DoStep INFO "Installing pass-1 core C gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-1" - do_cc_core_backend "${core_opts[@]}" + do_gcc_core_backend "${core_opts[@]}" CT_Popd CT_EndStep } # Core gcc pass 2 -do_cc_core_pass_2() { +do_gcc_core_pass_2() { local -a core_opts if [ "${CT_CC_CORE_PASS_2_NEEDED}" != "y" ]; then @@ -148,10 +148,10 @@ do_cc_core_pass_2() { ;; esac - CT_DoStep INFO "Installing pass-2 core C compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-core-pass-2" + CT_DoStep INFO "Installing pass-2 core C gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-core-pass-2" - do_cc_core_backend "${core_opts[@]}" + do_gcc_core_backend "${core_opts[@]}" CT_Popd CT_EndStep @@ -160,7 +160,7 @@ do_cc_core_pass_2() { #------------------------------------------------------------------------------ # Build core gcc # This function is used to build the core C compiler. -# Usage: do_cc_core_backend param=value [...] +# Usage: do_gcc_core_backend param=value [...] # Parameter : Definition : Type : Default # mode : build a 'static', 'shared' or 'baremetal' : string : (none) # host : the machine the core will run on : tuple : (none) @@ -174,8 +174,8 @@ do_cc_core_pass_2() { # build_manuals : whether to build manuals or not : bool : no # cflags : cflags to use : string : (empty) # ldflags : ldflags to use : string : (empty) -# Usage: do_cc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] -do_cc_core_backend() { +# Usage: do_gcc_core_backend mode=[static|shared|baremetal] build_libgcc=[yes|no] build_staticlinked=[yes|no] +do_gcc_core_backend() { local mode local build_libgcc=no local build_libstdcxx=no @@ -200,7 +200,7 @@ do_cc_core_backend() { eval "${arg// /\\ }" done - CT_DoLog EXTRA "Configuring gcc" + CT_DoLog EXTRA "Configuring core C gcc compiler" case "${mode}" in static) @@ -249,7 +249,7 @@ do_cc_core_backend() { # *** WARNING ! *** # Keep this full if-else-if-elif-fi-fi block in sync - # with the same block in do_cc, below. + # with the same block in do_gcc, below. if [ "${build_staticlinked}" = "yes" ]; then core_LDFLAGS+=("-static") host_libstdcxx_flags+=("-static-libgcc") @@ -262,7 +262,7 @@ do_cc_core_backend() { core_LDFLAGS+=("-lstdc++") core_LDFLAGS+=("-lm") else - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 # build script # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, @@ -379,21 +379,21 @@ do_cc_core_backend() { CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'" # Use --with-local-prefix so older gccs don't look in /usr/local (http://gcc.gnu.org/PR10532) - CT_DoExecLog CFG \ - CC_FOR_BUILD="${CT_BUILD}-gcc" \ - CFLAGS="${cflags}" \ - CXXFLAGS="${cflags}" \ - LDFLAGS="${core_LDFLAGS[*]}" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ - --build=${CT_BUILD} \ - --host=${host} \ - --target=${CT_TARGET} \ - --prefix="${prefix}" \ - --with-local-prefix="${CT_SYSROOT_DIR}" \ - --disable-libmudflap \ - ${CC_CORE_SYSROOT_ARG} \ - "${extra_config[@]}" \ - --enable-languages="${lang_list}" \ + CT_DoExecLog CFG \ + CC_FOR_BUILD="${CT_BUILD}-gcc" \ + CFLAGS="${cflags}" \ + CXXFLAGS="${cflags}" \ + LDFLAGS="${core_LDFLAGS[*]}" \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \ + --build=${CT_BUILD} \ + --host=${host} \ + --target=${CT_TARGET} \ + --prefix="${prefix}" \ + --with-local-prefix="${CT_SYSROOT_DIR}" \ + --disable-libmudflap \ + ${CC_CORE_SYSROOT_ARG} \ + "${extra_config[@]}" \ + --enable-languages="${lang_list}" \ "${extra_user_config[@]}" if [ "${build_libgcc}" = "yes" ]; then @@ -413,7 +413,7 @@ do_cc_core_backend() { # so we configure then build it. # Next we have to configure gcc, create libgcc.mk then edit it... # So much easier if we just edit the source tree, but hey... - if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then + if [ ! -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libiberty CT_DoExecLog ALL make ${JOBSFLAGS} -C libiberty libiberty.a CT_DoExecLog CFG make ${JOBSFLAGS} configure-gcc configure-libcpp @@ -423,12 +423,12 @@ do_cc_core_backend() { CT_DoExecLog ALL make ${JOBSFLAGS} all-libcpp all-build-libiberty fi # HACK: gcc-4.2 uses libdecnumber to build libgcc.mk, so build it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libdecnumber" ]; then + if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libdecnumber" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libdecnumber CT_DoExecLog ALL make ${JOBSFLAGS} -C libdecnumber libdecnumber.a fi # HACK: gcc-4.8 uses libbacktrace to make libgcc.mvars, so make it here. - if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/libbacktrace" ]; then + if [ -d "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/libbacktrace" ]; then CT_DoExecLog CFG make ${JOBSFLAGS} configure-libbacktrace CT_DoExecLog ALL make ${JOBSFLAGS} -C libbacktrace fi @@ -519,7 +519,7 @@ do_cc_core_backend() { #------------------------------------------------------------------------------ # Build complete gcc to run on build -do_cc_for_build() { +do_gcc_for_build() { local -a build_final_opts local build_final_backend @@ -544,13 +544,13 @@ do_cc_for_build() { if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then build_final_opts+=( "build_staticlinked=yes" ) fi - build_final_backend=do_cc_core_backend + build_final_backend=do_gcc_core_backend else - build_final_backend=do_cc_backend + build_final_backend=do_gcc_backend fi - CT_DoStep INFO "Installing final compiler for build" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final-build-${CT_BUILD}" + CT_DoStep INFO "Installing final gcc compiler for build" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-final-build-${CT_BUILD}" "${build_final_backend}" "${build_final_opts[@]}" @@ -560,7 +560,7 @@ do_cc_for_build() { #------------------------------------------------------------------------------ # Build final gcc to run on host -do_cc_for_host() { +do_gcc_for_host() { local -a final_opts local final_backend @@ -581,13 +581,13 @@ do_cc_for_host() { if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_opts+=( "build_staticlinked=yes" ) fi - final_backend=do_cc_core_backend + final_backend=do_gcc_core_backend else - final_backend=do_cc_backend + final_backend=do_gcc_backend fi - CT_DoStep INFO "Installing final compiler" - CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-final" + CT_DoStep INFO "Installing final gcc compiler" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-cc-gcc-final" "${final_backend}" "${final_opts[@]}" @@ -597,7 +597,7 @@ do_cc_for_host() { #------------------------------------------------------------------------------ # Build the final gcc -# Usage: do_cc_backend param=value [...] +# Usage: do_gcc_backend param=value [...] # Parameter : Definition : Type : Default # host : the host we run onto : tuple : (none) # prefix : the runtime prefix : dir : (none) @@ -606,7 +606,7 @@ do_cc_for_host() { # ldflags : ldflags to use : string : (empty) # lang_list : the list of languages to build : string : (empty) # build_manuals : whether to build manuals or not : bool : no -do_cc_backend() { +do_gcc_backend() { local host local prefix local complibs @@ -624,7 +624,7 @@ do_cc_backend() { eval "${arg// /\\ }" done - CT_DoLog EXTRA "Configuring gcc" + CT_DoLog EXTRA "Configuring final gcc compiler" # Enable selected languages extra_config+=("--enable-languages=${lang_list}") @@ -651,8 +651,8 @@ do_cc_backend() { else extra_config+=("--disable-__cxa_atexit") fi - if [ -n "${CT_CC_ENABLE_CXX_FLAGS}" ]; then - extra_config+=("--enable-cxx-flags=${CT_CC_ENABLE_CXX_FLAGS}") + if [ -n "${CT_CC_GCC_ENABLE_CXX_FLAGS}" ]; then + extra_config+=("--enable-cxx-flags=${CT_CC_GCC_ENABLE_CXX_FLAGS}") fi if [ "${CT_CC_GCC_4_8_or_later}" = "y" ]; then if [ "${CT_THREADS}" = "none" ]; then @@ -695,7 +695,7 @@ do_cc_backend() { # *** WARNING ! *** # Keep this full if-else-if-elif-fi-fi block in sync - # with the same block in do_cc_core, above. + # with the same block in do_gcc_core, above. if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then final_LDFLAGS+=("-static") host_libstdcxx_flags+=("-static-libgcc") @@ -708,7 +708,7 @@ do_cc_backend() { final_LDFLAGS+=("-lstdc++") final_LDFLAGS+=("-lm") else - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then + if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then # this is from CodeSourcery arm-2010q1-202-arm-none-linux-gnueabi.src.tar.bz2 # build script # INFO: if the host gcc is gcc-4.5 then presumably we could use -static-libstdc++, @@ -851,7 +851,7 @@ do_cc_backend() { CFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ CXXFLAGS_FOR_TARGET="${CT_TARGET_CFLAGS}" \ LDFLAGS_FOR_TARGET="${CT_TARGET_LDFLAGS}" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/configure" \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/configure" \ --build=${CT_BUILD} \ --host=${host} \ --target=${CT_TARGET} \ @@ -861,17 +861,17 @@ do_cc_backend() { --with-local-prefix="${CT_SYSROOT_DIR}" \ --enable-c99 \ --enable-long-long \ - "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" + "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" if [ "${CT_CANADIAN}" = "y" ]; then CT_DoLog EXTRA "Building libiberty" CT_DoExecLog ALL make ${JOBSFLAGS} all-build-libiberty fi - CT_DoLog EXTRA "Building gcc" + CT_DoLog EXTRA "Building final gcc compiler" CT_DoExecLog ALL make ${JOBSFLAGS} all - CT_DoLog EXTRA "Installing gcc" + CT_DoLog EXTRA "Installing final gcc compiler" CT_DoExecLog ALL make ${JOBSFLAGS} install if [ "${build_manuals}" = "yes" ]; then diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh index 4eee2147..93086b97 100644 --- a/scripts/build/debug/300-gdb.sh +++ b/scripts/build/debug/300-gdb.sh @@ -188,11 +188,11 @@ do_debug_gdb_build() { if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then CT_DoLog EXTRA "Installing '.gdbinit' template" # See in scripts/build/internals.sh for why we do this - if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then - gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ) + if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then + gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ) else - gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c" \ + gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \ ) fi ${sed} -r \ diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh index c7eb4c80..21f64728 100644 --- a/scripts/build/internals.sh +++ b/scripts/build/internals.sh @@ -28,33 +28,35 @@ do_finish() { CT_DoExecLog ALL "${CT_TARGET}-strip" ${strip_args} \ "${CT_TARGET}/debug-root/usr/bin/gdbserver" fi - # We can not use the version in CT_CC_VERSION because - # of the Linaro stuff. So, harvest the version string - # directly from the gcc sources... - # All gcc 4.x seem to have the version in gcc/BASE-VER - # while version prior to 4.x have the version in gcc/version.c - # Of course, here is not the better place to do that... - if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then - gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ) - else - gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c" \ - ) + if [ "${CT_CC_gcc}" = "y" ]; then + # We can not use the version in CT_CC_GCC_VERSION because + # of the Linaro stuff. So, harvest the version string + # directly from the gcc sources... + # All gcc 4.x seem to have the version in gcc/BASE-VER + # while version prior to 4.x have the version in gcc/version.c + # Of course, here is not the better place to do that... + if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then + gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ) + else + gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \ + ) + fi + for _t in "bin/${CT_TARGET}-"* \ + "${CT_TARGET}/bin/"* \ + "libexec/gcc/${CT_TARGET}/${gcc_version}/"* \ + "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \ + ; do + _type="$( file "${_t}" |cut -d ' ' -f 2- )" + case "${_type}" in + *script*executable*) + ;; + *executable*) + CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}" + ;; + esac + done fi - for _t in "bin/${CT_TARGET}-"* \ - "${CT_TARGET}/bin/"* \ - "libexec/gcc/${CT_TARGET}/${gcc_version}/"* \ - "libexec/gcc/${CT_TARGET}/${gcc_version}/install-tools/"* \ - ; do - _type="$( file "${_t}" |cut -d ' ' -f 2- )" - case "${_type}" in - *script*executable*) - ;; - *executable*) - CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}" - ;; - esac - done CT_Popd fi diff --git a/scripts/build/test_suite/gcc.sh b/scripts/build/test_suite/gcc.sh index 178cffd5..c829a438 100644 --- a/scripts/build/test_suite/gcc.sh +++ b/scripts/build/test_suite/gcc.sh @@ -15,10 +15,10 @@ do_test_suite_gcc_build() { CT_DoStep INFO "Installing GCC test suite" CT_DoExecLog ALL mkdir -p "${CT_TEST_SUITE_DIR}/gcc" - CT_DoExecLog ALL cp -av "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \ - "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \ - "${CT_LIB_DIR}/contrib/gcc-test-suite/README" \ - "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/testsuite" \ + CT_DoExecLog ALL cp -av "${CT_LIB_DIR}/contrib/gcc-test-suite/default.cfg" \ + "${CT_LIB_DIR}/contrib/gcc-test-suite/Makefile" \ + "${CT_LIB_DIR}/contrib/gcc-test-suite/README" \ + "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/testsuite" \ "${CT_TEST_SUITE_DIR}/gcc" CT_DoExecLog ALL sed -i -r -e "s/@@DG_TARGET@@/${CT_TARGET}/g;" \ diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in index e1018566..ab654da7 100644 --- a/scripts/crosstool-NG.sh.in +++ b/scripts/crosstool-NG.sh.in @@ -143,7 +143,7 @@ CT_DoLog INFO "Building environment variables" . "${CT_LIB_DIR}/scripts/build/companion_libs.sh" . "${CT_LIB_DIR}/scripts/build/binutils/${CT_BINUTILS}.sh" . "${CT_LIB_DIR}/scripts/build/libc/${CT_LIBC}.sh" -. "${CT_LIB_DIR}/scripts/build/cc/${CT_CC}.sh" +. "${CT_LIB_DIR}/scripts/build/cc.sh" . "${CT_LIB_DIR}/scripts/build/debug.sh" . "${CT_LIB_DIR}/scripts/build/test_suite.sh" @@ -165,8 +165,8 @@ CT_PREFIX_DIR="$( "${sed}" -r -e 's:/+:/:g; s:/*$::;' <<<"${CT_PREFIX_DIR}" )" # Put user-supplied flags at the end, so that they take precedence. CT_TARGET_CFLAGS="${CT_ARCH_TARGET_CFLAGS} ${CT_TARGET_CFLAGS}" CT_TARGET_LDFLAGS="${CT_ARCH_TARGET_LDFLAGS} ${CT_TARGET_LDFLAGS}" -CT_CC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) -CT_CC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_EXTRA_CONFIG_ARRAY[@]}" ) +CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_CORE_EXTRA_CONFIG} "${CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY[@]}" ) +CT_CC_GCC_EXTRA_CONFIG_ARRAY=( ${CT_ARCH_CC_EXTRA_CONFIG} "${CT_CC_GCC_EXTRA_CONFIG_ARRAY[@]}" ) # Compute the package version string CT_PKGVERSION="crosstool-NG ${CT_VERSION}${CT_TOOLCHAIN_PKGVERSION:+ - ${CT_TOOLCHAIN_PKGVERSION}}" @@ -548,8 +548,8 @@ if [ -z "${CT_RESTART}" ]; then CT_EndStep fi - if [ "${CT_CC_STATIC_LIBSTDCXX}" = "y" ]; then - CT_DoStep DEBUG "Checking that gcc can statically link libstdc++ (CT_CC_STATIC_LIBSTDCXX)" + if [ "${CT_CC_GCC_STATIC_LIBSTDCXX}" = "y" ]; then + CT_DoStep DEBUG "Checking that gcc can statically link libstdc++ (CT_CC_GCC_STATIC_LIBSTDCXX)" CT_DoLog DEBUG "You may need to ensure that libstdc++.a is installed on your system" CT_DoExecLog DEBUG "${CT_HOST}-gcc" ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST} "${testc}" -static -lstdc++ -o "${gccout}" rm -f "${gccout}" diff --git a/scripts/gen_in_frags.sh b/scripts/gen_in_frags.sh index 24514955..9c656a8f 100755 --- a/scripts/gen_in_frags.sh +++ b/scripts/gen_in_frags.sh @@ -138,6 +138,9 @@ gen_menu() { _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;') printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}" printf ' bool\n' + if "${grep}" -E '^## default' ${file} >/dev/null 2>&1; then + "${sed}" -r -e '/^## default ?/!d; s/^## default ?/ default /;' ${file} 2>/dev/null + fi printf ' prompt "%s"\n' "${entry}" "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh index 011c75ac..684e1184 100755 --- a/scripts/showSamples.sh +++ b/scripts/showSamples.sh @@ -76,7 +76,15 @@ dump_single_sample() { [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s" "${CT_LIBELF_VERSION}" [ -z "${complibs}" ] || printf "\n" printf " %-*s : %s\n" ${width} "binutils" "binutils-${CT_BINUTILS_VERSION}" - printf " %-*s : %s" ${width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C" + printf " %-*s :" ${width} "C compilers" + for cc in $(env | ${sed} -n 's/^CT_CC_\(.*\)_VERSION.*/\1/p'); do + cc_variable=CT_CC_${cc}_VERSION + version=${!cc_variable} + compiler=$(echo $cc | ${awk} '{print tolower($0)}') + printf " $compiler-$version" + done + printf "\n" + printf " %-*s : %s" ${width} "Languages" "C" [ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++" [ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran" [ "${CT_CC_LANG_JAVA}" = "y" ] && printf ",Java" @@ -85,7 +93,7 @@ dump_single_sample() { [ "${CT_CC_LANG_OBJCXX}" = "y" ] && printf ",Objective-C++" [ "${CT_CC_LANG_GOLANG}" = "y" ] && printf ",Go" [ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}" - printf ")\n" + printf "\n" printf " %-*s : %s (threads: %s)\n" ${width} "C library" "${CT_LIBC}${CT_LIBC_VERSION:+-}${CT_LIBC_VERSION}" "${CT_THREADS}" printf " %-*s :" ${width} "Tools" [ "${CT_TOOL_sstrip}" ] && printf " sstrip" @@ -120,8 +128,14 @@ dump_single_sample() { fi fi printf "| ${CT_BINUTILS_VERSION} " - printf "| ''${CT_CC}'' " - printf "| ${CT_CC_VERSION} " + printf "| " + for cc in $(env | ${sed} -n 's/^CT_CC_\(.*\)_VERSION.*/\1/p'); do + cc_variable=CT_CC_${cc}_VERSION + version=${!cc_variable} + compiler=$(echo $cc | ${awk} '{print tolower($0)}') + printf " $compiler-$version" + done + printf " " printf "| ''${CT_LIBC}'' |" if [ "${CT_LIBC}" != "none" ]; then printf " ${CT_LIBC_VERSION} " |