# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../gcc/gcc.conf # Copyright (C) 2004 - 2007 The T2 SDE Project # # More information can be found in the files COPYING and README. # # This program 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; version 2 of the License. A copy of the # GNU General Public License can be found in the file COPYING. # --- T2-COPYRIGHT-NOTE-END --- # create and set up cmd_wrapper for xgcc function setup_xgcc_wrapper() { mkdir gcc ; pushd gcc cat <<-EOF > xgcc-wrapper #!/bin/bash # place the xgcc in the path export PATH="$PWD:\$PATH" [ "\$GCC_WRAPPER_DEBUG" = 1 ] && export CMD_WRAPPER_DEBUG=1 mycmd=\$1 if [ "\${mycmd%gcj}" != "\$mycmd" ]; then export CMD_WRAPPER_OTHERS="\$GCJ_WRAPPER_OTHERS" export CMD_WRAPPER_INSERT="\$GCJ_WRAPPER_INSERT" export CMD_WRAPPER_REMOVE="\$GCJ_WRAPPER_REMOVE" export CMD_WRAPPER_APPEND="\$GCJ_WRAPPER_APPEND" export CMD_WRAPPER_FILTER="\$GCJ_WRAPPER_FILTER" elif [ "\${mycmd%gfortran}" != "\$mycmd" ]; then export CMD_WRAPPER_OTHERS="\$F95_WRAPPER_OTHERS" export CMD_WRAPPER_INSERT="\$F95_WRAPPER_INSERT" export CMD_WRAPPER_REMOVE="\$F95_WRAPPER_REMOVE" export CMD_WRAPPER_APPEND="\$F95_WRAPPER_APPEND" export CMD_WRAPPER_FILTER="\$F95_WRAPPER_FILTER" else export CMD_WRAPPER_OTHERS="\$CC_WRAPPER_OTHERS:\$GCC_WRAPPER_OTHERS:\$GCC3_WRAPPER_OTHERS" export CMD_WRAPPER_INSERT="\$CC_WRAPPER_INSERT \$GCC_WRAPPER_INSERT \$GCC3_WRAPPER_INSERT" export CMD_WRAPPER_REMOVE="\$CC_WRAPPER_REMOVE \$GCC_WRAPPER_REMOVE \$GCC3_WRAPPER_REMOVE" export CMD_WRAPPER_APPEND="\$CC_WRAPPER_APPEND \$GCC_WRAPPER_APPEND \$GCC3_WRAPPER_APPEND" export CMD_WRAPPER_FILTER="\$CC_WRAPPER_FILTER|\$GCC_WRAPPER_FILTER|\$GCC3_WRAPPER_FILTER" fi exec cmd_wrapper "\$@" EOF chmod 0755 xgcc-wrapper export STAGE_CC_WRAPPER=$PWD/xgcc-wrapper popd } # We must use an 'objdir' directory for building gcc. hook_add preconf 9 "mkdir -p objdir; cd objdir" configscript="../configure" languages="c,c++,objc" # See http://gcc.gnu.org/gcc-3.2/c++-abi.html # and http://www.codesourcery.com/cxx-abi/. var_append confopt ' ' "--enable-__cxa_atexit" # we might build a SVN or prereleases, disable checking var_append confopt ' ' '--disable-checking' # we build a cross compiler in stage0 and later use known good GCCs, no bstrap var_append confopt ' ' '--disable-bootstrap' # not really useful and just blow up the binary package var_append confopt ' ' '--disable-libstdcxx-pch' # add the multi-lib config if [ "$SDECFG_MULTILIB" = 1 ]; then var_append confopt ' ' "--enable-multilib" if [ -n "$SDECFG_MULTILIBLIST" ]; then var_append confopt ' ' "--with-multilib-list=$SDECFG_MULTILIBLIST" fi else var_append confopt ' ' "--disable-multilib" fi if [ "${ver:0:3}" = "3.4" -o "${ver:0:1}" = "4" ]; then gcc_lib_dir="gcc/${arch_target}/${ver%%-*}" else gcc_lib_dir="gcc-lib/${arch_target}/${ver%%-*}" fi if atstage toolchain; then bindir="/$prefix/crosscc" var_append confopt " " "--with-sysroot=$sysroot" var_append confopt " " "--program-prefix=${arch_target}-" var_append confopt " " "--disable-cpp --disable-shared --disable-libssp --disable-libgomp" fi if ! atstage native; then var_append confopt " " "--enable-languages=c,c++ --disable-libmudflap" fi # later, if we support multiple GCC again, pass this to the non-default ones: # var_append confopt " " "--enable-version-specific-runtime-libs" if atstage native; then var_append confopt " " "--with-gnu-as --with-gnu-ld --enable-threads=posix" # language settings if [ "$SDECFG_PKG_GCC_JAVA" != 1 ] ; then var_append confopt " " "--disable-libgcj" else var_append confopt ' ' "--enable-libgcj" var_append languages ',' "java" fi # configure script chokes if no gmp/mpfr is found but fortran is selected if test -f $root/usr/include/gmp.h -a -f $root/usr/include/mpfr.h; then var_append languages ',' "fortran" fi var_append confopt ' ' '--enable-languages=$languages' # Set enable-shared if [ "$diet_dynamic_static" == "static" ] ; then var_append confopt " " "--disable-shared" else var_append confopt " " "--enable-shared" fi fi gcc_premake() { # create and set up the xgcc cmd_wrapper setup_xgcc_wrapper if [ $arch = powerpc ] ; then ln -s ppc-nocross-linux-gnu powerpc-nocross-linux-gnu fi if atstage toolchain; then mkdir -p $root/$prefix/$arch_target/{bin,lib} rm -fv $root/$prefix/$arch_target/include if [ -f $root/$prefix/include/stdio.h ]; then ln -s ../include $root/$prefix/$arch_target/include elif [ -f $root/$prefix/diet-include/stdio.h ]; then ln -s ../diet-include $root/$prefix/$arch_target/include fi fi } gcc_postmake() { # force a tools rebuild rm -fv $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/.lastupdate # only minimal adaptions for stage0 if atstage toolchain; then ${arch_target}-ranlib \ $root/$libdir/${gcc_lib_dir}/libgcc.a for x in gcc-${ver:0:1} kcc{,-${ver:0:1}} cc; do ln -svf ${arch_target}-gcc \ $root/$prefix/crosscc/${arch_target}-$x done ln -svf ${arch_target}-gcc $root/$prefix/crosscc/${arch_target}-cc rm -vf "$root/$prefix/crosscc/{gcc,gcj}" return fi # Create various symlinks for cc, c++, cpp and f77. # rm -f $root/$prefix/bin/cc ln -sfv gcc $root/$prefix/bin/cc ln -sfv ../$prefix/bin/cpp $root/lib/cpp ln -sfv gcc $root/$prefix/bin/kcc-${ver:0:1} ln -sfv gcc $root/$prefix/bin/kcc if [ -f $root/$prefix/bin/gfortran ] ; then rm -fv $root/$prefix/bin/f77 ln -sfv gfortran $root/$prefix/bin/f77 fi true } # Apply the respective Stack Smashing Protector patch. hook_add prepatch 3 ". $base/package/*/gcc/apply-protector.sh" hook_add premake 5 "gcc_premake" hook_add postmake 5 "gcc_postmake"