mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

169 lines
4.9 KiB

# --- 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 - 2005 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 -gt 0 ]
then
# ---- NOT IN STAGE 0 ---
# Use the GCC-[23] stack protector patch
#
if [ $pkg != glibc23 -a $pkg != glibc22 -a \
$pkg != grub -a $pkg != dietlibc ]
then
if [ "$ROCKCFG_PKG_GCC_STACKPRO" = 1 ] ; then
var_append GCC2_WRAPPER_INSERT " " "-fstack-protector"
var_append GCC3_WRAPPER_INSERT " " "-fstack-protector"
var_append GCC4_WRAPPER_INSERT " " "-fstack-protector"
fi
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
export KCC="${archprefix}kcc-${ROCKCFG_DEFAULT_KCC#gcc}"
if [ "$ROCKCFG_OPT" = "size" ] ; then
var_insert KCC_WRAPPER_REMOVE " " "-O -O[0-9]"
var_insert KCC_WRAPPER_INSERT " " "-Os"
fi
fi
# 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-$stagelevel" in
CC-*)
z="${archprefix}gcc ${archprefix}gcc-${y#gcc}" ;;
CXX-[2-9])
z="${archprefix}g++ ${archprefix}g++-${y#gcc}" ;;
F77-[2-9])
z="${archprefix}g77 ${archprefix}g77-${y#gcc}" ;;
*)
export $x=${x}_not_available_in_stage_${stagelevel}
continue ;;
esac
for y in $z ; do
[ "`type -p $y`" ] && export $x=$y
done
fi
done
# Add the usual gcc optimazation 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"
var_insert GCC_WRAPPER_REMOVE " " "-s -g*"
fi
fi
# remove other -O options from the argument list
var_insert GCC_WRAPPER_REMOVE " " "-O -O[0-9s]"
case "$ROCKCFG_OPT" in
smart)
var_insert GCC_WRAPPER_INSERT " " "-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_INSERT " " "-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_INSERT " " "-O2 -pipe"
;;
size)
var_insert GCC_WRAPPER_INSERT " " "-Os -pipe"
;;
lazy)
var_insert GCC_WRAPPER_INSERT " " "-O1 -pipe"
;;
test)
case "$pkg" in
gcc*|glibc*|binutils*|make|bzip2|gzip|coreutils|bash*|gawk|sed)
var_insert GCC_WRAPPER_INSERT " " "-Os -pipe"
;;
*)
var_insert GCC_WRAPPER_INSERT " " "-O1 -pipe"
;;
esac
;;
esac
var_append GCC_WRAPPER_APPEND " " "$ROCKCFG_C_FLAGS"
# Compile (i.e. link) all bins statically
#
if [ "$ROCKCFG_STATIC" = 1 ]; then
var_insert GCC_WRAPPER_INSERT " " "-static"
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
# 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"
#
var_insert GCC4_WRAPPER_REMOVE " " "-I/usr/include"
var_insert GCC4_WRAPPER_REMOVE " " "-I/usr/local/include"
# Add the architecture gcc optimisation options
#
if [ -f architecture/$arch/gcc-options ] ; then
. architecture/$arch/gcc-options
fi
# Use our cross specs file for stage 1
#
if [ $stagelevel -eq 1 ]; then
var_insert GCC_WRAPPER_INSERT " " "--specs=specs.cross"
fi
# Use our chroot specs file for pseudonative
#
if [ $stagelevel -gt 1 -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_INSERT " " "-fPIC"
fi
}
hook_add prepare 7 'gcc_force_fpic_handler'
# ---- NOT IN STAGE 0 ---
fi