/[gentoo-x86]/eclass/haskell-cabal.eclass
Gentoo

Diff of /eclass/haskell-cabal.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.43 Revision 1.44
1# Copyright 1999-2014 Gentoo Foundation 1# Copyright 1999-2014 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.43 2014/02/11 19:00:06 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.44 2014/05/22 16:35:11 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:
178 cabalpackage=Cabal-$(cabal-version) 178 cabalpackage=Cabal-$(cabal-version)
179 einfo "Using cabal-$(cabal-version)." 179 einfo "Using cabal-$(cabal-version)."
180 180
181 make_setup() { 181 make_setup() {
182 set -- -package "${cabalpackage}" --make "${setupmodule}" \ 182 set -- -package "${cabalpackage}" --make "${setupmodule}" \
183 ${HCFLAGS} \
183 ${GHC_BOOTSTRAP_FLAGS} \ 184 ${GHC_BOOTSTRAP_FLAGS} \
184 "$@" \ 185 "$@" \
185 -o setup 186 -o setup
186 echo $(ghc-getghc) ${HCFLAGS} "$@" 187 echo $(ghc-getghc) "$@"
187 $(ghc-getghc) "$@" 188 $(ghc-getghc) "$@"
188 } 189 }
189 if $(ghc-supports-shared-libraries); then 190 if $(ghc-supports-shared-libraries); then
190 # # some custom build systems might use external libraries, 191 # # some custom build systems might use external libraries,
191 # # for which we don't have shared libs, so keep static fallback 192 # # for which we don't have shared libs, so keep static fallback
207 make_setup "$@" || die "compiling ${setupmodule} failed" 208 make_setup "$@" || die "compiling ${setupmodule} failed"
208 fi 209 fi
209} 210}
210 211
211cabal-mksetup() { 212cabal-mksetup() {
212 local setupdir 213 local setupdir=${1:-${S}}
214 local setup_src=${setupdir}/Setup.hs
213 215
214 if [[ -n $1 ]]; then
215 setupdir=$1
216 else
217 setupdir=${S}
218 fi
219
220 rm -f "${setupdir}"/Setup.{lhs,hs} 216 rm -vf "${setupdir}"/Setup.{lhs,hs}
217 elog "Creating 'Setup.hs' for 'Simple' build type."
221 218
222 echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \ 219 echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
223 > $setupdir/Setup.hs || die "failed to create default Setup.hs" 220 > "${setup_src}" || die "failed to create default Setup.hs"
224} 221}
225 222
226cabal-hscolour() { 223cabal-hscolour() {
227 set -- hscolour "$@" 224 set -- hscolour "$@"
228 echo ./setup "$@" 225 echo ./setup "$@"
250 eerror "Detected ${breakage_type} packages: ${@}" 247 eerror "Detected ${breakage_type} packages: ${@}"
251 die "//==-- Please, run 'haskell-updater' to fix ${breakage_type} packages --==//" 248 die "//==-- Please, run 'haskell-updater' to fix ${breakage_type} packages --==//"
252} 249}
253 250
254cabal-show-brokens() { 251cabal-show-brokens() {
252 elog "ghc-pkg check: 'checking for other broken packages:'"
255 # pretty-printer 253 # pretty-printer
256 $(ghc-getghcpkg) check 2>&1 \ 254 $(ghc-getghcpkg) check 2>&1 \
257 | egrep -v '^Warning: haddock-(html|interfaces): ' \ 255 | egrep -v '^Warning: haddock-(html|interfaces): ' \
258 | egrep -v '^Warning: include-dirs: ' 256 | egrep -v '^Warning: include-dirs: ' \
257 | head -n 20
259 258
260 cabal-die-if-nonempty 'broken' \ 259 cabal-die-if-nonempty 'broken' \
261 $($(ghc-getghcpkg) check --simple-output) 260 $($(ghc-getghcpkg) check --simple-output)
262} 261}
263 262
309 308
310 # parallel on all available cores 309 # parallel on all available cores
311 if ghc-supports-parallel-make; then 310 if ghc-supports-parallel-make; then
312 local max_jobs=$(makeopts_jobs) 311 local max_jobs=$(makeopts_jobs)
313 312
314 # limit to sort-of-sane value (same as Cabal) 313 # limit to very small value, as parallelism
314 # helps slightly, but makes things severely worse
315 # when amount of threads is Very Large.
315 [[ ${max_jobs} -gt 64 ]] && max_jobs=64 316 [[ ${max_jobs} -gt 4 ]] && max_jobs=4
316 317
317 cabalconf+=(--ghc-option=-j"$max_jobs") 318 cabalconf+=(--ghc-option=-j"$max_jobs")
318 fi 319 fi
319 320
320 # Building GHCi libs on ppc64 causes "TOC overflow". 321 # Building GHCi libs on ppc64 causes "TOC overflow".
617# CABAL_FILE=${S}/${MY_PN}-tools.cabal cabal_chdeps \ 618# CABAL_FILE=${S}/${MY_PN}-tools.cabal cabal_chdeps \
618# 'base == 3.*' 'base >= 4.2 && < 4.7' 619# 'base == 3.*' 'base >= 4.2 && < 4.7'
619#} 620#}
620# 621#
621cabal_chdeps() { 622cabal_chdeps() {
623 local cabal_fn=${MY_PN:-${PN}}.cabal
622 local cf=${CABAL_FILE:-${S}/${PN}.cabal} 624 local cf=${CABAL_FILE:-${S}/${cabal_fn}}
623 local from_ss # ss - substring 625 local from_ss # ss - substring
624 local to_ss 626 local to_ss
625 local orig_c # c - contents 627 local orig_c # c - contents
626 local new_c 628 local new_c
627 629

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.20