/[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.17 Revision 1.18
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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.17 2003/04/27 20:57:46 azarah Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.18 2003/06/17 14:38:32 vapier Exp $
4# 4#
5# Author Bart Verwilst <verwilst@gentoo.org> 5# Author Bart Verwilst <verwilst@gentoo.org>
6 6
7ECLASS=flag-o-matic 7ECLASS=flag-o-matic
8INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
9 9
10# 10#
11#### filter-flags <flag> #### 11#### filter-flags <flags> ####
12# Remove particular flags from C[XX]FLAGS 12# Remove particular flags from C[XX]FLAGS
13# Matches only complete flags
13# 14#
14#### append-flags <flag> #### 15#### append-flags <flags> ####
15# Add extra flags to your current C[XX]FLAGS 16# Add extra flags to your current C[XX]FLAGS
16# 17#
17#### replace-flags <orig.flag> <new.flag> ### 18#### replace-flags <orig.flag> <new.flag> ###
18# Replace a flag by another one 19# Replace a flag by another one
19# 20#
20#### is-flag <flag> #### 21#### is-flag <flag> ####
21# Returns "true" if flag is set in C[XX]FLAGS 22# Returns "true" if flag is set in C[XX]FLAGS
22# Matches only complete flag 23# Matches only complete a flag
23# 24#
24#### strip-flags #### 25#### strip-flags ####
25# Strip C[XX]FLAGS of everything except known 26# Strip C[XX]FLAGS of everything except known
26# good options. 27# good options.
27# 28#
39 40
40# C[XX]FLAGS that we are think is ok, but needs testing 41# C[XX]FLAGS that we are think is ok, but needs testing
41# NOTE: currently -Os have issues with gcc3 and K6* arch's 42# NOTE: currently -Os have issues with gcc3 and K6* arch's
42UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" 43UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays"
43 44
44filter-flags () { 45filter-flags() {
45 46 # we do this fancy spacing stuff so as to not filter
47 # out part of a flag ... we want flag atoms ! :D
48 export CFLAGS=" ${CFLAGS} "
49 export CXXFLAGS=" ${CXXFLAGS} "
46 for x in $1 50 for x in $@ ; do
47 do
48 export CFLAGS="${CFLAGS/${x}}" 51 export CFLAGS="${CFLAGS/ ${x} / }"
49 export CXXFLAGS="${CXXFLAGS/${x}}" 52 export CXXFLAGS="${CXXFLAGS/ ${x} / }"
50 done 53 done
51 54 export CFLAGS="${CFLAGS:1:${#CFLAGS}-2}"
55 export CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}"
52} 56}
53 57
54append-flags () { 58append-flags() {
55
56 CFLAGS="${CFLAGS} $1" 59 CFLAGS="${CFLAGS} $1"
57 CXXFLAGS="${CXXFLAGS} $1" 60 CXXFLAGS="${CXXFLAGS} $1"
58
59} 61}
60 62
61replace-flags () { 63replace-flags() {
62
63 CFLAGS="${CFLAGS/${1}/${2} }" 64 CFLAGS="${CFLAGS/${1}/${2} }"
64 CXXFLAGS="${CXXFLAGS/${1}/${2} }" 65 CXXFLAGS="${CXXFLAGS/${1}/${2} }"
65
66} 66}
67 67
68is-flag() { 68is-flag() {
69
70 for x in ${CFLAGS} ${CXXFLAGS} 69 for x in ${CFLAGS} ${CXXFLAGS} ; do
71 do
72 if [ "${x}" = "$1" ] 70 if [ "${x}" == "$1" ] ; then
73 then
74 echo true 71 echo true
75 break 72 return 0
76 fi 73 fi
77 done 74 done
78 75 return 1
79} 76}
80 77
81strip-flags() { 78strip-flags() {
82
83 local NEW_CFLAGS="" 79 local NEW_CFLAGS=""
84 local NEW_CXXFLAGS="" 80 local NEW_CXXFLAGS=""
85 81
86 # Allow unstable C[XX]FLAGS if we are using unstable profile ... 82 # Allow unstable C[XX]FLAGS if we are using unstable profile ...
87 if [ "${ACCEPT_KEYWORDS/~/}" != "${ACCEPT_KEYWORDS}" -a \ 83 if [ "${ACCEPT_KEYWORDS/~/}" != "${ACCEPT_KEYWORDS}" -a \
141 return 137 return
142 fi 138 fi
143 done 139 done
144} 140}
145 141
146replace-sparc64-flags () { 142replace-sparc64-flags() {
147
148 local SPARC64_CPUS="ultrasparc v9" 143 local SPARC64_CPUS="ultrasparc v9"
149 144
150 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ] 145 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]
151 then 146 then
152 for x in ${SPARC64_CPUS} 147 for x in ${SPARC64_CPUS}
170 for x in ${SPARC64_CPUS} 165 for x in ${SPARC64_CPUS}
171 do 166 do
172 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}" 167 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
173 done 168 done
174 fi 169 fi
175
176} 170}

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20