1 | # Copyright 1999-2005 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.86 2005/04/28 20:06:00 solar Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.87 2005/06/24 22:06:19 vapier Exp $ |
4 | |
4 | |
5 | ECLASS=flag-o-matic |
5 | ECLASS=flag-o-matic |
6 | INHERITED="$INHERITED $ECLASS" |
6 | INHERITED="$INHERITED $ECLASS" |
7 | |
|
|
8 | IUSE="debug" |
|
|
9 | |
7 | |
10 | # need access to emktemp() |
8 | # need access to emktemp() |
11 | inherit eutils toolchain-funcs multilib |
9 | inherit eutils toolchain-funcs multilib |
12 | |
10 | |
13 | # |
11 | # |
… | |
… | |
79 | # C[XX]FLAGS that we allow in strip-flags |
77 | # C[XX]FLAGS that we allow in strip-flags |
80 | setup-allowed-flags() { |
78 | setup-allowed-flags() { |
81 | if [[ -z ${ALLOWED_FLAGS} ]] ; then |
79 | if [[ -z ${ALLOWED_FLAGS} ]] ; then |
82 | export ALLOWED_FLAGS="-pipe" |
80 | export ALLOWED_FLAGS="-pipe" |
83 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" |
81 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" |
84 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fno-stack-protector" |
82 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all" |
|
|
83 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-bounds-checking" |
85 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-pie -fno-unit-at-a-time" |
84 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-pie -fno-unit-at-a-time" |
86 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3" |
85 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3" |
87 | case $(tc-arch) in |
|
|
88 | mips) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -EL -EB -mabi" ;; |
|
|
89 | amd64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC -m64" ;; |
|
|
90 | x86) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32" ;; |
|
|
91 | alpha) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; |
|
|
92 | ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -fPIC" ;; |
|
|
93 | sparc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -m32 -m64" ;; |
|
|
94 | ppc) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mabi" ;; |
|
|
95 | esac |
|
|
96 | fi |
86 | fi |
97 | # allow a bunch of flags that negate features / control ABI |
87 | # allow a bunch of flags that negate features / control ABI |
98 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" |
88 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" |
99 | case $(tc-arch) in |
89 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \ |
100 | x86|amd64|ia64) ALLOWED_FLAGS="${ALLOWED_FLAGS} -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow" ;; |
90 | -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow \ |
101 | esac |
91 | -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 \ |
102 | 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" |
92 | -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \ |
|
|
93 | -mflat -mno-flat -mno-faster-structs -mfaster-structs \ |
|
|
94 | -m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \ |
|
|
95 | -mlive-g0 -mcmodel -mstack-bias -mno-stack-bias" |
103 | |
96 | |
104 | # C[XX]FLAGS that we are think is ok, but needs testing |
97 | # C[XX]FLAGS that we are think is ok, but needs testing |
105 | # NOTE: currently -Os have issues with gcc3 and K6* arch's |
98 | # NOTE: currently -Os have issues with gcc3 and K6* arch's |
106 | export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" |
99 | export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" |
107 | return 0 |
100 | return 0 |
… | |
… | |
235 | local NEW_CFLAGS="" |
228 | local NEW_CFLAGS="" |
236 | local NEW_CXXFLAGS="" |
229 | local NEW_CXXFLAGS="" |
237 | |
230 | |
238 | # Allow unstable C[XX]FLAGS if we are using unstable profile ... |
231 | # Allow unstable C[XX]FLAGS if we are using unstable profile ... |
239 | if has ~$(tc-arch) ${ACCEPT_KEYWORDS} ; then |
232 | if has ~$(tc-arch) ${ACCEPT_KEYWORDS} ; then |
240 | use debug && einfo "Enabling the use of some unstable flags" |
|
|
241 | ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}" |
233 | ALLOWED_FLAGS="${ALLOWED_FLAGS} ${UNSTABLE_FLAGS}" |
242 | fi |
234 | fi |
243 | |
235 | |
244 | set -f # disable pathname expansion |
236 | set -f # disable pathname expansion |
245 | |
237 | |