diff options
author | Mike Frysinger <vapier@gentoo.org> | 2004-02-21 07:19:29 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2004-02-21 07:19:29 +0000 |
commit | 43d83132349fadbca8d1c67e885bdb6f01c9ca48 (patch) | |
tree | df9c7a180b62a88e3dade1be5b3adce583788d4b /eclass | |
parent | move ALLOWED_FLAGS/UNSTABLE_FLAGS out of global scope since only one or two f... (diff) | |
download | historical-43d83132349fadbca8d1c67e885bdb6f01c9ca48.tar.gz historical-43d83132349fadbca8d1c67e885bdb6f01c9ca48.tar.bz2 historical-43d83132349fadbca8d1c67e885bdb6f01c9ca48.zip |
add replace-cpu-flags to help tone down march/mcpu flags
make sure filter-flags/replace-flags catch multiple copies of a flag (for example, if user has -msse -msse -msse and we try to `filter-flags -msse`, we would catch only the first one before)
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/flag-o-matic.eclass | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass index b38bef2f7788..df3ed286e586 100644 --- a/eclass/flag-o-matic.eclass +++ b/eclass/flag-o-matic.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.36 2004/02/21 07:07:56 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.37 2004/02/21 07:19:29 vapier Exp $ # # Author Bart Verwilst <verwilst@gentoo.org> @@ -18,6 +18,10 @@ INHERITED="$INHERITED $ECLASS" #### replace-flags <orig.flag> <new.flag> ### # Replace a flag by another one # +#### replace-cpu-flags <new.cpu> <old.cpus> ### +# Replace march/mcpu flags that specify <old.cpus> +# with flags that specify <new.cpu> +# #### is-flag <flag> #### # Returns "true" if flag is set in C[XX]FLAGS # Matches only complete a flag @@ -86,8 +90,8 @@ filter-flags() { CFLAGS=" ${CFLAGS} " CXXFLAGS=" ${CXXFLAGS} " for x in "$@" ; do - CFLAGS="${CFLAGS/ ${x} / }" - CXXFLAGS="${CXXFLAGS/ ${x} / }" + CFLAGS="${CFLAGS// ${x} / }" + CXXFLAGS="${CXXFLAGS// ${x} / }" done CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" @@ -106,13 +110,23 @@ replace-flags() { # out part of a flag ... we want flag atoms ! :D CFLAGS=" ${CFLAGS} " CXXFLAGS=" ${CXXFLAGS} " - CFLAGS="${CFLAGS/ ${1} / ${2} }" - CXXFLAGS="${CXXFLAGS/ ${1} / ${2} }" + CFLAGS="${CFLAGS// ${1} / ${2} }" + CXXFLAGS="${CXXFLAGS// ${1} / ${2} }" CFLAGS="${CFLAGS:1:${#CFLAGS}-2}" CXXFLAGS="${CXXFLAGS:1:${#CXXFLAGS}-2}" return 0 } +replace-cpu-flags() { + local newcpu="$1" ; shift + local oldcpu="" + for oldcpu in "$@" ; do + replace-flags -march=${oldcpu} -march=${newcpu} + replace-flags -mcpu=${oldcpu} -mcpu=${newcpu} + done + return 0 +} + is-flag() { for x in ${CFLAGS} ${CXXFLAGS} ; do if [ "${x}" == "$1" ] ; then |