# --- T2-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # T2 SDE: package/.../gcc/gcc.conf # Copyright (C) 2004 - 2006 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 [ "\$GCC_WRAPPER_DEBUG" = 1 ] && export CMD_WRAPPER_DEBUG=1 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" exec cmd_wrapper "\$@" EOF chmod 0755 xgcc-wrapper export STAGE_CC_WRAPPER=$PWD/xgcc-wrapper export PATH="$PWD:$PATH" popd } # We must use an 'objdir' directory for building gcc. hook_add preconf 3 "mkdir -p objdir; cd objdir" configscript="../configure" # libgcc should not contain the SSP symbols this is after configure, because # configure transmits this to gcj which breaks due to "-D..." if [ "$SDECFG_PKG_GCC_STACKPRO" = 0 ]; then var_append GCC_WRAPPER_APPEND ' ' "-D_LIBC_PROVIDES_SSP_" export GCC_WRAPPER_APPEND fi # See http://gcc.gnu.org/gcc-3.2/c++-abi.html # and http://www.codesourcery.com/cxx-abi/. var_append confopt ' ' "--enable-__cxa_atexit" # add the multi-lib config if [ "$SDECFG_MULTILIB" = 1 ]; then var_append confopt ' ' "--enable-multilib" 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 [ $stagelevel = 0 ]; then bindir="/$prefix/crosscc" # hack due to sane variable not available -ReneR var_append confopt " " "--with-sysroot=$base/build/$SDECFG_ID" var_append confopt " " "--program-prefix=${arch_target}-" var_append confopt " " "--disable-cpp --disable-shared" fi if [ $stagelevel -le 1 ]; then var_append confopt " " "--enable-languages=c" fi if [ $stagelevel -gt 1 ]; then var_append confopt " " "--with-gnu-as --with-gnu-ld --enable-threads=posix" var_append confopt " " "--enable-version-specific-runtime-libs" if [ "$SDECFG_PKG_GCC_JAVA" != 1 ] ; then var_append confopt " " "--disable-libgcj" fi # 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 [ $stagelevel = 0 ] ; then mkdir -p $root/$prefix/$arch_target/{bin,lib} rm -f $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 elif [ $stagelevel -le 1 ] ; then mkdir -p gcc/include echo '#include_next ' > gcc/include/syslimits.h fi } gcc_postmake() { # force a tools rebuild rm -fv $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/.lastupdate # only minimal adaptions for stage0 if [ $stagelevel = 0 ]; 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 if [ $stagelevel = 1 ]; then # This stuff needs manual installation # echo "Creating /$prefix/${arch_target} ..." mkdir -p $root/$prefix/${arch_target}/lib # FIXME! temporal hack to install libgcc_s (Ticket #100) if [ "$SDECFG_MULTILIB" = 1 ]; then rm -rf $root$libdir/libgcc_s* pushd $builddir/gcc-*/objdir/gcc/ for x in libgcc_s*.so ; do cp -v $x $root$libdir/$x.1 ln -sfv $x.1 $root$libdir/$x done popd fi else # Fix the location of any improperly installed (F77) libraries mv -vf $root/$libdir/$gcc_lib_dir/../lib* \ $root/$libdir/$gcc_lib_dir || true 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/g77 ] ; then rm -fv $root/$prefix/bin/f77 ln -sfv g77 $root/$prefix/bin/f77 fi # Create symlinks for runtime libraries so they can be found by # the dynamic loader and force rebuilding of the wrapper links # if [ $stagelevel -gt 1 ] ; then ( cd $root/$libdir ; ln -vfs ${gcc_lib_dir}/*.so.* . ; ) fi true } # Apply the respective gcc-2 or gcc-3 stack protector patch. hook_add prepatch 3 ". $base/package/*/gcc/apply-protector.sh" hook_add premake 5 "gcc_premake" hook_add postmake 5 "gcc_postmake"