/[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.60 Revision 1.61
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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.60 2004/06/25 00:39:48 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.61 2004/07/12 02:31:55 agriffis 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"
85 export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays" 85 export UNSTABLE_FLAGS="-Os -O3 -freorder-blocks -fprefetch-loop-arrays"
86 return 0 86 return 0
87} 87}
88 88
89filter-flags() { 89filter-flags() {
90 local x 90 local x f fset
91 declare -a new_CFLAGS new_CXXFLAGS
91 92
92 for x in "$@" ; do 93 for x in "$@" ; do
93 case "${x}" in 94 case "${x}" in
94 -fPIC|-fpic|-fPIE|-fpie|-pie) etexec-flags;; 95 -fPIC|-fpic|-fPIE|-fpie|-pie) etexec-flags;;
95 -fstack-protector|-fstack-protector-all) fstack-flags;; 96 -fstack-protector|-fstack-protector-all) fstack-flags;;
96 *) ;;
97 esac 97 esac
98 done 98 done
99 99
100 # we do this fancy spacing stuff so as to not filter 100 for fset in CFLAGS CXXFLAGS; do
101 # out part of a flag ... we want flag atoms ! :D 101 for f in ${!fset}; do
102 CFLAGS=" ${CFLAGS} "
103 CXXFLAGS=" ${CXXFLAGS} "
104 for x in "$@" ; do 102 for x in "$@"; do
105 CFLAGS="${CFLAGS// ${x} / }" 103 # Note this should work with globs like -O*
106 CXXFLAGS="${CXXFLAGS// ${x} / }" 104 [[ ${f} == ${x} ]] && continue 2
105 done
106 eval new_${fset}\[\${\#new_${fset}\[@]}]=\${f}
107 done 107 done
108 CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" 108 eval export ${fset}=\${new_${fset}\[*]}
109 CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" 109 done
110 export CFLAGS CXXFLAGS 110
111 return 0 111 return 0
112} 112}
113 113
114filter-lfs-flags() { 114filter-lfs-flags() {
115 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE 115 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE

Legend:
Removed from v.1.60  
changed lines
  Added in v.1.61

  ViewVC Help
Powered by ViewVC 1.1.20