/[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.11 Revision 1.16
1# Copyright 1999-2002 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.16 2003/04/19 18:20:56 joker Exp $
4#
3# Author Bart Verwilst <verwilst@gentoo.org> 5# Author Bart Verwilst <verwilst@gentoo.org>
4# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.11 2002/12/22 12:11:56 cretin Exp $
5 6
6ECLASS=flag-o-matic 7ECLASS=flag-o-matic
7INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
8 9
9# 10#
25# good options. 26# good options.
26# 27#
27#### get-flag <flag> #### 28#### get-flag <flag> ####
28# Find and echo the value for a particular flag 29# Find and echo the value for a particular flag
29# 30#
31#### replace-sparc64-flags ####
32# Sets mcpu to v8 and uses the original value
33# as mtune if none specified.
34#
35
36
37ALLOWED_FLAGS="-O -mcpu -march -mtune -fstack-protector -pipe -g"
38
30 39
31filter-flags () { 40filter-flags () {
32 41
33 for x in $1 42 for x in $1
34 do 43 do
68strip-flags() { 77strip-flags() {
69 78
70 local NEW_CFLAGS="" 79 local NEW_CFLAGS=""
71 local NEW_CXXFLAGS="" 80 local NEW_CXXFLAGS=""
72 81
73 local ALLOWED_FLAGS="-O -mcpu -march -pipe -g"
74
75 set -f 82 set -f
76 83
77 for x in ${CFLAGS} 84 for x in ${CFLAGS}
78 do 85 do
79 for y in ${ALLOWED_FLAGS} 86 for y in ${ALLOWED_FLAGS}
80 do 87 do
88 flag=${x%%=*}
81 if [ "${x/${y}}" != "${x}" ] 89 if [ "${flag%%${y}}" = "" ]
82 then 90 then
83 if [ -z "${NEW_CFLAGS}" ]
84 then
85 NEW_CFLAGS="${x}"
86 else
87 NEW_CFLAGS="${NEW_CFLAGS} ${x}" 91 NEW_CFLAGS="${NEW_CFLAGS} ${x}"
88 fi 92 break
89 fi 93 fi
90 done 94 done
91 done 95 done
92 96
93 for x in ${CXXFLAGS} 97 for x in ${CXXFLAGS}
94 do 98 do
95 for y in ${ALLOWED_FLAGS} 99 for y in ${ALLOWED_FLAGS}
96 do 100 do
101 flag=${x%%=*}
97 if [ "${x/${y}}" != "${x}" ] 102 if [ "${flag%%${y}}" = "" ]
98 then 103 then
99 if [ -z "${NEW_CXXFLAGS}" ]
100 then
101 NEW_CXXFLAGS="${x}"
102 else
103 NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}" 104 NEW_CXXFLAGS="${NEW_CXXFLAGS} ${x}"
104 fi 105 break
105 fi 106 fi
106 done 107 done
107 done 108 done
108 109
109 set +f 110 set +f
120 echo "${f/-${findflag}=}" 121 echo "${f/-${findflag}=}"
121 return 122 return
122 fi 123 fi
123 done 124 done
124} 125}
126
127replace-sparc64-flags () {
128
129 local SPARC64_CPUS="ultrasparc v9"
130
131 if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]
132 then
133 for x in ${SPARC64_CPUS}
134 do
135 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}"
136 done
137 else
138 for x in ${SPARC64_CPUS}
139 do
140 CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
141 done
142 fi
143
144 if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]
145 then
146 for x in ${SPARC64_CPUS}
147 do
148 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}"
149 done
150 else
151 for x in ${SPARC64_CPUS}
152 do
153 CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
154 done
155 fi
156
157}

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20