/[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.3 Revision 1.7
1# Copyright 1999-2002 Gentoo Technologies, Inc. 1# Copyright 1999-2002 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# Author Bart Verwilst <verwilst@gentoo.org> 3# Author Bart Verwilst <verwilst@gentoo.org>
4# /space/gentoo/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass 4# /space/gentoo/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass
5ECLASS=flag-o-matic 5ECLASS=flag-o-matic
6 6INHERITED="$INHERITED $ECLASS"
7# 7#
8#### filter-flags <flag> #### 8#### filter-flags <flag> ####
9# Remove particular flags from C[XX]FLAGS 9# Remove particular flags from C[XX]FLAGS
10# 10#
11#### append-flags <flag> #### 11#### append-flags <flag> ####
12# Add extra flags to your current C[XX]FLAGS 12# Add extra flags to your current C[XX]FLAGS
13# 13#
14#### change-flags <orig.flag> <new.flag> ### 14#### replace-flags <orig.flag> <new.flag> ###
15# Replace a flag by another one 15# Replace a flag by another one
16# 16#
17 17#### is-flag <flag> ####
18# Returns "true" if flag is set in C[XX]FLAGS
19# Matches only complete flag
20#
18 21
19filter-flags () { 22filter-flags () {
20 23
21 for x in $1; do 24 for x in $1; do
22 CFLAGS="${CFLAGS/$x}" 25 CFLAGS="${CFLAGS/$x}"
31 CFLAGS="$CFLAGS $1" 34 CFLAGS="$CFLAGS $1"
32 CXXFLAGS="$CXXFLAGS $1" 35 CXXFLAGS="$CXXFLAGS $1"
33 36
34} 37}
35 38
36change-flags () { 39replace-flags () {
37 40
38 CFLAGS="${CFLAGS/${1}/${2}" 41 CFLAGS="${CFLAGS/${1}/${2}}"
39 CXXFLAGS="${CXXFLAGS/${1}/${2}" 42 CXXFLAGS="${CXXFLAGS/${1}/${2}}"
40 43
41} 44}
45
46is-flag() {
47
48 for x in $CFLAGS $CXXFLAGS; do
49 if [ "$x" == "$1" ]; then
50 echo true
51 break
52 fi
53 done
54
55}

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20