summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2012-02-07 12:47:54 +0000
committerSergei Trofimovich <slyfox@gentoo.org>2012-02-07 12:47:54 +0000
commit8327f29447be80a08622b01d3e30d8191307df48 (patch)
tree39950c0ad95a3f7f9a6a1e549ed28559a22d46bc /eclass/haskell-cabal.eclass
parentStable for AMD64, wrt security bug #335892 (diff)
downloadgentoo-2-8327f29447be80a08622b01d3e30d8191307df48.tar.gz
gentoo-2-8327f29447be80a08622b01d3e30d8191307df48.tar.bz2
gentoo-2-8327f29447be80a08622b01d3e30d8191307df48.zip
Added support for CABAL_EXTRA_BUILD_FLAGS and HCFLAGS magic variables
CABAL_EXTRA_BUILD_FLAGS allows user to pass arguments to ./setup build phase. For example you can get detailed build log this way: CABAL_EXTRA_BUILD_FLAGS=-v emerge something HCFLAGS is similar to CFLAGS / CXXFLAGS / FFLAGS in spirit. You can use it in make.conf or in one-shot merges to enable random ghc features: HCFLAGS="-O0 -Wall" emerge something-else
Diffstat (limited to 'eclass/haskell-cabal.eclass')
-rw-r--r--eclass/haskell-cabal.eclass20
1 files changed, 16 insertions, 4 deletions
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index 74e19bc70a21..fe101b834608 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.26 2012/01/20 18:24:09 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.27 2012/02/07 12:47:54 slyfox Exp $
# @ECLASS: haskell-cabal.eclass
# @MAINTAINER:
@@ -52,6 +52,12 @@ inherit ghc-package multilib
# example: /etc/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared
: ${CABAL_EXTRA_CONFIGURE_FLAGS:=}
+# @ECLASS-VARIABLE: CABAL_EXTRA_BUILD_FLAGS
+# @DESCRIPTION:
+# User-specified additional parameters passed to 'setup build'.
+# example: /etc/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v
+: ${CABAL_EXTRA_BUILD_FLAGS:=}
+
# @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS
# @DESCRIPTION:
# User-specified additional parameters for ghc when building
@@ -180,7 +186,7 @@ cabal-bootstrap() {
${GHC_BOOTSTRAP_FLAGS} \
"$@" \
-o setup
- echo $(ghc-getghc) "$@"
+ echo $(ghc-getghc) ${HCFLAGS} "$@"
$(ghc-getghc) "$@"
}
if $(ghc-supports-shared-libraries); then
@@ -250,6 +256,12 @@ cabal-configure() {
cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs"
fi
+ local option
+ for option in ${HCFLAGS}
+ do
+ cabalconf+=" --ghc-option=$option"
+ done
+
# Building GHCi libs on ppc64 causes "TOC overflow".
if use ppc64; then
cabalconf="${cabalconf} --disable-library-for-ghci"
@@ -307,7 +319,7 @@ cabal-configure() {
cabal-build() {
unset LANG LC_ALL LC_MESSAGES
- set -- build "$@"
+ set -- build ${CABAL_EXTRA_BUILD_FLAGS} "$@"
echo ./setup "$@"
./setup "$@" \
|| die "setup build failed"
@@ -404,7 +416,7 @@ haskell-cabal_src_configure() {
cabal-bootstrap
- cabal-configure $ghc_flags "$@"
+ cabal-configure "$@"
popd > /dev/null
fi