#! /bin/false # # Symlink target for "/etc/portage/env//". # Changes compiler options for heavy optimization, # unless the "debug" USE-flag is set for the package, in which case # the debugging options will be set instead. # # $HeadURL: /caches/xsvn/uxadm/trunk/etc/portage/env/heavily-optimized $ # $Author: root $ # $Date: 2006-12-02T15:46:05.935100Z $ # $Revision: 472 $ # Whether space-separated string $1 contains token $2. contains_ncm9q70alywv346gx4ug8hwrq() { test "${1#$2}" != "$1" && return test "${1%$2}" != "$1" && return test "${1% $2 *}" != "$1" && return return 1 } # Check for debugging override. if contains_ncm9q70alywv346gx4ug8hwrq "$USE" "debug" \ || contains_ncm9q70alywv346gx4ug8hwrq "$FEATURES" "noclean" then unset -f contains_ncm9q70alywv346gx4ug8hwrq . /etc/portage/env/debugging else unset -f contains_ncm9q70alywv346gx4ug8hwrq optimizer_filter_ncm9q70alywv346gx4ug8hwrq() { local S1 S2 OLD NEW TT REST M SET S1=1; S2=1 while true; do case $S1 in 1) # Start variable modification. case $S2 in 1) OLD="$CFLAGS";; 2) OLD="$CXXFLAGS";; 3) OLD="$FEATURES";; 4) OLD="$USE";; esac SET= case $S2 in 1 | 2) SET="-O3 -DNDEBUG -fno-omit-frame-pointer -fno-stack-check";; esac OLD="$(echo "$OLD" | tr -s '[[:space:]]' ' ' | sed -e 's/^ *//; s/ *$//')" NEW= S3=1 S1=2 ;; 2) # Modify next token if necessary. if [ -z "$OLD" ]; then S1=3 test -n "$SET" && NEW="$NEW${NEW:+ }$SET" continue fi REST="${OLD#* }" if [ "$OLD" = "$REST" ]; then TT="$OLD"; OLD= else TT="${OLD%$REST}"; TT="${TT% }"; OLD="$REST" fi M= case $S2 in 1 | 2) case "$TT" in -O[0-9]) M=1;; -g*) M=1;; -DNDEBUG | -DDEBUG | -D_DEBUG) M=1;; -fomit-frame-pointer | -fno-omit-frame-pointer) M=1;; -fstack-check | -fno-stack-check) M=1;; -fno-eliminate-unused-debug-symbols | -feliminate-unused-debug-symbols) M=1;; esac ;; 3) case "$TT" in nostrip | keeptemp | keepwork | noclean) M=1;; esac ;; 4) case "$TT" in debug) M=1;; esac ;; esac if [ -n "$M" ]; then # $TT matches a debugging-relevant token. test -z "$SET" && continue TT="$SET"; SET= fi NEW="$NEW${NEW:+ }$TT" ;; 3) # Complete variable modification. case $S2 in 1) CFLAGS="$NEW"; S2=2;; 2) CXXFLAGS="$NEW"; S2=3;; 3) FEATURES="$NEW"; S2=4;; 4) USE="$NEW"; return;; esac S1=1 ;; esac done } optimizer_filter_ncm9q70alywv346gx4ug8hwrq unset -f optimizer_filter_ncm9q70alywv346gx4ug8hwrq echo "OVERRIDING FLAGS: heavily-optimized" #echo "CFLAGS=$CFLAGS"; echo "CXXFLAGS=$CXXFLAGS"; echo "FEATURES=$FEATURES"; echo "USE=$USE" fi