diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2013-11-20 09:19:19 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2013-11-20 09:19:19 +0000 |
commit | 0224093d83bb21b911552ec923b7bfa0067eb767 (patch) | |
tree | 64d6a36757a03999f47a7dfaa043e81c5cc25239 /eclass/haskell-cabal.eclass | |
parent | Whitespace (diff) | |
download | historical-0224093d83bb21b911552ec923b7bfa0067eb767.tar.gz historical-0224093d83bb21b911552ec923b7bfa0067eb767.tar.bz2 historical-0224093d83bb21b911552ec923b7bfa0067eb767.zip |
Added 'replace-hcflags()'. Filters HCFLAGS.
Diffstat (limited to 'eclass/haskell-cabal.eclass')
-rw-r--r-- | eclass/haskell-cabal.eclass | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass index cc61108418b8..2b31d7aad15e 100644 --- a/eclass/haskell-cabal.eclass +++ b/eclass/haskell-cabal.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.41 2013/07/29 12:31:35 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.42 2013/11/20 09:19:19 slyfox Exp $ # @ECLASS: haskell-cabal.eclass # @MAINTAINER: @@ -638,3 +638,25 @@ cabal_chdeps() { echo "${new_c}" > "$cf" || die "failed to update" } + +# @FUNCTION: replace-hcflags +# @USAGE: <old> <new> +# @DESCRIPTION: +# Replace the <old> flag with <new> in HCFLAGS. Accepts shell globs for <old>. +# The implementation is picked from flag-o-matic.eclass:replace-flags() +replace-hcflags() { + [[ $# != 2 ]] && die "Usage: replace-hcflags <old flag> <new flag>" + + local f new=() + for f in ${HCFLAGS} ; do + # Note this should work with globs like -O* + if [[ ${f} == ${1} ]]; then + einfo "HCFLAGS: replacing '${f}' to '${2}'" + f=${2} + fi + new+=( "${f}" ) + done + export HCFLAGS="${new[*]}" + + return 0 +} |