#!/bin/bash # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/package/base/gcc/parse-config # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # 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; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at http://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- if [ $stagelevel -ge 2 -o $stagelevel -eq 1 -a $pkg != gcc ] then # set CC, CXX and F77 environment variables # for x in CC CXX F77 ; do eval "y=\$ROCKCFG_DEFAULT_$x" if [[ $y = gcc* ]] ; then case "$x" in KCC) z="${archprefix}kcc ${archprefix}kcc-${y#gcc}" ;; CC) z="${archprefix}gcc ${archprefix}gcc-${y#gcc}" ;; CXX) z="${archprefix}g++ ${archprefix}g++-${y#gcc}" ;; F77) z="${archprefix}gfortran ${archprefix}g77 ${archprefix}gfortran-${y#gcc} ${archprefix}g77-${y#gcc}" ;; esac export $x=${x}_not_available_in_stage_${stagelevel} for y in $z ; do [ "`type -p $y`" ] && export $x=$y done fi done unset x y z if [ $stagelevel -ge 1 ] ; then if [[ "$xpkg" = *-32bit ]] ; then export CC="${CC} ${BUILD32}" CXX="${CXX} ${BUILD32}" elif [ "$ROCKCFG_MULTILIB" = 1 ] ; then export CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" fi fi # Append all custom options so the gcc -V option always comes first. # The order of most other options doesn't matter; notable exceptions # are -L and -l (library). var_append GCC_WRAPPER_APPEND " " "$ROCKCFG_C_FLAGS" # Passing -I/usr{/local/}include creates a warning in gcc3 which is confusing # some of the configure scripts and Makefiles. # var_insert GCC3_WRAPPER_REMOVE " " "-I/usr/include" var_insert GCC3_WRAPPER_REMOVE " " "-I/usr/local/include" # Compile (i.e. link) all bins statically # if [ "$ROCKCFG_STATIC" = 1 ]; then var_insert GCC_WRAPPER_APPEND " " "-static" fi # Use the GCC 4.x stack protector # if [ $pkg != glibc23 -a $pkg != glibc22 -a \ $pkg != grub -a $pkg != dietlibc -a $pkg != glibc ] then if [ "$ROCKCFG_PKG_GCC_STACKPRO" = 1 ] ; then var_append GCC4_WRAPPER_APPEND " " "-fstack-protector" fi fi # Compile with no exceptions or rtti, gcc itself must support both # if [ "$ROCKCFG_LIMITCXX" = 1 ] && [[ $pkg != gcc* ]] ; then var_append CXX_WRAPPER_APPEND " " "-fno-exceptions -fno-rtti" fi # Use automatically precompiled C++ headers # if [ "$ROCKCFG_AUTOPCH" = 1 ] ; then [ -n "$CXX" -a -n "`type -p g++-autopch`" ] && \ CXX="eval AUTOPCHCXX=\"$CXX\" g++-autopch" fi # maybe we add something more later. But imo it's better to # let the options of KCC unmodified for gcc[23]. (Clifford) # if [[ $ROCKCFG_DEFAULT_KCC = gcc* ]] ; then if [ "$ROCKCFG_OPT" = "size" ] ; then var_insert KCC_WRAPPER_REMOVE " " "-O -O[0-9]" var_insert KCC_WRAPPER_APPEND " " "-Os" fi fi # Add the usual gcc optimization options # Strip or add debug information # if [ "$ROCKCFG_DEBUG" = 0 ] ; then var_append GCC_WRAPPER_APPEND " " "-s" var_insert GCC_WRAPPER_REMOVE " " "-g*" else if [[ $pkg != glibc* ]] ; then var_append GCC_WRAPPER_APPEND " " "-ggdb" fi var_insert GCC_WRAPPER_REMOVE " " "-s -g*" fi # remove other -O options from the argument list # if [ "$ROCKCFG_OPT" != default ] ; then var_insert GCC_WRAPPER_REMOVE " " "-O -O[0-9s]" fi case "$pkg" in glibc*) # do not mess with glibc -O options other than this var_insert GCC_WRAPPER_APPEND " " "-O2 -pipe" ;; *) case "$ROCKCFG_OPT" in smart) var_insert GCC_WRAPPER_APPEND " " "-SPEED-O2 -SIZE-Os -pipe" var_insert GCC_WRAPPER_FILTER "|" "gawk -f $base/misc/tools-source/smartwr.awk $base/scripts/smart_db.txt -" ;; bizarre) var_insert GCC_WRAPPER_APPEND " " "-SPEED-Os -SIZE-O2 -pipe" var_insert GCC_WRAPPER_FILTER "|" "gawk -f $base/misc/tools-source/smartwr.awk $base/scripts/smart_db.txt -" ;; speed) var_insert GCC_WRAPPER_APPEND " " "-O2 -pipe" ;; size) var_insert GCC_WRAPPER_APPEND " " "-Os -pipe" ;; lazy) var_insert GCC_WRAPPER_APPEND " " "-O1 -pipe" ;; test) case "$pkg" in gcc*|binutils*|make|bzip2|gzip|coreutils|bash*|gawk|sed) var_insert GCC_WRAPPER_APPEND " " "-Os -pipe" ;; *) var_insert GCC_WRAPPER_APPEND " " "-O1 -pipe" ;; esac ;; default) ;; esac ;; esac # Add the architecture gcc optimisation options # if [ -f architecture/$arch/gcc-options ] ; then . architecture/$arch/gcc-options fi # Use our chroot specs file for pseudonative # # if [ $stagelevel -gt 2 -a "$ROCKCFG_PSEUDONATIVE" = 1 ]; then # var_insert GCC_WRAPPER_INSERT " " "--specs=specs.chroot" # fi # register the forcefpic handler gcc_force_fpic_handler() { if [ "$forcefpic" = 1 ]; then # echo_status "Enabling force -fPIC mechanism for gcc." var_insert GCC_WRAPPER_APPEND " " "-fPIC" fi } hook_add prepare 7 'gcc_force_fpic_handler' fi # [ $stagelevel -ge 2 ]