/[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.37 Revision 1.41
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.37 2004/02/21 07:19:29 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.41 2004/03/16 21:37:09 solar 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"
46# If the user has -mfpmath=sse,386, running `filter-mfpmath sse` 46# If the user has -mfpmath=sse,386, running `filter-mfpmath sse`
47# will leave the user with -mfpmath=386 47# will leave the user with -mfpmath=386
48# 48#
49#### append-ldflags #### 49#### append-ldflags ####
50# Add extra flags to your current LDFLAGS 50# Add extra flags to your current LDFLAGS
51#
52#### filter-ldflags <flags> ####
53# Remove particular flags from LDFLAGS
54# Matches only complete flags
51# 55#
52#### etexec-flags #### 56#### etexec-flags ####
53# hooked function for hardened-gcc that appends 57# hooked function for hardened-gcc that appends
54# -yet_exec {C,CXX,LD}FLAGS when hardened-gcc is installed 58# -yet_exec {C,CXX,LD}FLAGS when hardened-gcc is installed
55# and a package is filtering -fPIC,-fpic, -fPIE, -fpie 59# and a package is filtering -fPIC,-fpic, -fPIE, -fpie
77} 81}
78 82
79filter-flags() { 83filter-flags() {
80 for x in "$@" ; do 84 for x in "$@" ; do
81 case "${x}" in 85 case "${x}" in
82 -fPIC|-fpic|-fPIE|-fpie) etexec-flags;; 86 -fPIC|-fpic|-fPIE|-fpie|-pie) etexec-flags;;
83 -fstack-protector|-fstack-protector-all) fstack-flags;; 87 -fstack-protector|-fstack-protector-all) fstack-flags;;
84 *) ;; 88 *) ;;
85 esac 89 esac
86 done 90 done
87 91
94 CXXFLAGS="${CXXFLAGS// ${x} / }" 98 CXXFLAGS="${CXXFLAGS// ${x} / }"
95 done 99 done
96 CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" 100 CFLAGS="${CFLAGS:1:${#CFLAGS}-2}"
97 CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" 101 CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}"
98 return 0 102 return 0
103}
104
105filter-lfs-flags() {
106 filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
99} 107}
100 108
101append-flags() { 109append-flags() {
102 export CFLAGS="${CFLAGS} $@" 110 export CFLAGS="${CFLAGS} $@"
103 export CXXFLAGS="${CXXFLAGS} $@" 111 export CXXFLAGS="${CXXFLAGS} $@"
121 local newcpu="$1" ; shift 129 local newcpu="$1" ; shift
122 local oldcpu="" 130 local oldcpu=""
123 for oldcpu in "$@" ; do 131 for oldcpu in "$@" ; do
124 replace-flags -march=${oldcpu} -march=${newcpu} 132 replace-flags -march=${oldcpu} -march=${newcpu}
125 replace-flags -mcpu=${oldcpu} -mcpu=${newcpu} 133 replace-flags -mcpu=${oldcpu} -mcpu=${newcpu}
134 replace-flags -mtune=${oldcpu} -mtune=${newcpu}
126 done 135 done
127 return 0 136 return 0
128} 137}
129 138
130is-flag() { 139is-flag() {
289append-ldflags() { 298append-ldflags() {
290 LDFLAGS="${LDFLAGS} $@" 299 LDFLAGS="${LDFLAGS} $@"
291 return 0 300 return 0
292} 301}
293 302
303filter-ldflags() {
304 # we do this fancy spacing stuff so as to not filter
305 # out part of a flag ... we want flag atoms ! :D
306 LDFLAGS=" ${LDFLAGS} "
307 for x in "$@" ; do
308 LDFLAGS="${LDFLAGS// ${x} / }"
309 done
310 LDFLAGS="${LDFLAGS:1:${#LDFLAGS}-2}"
311 return 0
312}
313
294etexec-flags() { 314etexec-flags() {
295 has_version sys-devel/hardened-gcc 315 has_version sys-devel/hardened-gcc
296 if [ $? == 0 ] ; then 316 if [ $? == 0 ] ; then
297 if [ "`is-flag -yet_exec`" != "true" ]; then 317 if [ "`is-flag -yet_exec`" != "true" ]; then
298 debug-print ">>> appending flags -yet_exec" 318 debug-print ">>> appending flags -yet_exec"

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.20