/[gentoo-x86]/eclass/flag-o-matic.eclass
Gentoo

Diff of /eclass/flag-o-matic.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.83 Revision 1.84
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2005 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.83 2005/02/19 07:11:31 mr_bones_ Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.84 2005/03/18 03:48:14 vapier Exp $
4#
5# Author Bart Verwilst <verwilst@gentoo.org>
6 4
7ECLASS=flag-o-matic 5ECLASS=flag-o-matic
8INHERITED="$INHERITED $ECLASS" 6INHERITED="$INHERITED $ECLASS"
9 7
10IUSE="debug" 8IUSE="debug"
66# when only -fno-stack-protector is given 64# when only -fno-stack-protector is given
67# 65#
68 66
69# C[XX]FLAGS that we allow in strip-flags 67# C[XX]FLAGS that we allow in strip-flags
70setup-allowed-flags() { 68setup-allowed-flags() {
71 if [ -z "${ALLOWED_FLAGS}" ] ; then 69 if [[ -z ${ALLOWED_FLAGS} ]] ; then
72 export ALLOWED_FLAGS="-pipe" 70 export ALLOWED_FLAGS="-pipe"
73 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" 71 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune"
74 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fno-stack-protector" 72 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fno-stack-protector"
75 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-pie -fno-unit-at-a-time" 73 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-pie -fno-unit-at-a-time"
76 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3" 74 export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3"
77 case "${ARCH}" in 75 case $(tc-arch) in
78 mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -EL -EB -mabi" ;; 76 mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -EL -EB -mabi" ;;
79 amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC -m64" ;; 77 amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC -m64" ;;
80 x86) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32" ;; 78 x86) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32" ;;
81 alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 79 alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;;
82 ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; 80 ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;;
83 sparc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32 -m64" ;; 81 sparc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32 -m64" ;;
84 ppc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mabi" ;; 82 ppc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mabi" ;;
85 esac 83 esac
86 fi 84 fi
87 # allow a bunch of flags that negate features / control ABI 85 # allow a bunch of flags that negate features / control ABI
88 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" 86 ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all"
89 case "${ARCH}" in 87 case $(tc-arch) in
90 x86|amd64|ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" ;; 88 x86|amd64|ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" ;;
91 esac 89 esac
92 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs -msoft-float -mflat -mno-faster-structs -mfaster-structs -mlittle-endian -mbig-endian -mlive-g0 -mcmodel -mno-stack-bias -mstack-bias" 90 ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs -msoft-float -mflat -mno-faster-structs -mfaster-structs -mlittle-endian -mbig-endian -mlive-g0 -mcmodel -mno-stack-bias -mstack-bias"
93 91
94 # C[XX]FLAGS that we are think is ok, but needs testing 92 # C[XX]FLAGS that we are think is ok, but needs testing
224 222
225 local NEW_CFLAGS="" 223 local NEW_CFLAGS=""
226 local NEW_CXXFLAGS="" 224 local NEW_CXXFLAGS=""
227 225
228 # Allow unstable C[XX]FLAGS if we are using unstable profile ... 226 # Allow unstable C[XX]FLAGS if we are using unstable profile ...
229 if has ~${ARCH} ${ACCEPT_KEYWORDS} ; then 227 if has ~$(tc-arch) ${ACCEPT_KEYWORDS} ; then
230 use debug && einfo "Enabling the use of some unstable flags" 228 use debug && einfo "Enabling the use of some unstable flags"
231 ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}" 229 ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}"
232 fi 230 fi
233 231
234 set -f # disable pathname expansion 232 set -f # disable pathname expansion
419 417
420 # we do this fancy spacing stuff so as to not filter 418 # we do this fancy spacing stuff so as to not filter
421 # out part of a flag ... we want flag atoms ! :D 419 # out part of a flag ... we want flag atoms ! :D
422 LDFLAGS=" ${LDFLAGS} " 420 LDFLAGS=" ${LDFLAGS} "
423 for x in "$@" ; do 421 for x in "$@" ; do
424 LDFLAGS="${LDFLAGS// ${x} / }" 422 LDFLAGS=${LDFLAGS// ${x} / }
425 done 423 done
424 [[ -z ${LDFLAGS// } ]] \
425 && LDFLAGS="" \
426 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}" 426 || LDFLAGS=${LDFLAGS:1:${#LDFLAGS}-2}
427 export LDFLAGS 427 export LDFLAGS
428 return 0 428 return 0
429} 429}
430 430
431fstack-flags() { 431fstack-flags() {
456 CXXFLAGS=${CXXFLAGS//athlon-tbird/i686} 456 CXXFLAGS=${CXXFLAGS//athlon-tbird/i686}
457 CXXFLAGS=${CXXFLAGS//athlon-4/i686} 457 CXXFLAGS=${CXXFLAGS//athlon-4/i686}
458 CXXFLAGS=${CXXFLAGS//athlon-[xm]p/i686} 458 CXXFLAGS=${CXXFLAGS//athlon-[xm]p/i686}
459 CXXFLAGS=${CXXFLAGS//athlon/i686} 459 CXXFLAGS=${CXXFLAGS//athlon/i686}
460 460
461 if [ "$ARCH" = alpha ]; then 461 if [[ $(tc-arch) == "alpha" ]] ; then
462 CHOST=${CHOST/#alphaev6[78]/alphaev6} 462 CHOST=${CHOST/#alphaev6[78]/alphaev6}
463 CFLAGS=${CFLAGS//ev6[78]/ev6} 463 CFLAGS=${CFLAGS//ev6[78]/ev6}
464 CXXFLAGS=${CXXFLAGS//ev6[78]/ev6} 464 CXXFLAGS=${CXXFLAGS//ev6[78]/ev6}
465 fi 465 fi
466 466

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.84

  ViewVC Help
Powered by ViewVC 1.1.20