| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 Gentoo Foundation |
| 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/haskell-cabal.eclass,v 1.26 2012/01/20 18:24:09 slyfox Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.27 2012/02/07 12:47:54 slyfox Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: haskell-cabal.eclass |
5 | # @ECLASS: haskell-cabal.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Haskell herd <haskell@gentoo.org> |
7 | # Haskell herd <haskell@gentoo.org> |
| 8 | # @AUTHOR: |
8 | # @AUTHOR: |
| … | |
… | |
| 49 | # @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS |
49 | # @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS |
| 50 | # @DESCRIPTION: |
50 | # @DESCRIPTION: |
| 51 | # User-specified additional parameters passed to 'setup configure'. |
51 | # User-specified additional parameters passed to 'setup configure'. |
| 52 | # example: /etc/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared |
52 | # example: /etc/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared |
| 53 | : ${CABAL_EXTRA_CONFIGURE_FLAGS:=} |
53 | : ${CABAL_EXTRA_CONFIGURE_FLAGS:=} |
|
|
54 | |
|
|
55 | # @ECLASS-VARIABLE: CABAL_EXTRA_BUILD_FLAGS |
|
|
56 | # @DESCRIPTION: |
|
|
57 | # User-specified additional parameters passed to 'setup build'. |
|
|
58 | # example: /etc/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v |
|
|
59 | : ${CABAL_EXTRA_BUILD_FLAGS:=} |
| 54 | |
60 | |
| 55 | # @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS |
61 | # @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS |
| 56 | # @DESCRIPTION: |
62 | # @DESCRIPTION: |
| 57 | # User-specified additional parameters for ghc when building |
63 | # User-specified additional parameters for ghc when building |
| 58 | # _only_ 'setup' binary bootstrap. |
64 | # _only_ 'setup' binary bootstrap. |
| … | |
… | |
| 178 | make_setup() { |
184 | make_setup() { |
| 179 | set -- -package "${cabalpackage}" --make "${setupmodule}" \ |
185 | set -- -package "${cabalpackage}" --make "${setupmodule}" \ |
| 180 | ${GHC_BOOTSTRAP_FLAGS} \ |
186 | ${GHC_BOOTSTRAP_FLAGS} \ |
| 181 | "$@" \ |
187 | "$@" \ |
| 182 | -o setup |
188 | -o setup |
| 183 | echo $(ghc-getghc) "$@" |
189 | echo $(ghc-getghc) ${HCFLAGS} "$@" |
| 184 | $(ghc-getghc) "$@" |
190 | $(ghc-getghc) "$@" |
| 185 | } |
191 | } |
| 186 | if $(ghc-supports-shared-libraries); then |
192 | if $(ghc-supports-shared-libraries); then |
| 187 | # some custom build systems might use external libraries, |
193 | # some custom build systems might use external libraries, |
| 188 | # for which we don't have shared libs, so keep static fallback |
194 | # for which we don't have shared libs, so keep static fallback |
| … | |
… | |
| 247 | cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" |
253 | cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" |
| 248 | fi |
254 | fi |
| 249 | if [[ -n "${CABAL_USE_CPPHS}" ]]; then |
255 | if [[ -n "${CABAL_USE_CPPHS}" ]]; then |
| 250 | cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" |
256 | cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" |
| 251 | fi |
257 | fi |
|
|
258 | |
|
|
259 | local option |
|
|
260 | for option in ${HCFLAGS} |
|
|
261 | do |
|
|
262 | cabalconf+=" --ghc-option=$option" |
|
|
263 | done |
| 252 | |
264 | |
| 253 | # Building GHCi libs on ppc64 causes "TOC overflow". |
265 | # Building GHCi libs on ppc64 causes "TOC overflow". |
| 254 | if use ppc64; then |
266 | if use ppc64; then |
| 255 | cabalconf="${cabalconf} --disable-library-for-ghci" |
267 | cabalconf="${cabalconf} --disable-library-for-ghci" |
| 256 | fi |
268 | fi |
| … | |
… | |
| 305 | ./setup "$@" || die "setup configure failed" |
317 | ./setup "$@" || die "setup configure failed" |
| 306 | } |
318 | } |
| 307 | |
319 | |
| 308 | cabal-build() { |
320 | cabal-build() { |
| 309 | unset LANG LC_ALL LC_MESSAGES |
321 | unset LANG LC_ALL LC_MESSAGES |
| 310 | set -- build "$@" |
322 | set -- build ${CABAL_EXTRA_BUILD_FLAGS} "$@" |
| 311 | echo ./setup "$@" |
323 | echo ./setup "$@" |
| 312 | ./setup "$@" \ |
324 | ./setup "$@" \ |
| 313 | || die "setup build failed" |
325 | || die "setup build failed" |
| 314 | } |
326 | } |
| 315 | |
327 | |
| … | |
… | |
| 402 | if ! cabal-is-dummy-lib; then |
414 | if ! cabal-is-dummy-lib; then |
| 403 | pushd "${S}" > /dev/null |
415 | pushd "${S}" > /dev/null |
| 404 | |
416 | |
| 405 | cabal-bootstrap |
417 | cabal-bootstrap |
| 406 | |
418 | |
| 407 | cabal-configure $ghc_flags "$@" |
419 | cabal-configure "$@" |
| 408 | |
420 | |
| 409 | popd > /dev/null |
421 | popd > /dev/null |
| 410 | fi |
422 | fi |
| 411 | } |
423 | } |
| 412 | |
424 | |