/[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.23 Revision 1.30
1# Copyright 1999-2011 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.23 2011/03/13 20:15:14 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.30 2012/04/14 19:30:53 slyfox Exp $
4# 4
5# @ECLASS: haskell-cabal.eclass
6# @MAINTAINER:
7# Haskell herd <haskell@gentoo.org>
8# @AUTHOR:
5# Original authors: Andres Loeh <kosmikus@gentoo.org> 9# Original author: Andres Loeh <kosmikus@gentoo.org>
6# Duncan Coutts <dcoutts@gentoo.org> 10# Original author: Duncan Coutts <dcoutts@gentoo.org>
7# Maintained by: Haskell herd <haskell@gentoo.org> 11# @BLURB: for packages that make use of the Haskell Common Architecture for Building Applications and Libraries (cabal)
8# 12# @DESCRIPTION:
9# This eclass is for packages that make use of the
10# Haskell Common Architecture for Building Applications
11# and Libraries (cabal).
12#
13# Basic instructions: 13# Basic instructions:
14# 14#
15# Before inheriting the eclass, set CABAL_FEATURES to 15# Before inheriting the eclass, set CABAL_FEATURES to
16# reflect the tools and features that the package makes 16# reflect the tools and features that the package makes
17# use of. 17# use of.
28# bin -- the package installs binaries 28# bin -- the package installs binaries
29# lib -- the package installs libraries 29# lib -- the package installs libraries
30# nocabaldep -- don't add dependency on cabal. 30# nocabaldep -- don't add dependency on cabal.
31# only used for packages that _must_ not pull the dependency 31# only used for packages that _must_ not pull the dependency
32# on cabal, but still use this eclass (e.g. haskell-updater). 32# on cabal, but still use this eclass (e.g. haskell-updater).
33#
34# Dependencies on other cabal packages have to be specified
35# correctly.
36#
37# Cabal libraries should usually be SLOTted with "${PV}".
38#
39# Many Cabal packages require S to be manually set.
40#
41# Conforming Cabal packages don't require any function definitions
42# in the ebuild.
43#
44# Special flags to Cabal Configure can now be set by using
45# CABAL_CONFIGURE_FLAGS
46 33
47inherit ghc-package multilib 34inherit ghc-package multilib
35
36# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
37# @DESCRIPTION:
38# User-specified additional parameters passed to 'setup configure'.
39# example: /etc/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared
40: ${CABAL_EXTRA_CONFIGURE_FLAGS:=}
41
42# @ECLASS-VARIABLE: CABAL_EXTRA_BUILD_FLAGS
43# @DESCRIPTION:
44# User-specified additional parameters passed to 'setup build'.
45# example: /etc/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v
46: ${CABAL_EXTRA_BUILD_FLAGS:=}
47
48# @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS
49# @DESCRIPTION:
50# User-specified additional parameters for ghc when building
51# _only_ 'setup' binary bootstrap.
52# example: /etc/make.conf: GHC_BOOTSTRAP_FLAGS=-dynamic to make
53# linking 'setup' faster.
54: ${GHC_BOOTSTRAP_FLAGS:=}
48 55
49HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install" 56HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install"
50 57
51case "${EAPI:-0}" in 58case "${EAPI:-0}" in
52 2|3|4) HASKELL_CABAL_EXPF+=" src_configure" ;; 59 2|3|4) HASKELL_CABAL_EXPF+=" src_configure" ;;
57 64
58for feature in ${CABAL_FEATURES}; do 65for feature in ${CABAL_FEATURES}; do
59 case ${feature} in 66 case ${feature} in
60 haddock) CABAL_USE_HADDOCK=yes;; 67 haddock) CABAL_USE_HADDOCK=yes;;
61 hscolour) CABAL_USE_HSCOLOUR=yes;; 68 hscolour) CABAL_USE_HSCOLOUR=yes;;
69 hoogle) CABAL_USE_HOOGLE=yes;;
62 alex) CABAL_USE_ALEX=yes;; 70 alex) CABAL_USE_ALEX=yes;;
63 happy) CABAL_USE_HAPPY=yes;; 71 happy) CABAL_USE_HAPPY=yes;;
64 c2hs) CABAL_USE_C2HS=yes;; 72 c2hs) CABAL_USE_C2HS=yes;;
65 cpphs) CABAL_USE_CPPHS=yes;; 73 cpphs) CABAL_USE_CPPHS=yes;;
66 profile) CABAL_USE_PROFILE=yes;; 74 profile) CABAL_USE_PROFILE=yes;;
72 esac 80 esac
73done 81done
74 82
75if [[ -n "${CABAL_USE_HADDOCK}" ]]; then 83if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
76 IUSE="${IUSE} doc" 84 IUSE="${IUSE} doc"
77 DEPEND="${DEPEND} doc? ( dev-haskell/haddock )" 85 # don't require depend on itself to build docs.
86 # ebuild bootstraps docs from just built binary
87 [[ ${CATEGORY}/${PN} = "dev-haskell/haddock" ]] || DEPEND="${DEPEND} doc? ( dev-haskell/haddock )"
78fi 88fi
79 89
80if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then 90if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then
81 IUSE="${IUSE} hscolour" 91 IUSE="${IUSE} hscolour"
82 DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )" 92 DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
123 if [[ "${CABAL_BOOTSTRAP}" ]]; then 133 if [[ "${CABAL_BOOTSTRAP}" ]]; then
124 # We're bootstrapping cabal, so the cabal version is the version 134 # We're bootstrapping cabal, so the cabal version is the version
125 # of this package itself. 135 # of this package itself.
126 _CABAL_VERSION_CACHE="${PV}" 136 _CABAL_VERSION_CACHE="${PV}"
127 elif [[ "${CABAL_FROM_GHC}" ]]; then 137 elif [[ "${CABAL_FROM_GHC}" ]]; then
128 # We can't assume there's a version of Cabal installed by ebuild as 138 local cabal_package=$(echo "$(ghc-libdir)"/Cabal-*)
129 # this might be a first time install of GHC (for packages that 139 # /path/to/ghc/Cabal-${VER} -> ${VER}
130 # use the shipped Cabal like haskell-updater). 140 _CABAL_VERSION_CACHE="${cabal_package/*Cabal-/}"
131
132 # The user is likely to only have one version of Cabal, provided
133 # by GHC. Note that dev-haskell/cabal can be a dummy package, only
134 # using the version provided by GHC. If the user has another version
135 # of Cabal too (more recent than the one GHC provides through
136 # dev-haskell/cabal, or possibly older if he used an old
137 # Cabal package) the most recent is used (expected to be the last
138 # one in the ghc-pkg output).
139 _CABAL_VERSION_CACHE="$(ghc-pkg field Cabal version | tail -n 1)"
140
141 # Strip out the "version: " prefix
142 _CABAL_VERSION_CACHE="${_CABAL_VERSION_CACHE#"version: "}"
143 else 141 else
144 # We ask portage, not ghc, so that we only pick up 142 # We ask portage, not ghc, so that we only pick up
145 # portage-installed cabal versions. 143 # portage-installed cabal versions.
146 _CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)" 144 _CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
147 fi 145 fi
152cabal-bootstrap() { 150cabal-bootstrap() {
153 local setupmodule 151 local setupmodule
154 local cabalpackage 152 local cabalpackage
155 if [[ -f "${S}/Setup.lhs" ]]; then 153 if [[ -f "${S}/Setup.lhs" ]]; then
156 setupmodule="${S}/Setup.lhs" 154 setupmodule="${S}/Setup.lhs"
157 else
158 if [[ -f "${S}/Setup.hs" ]]; then 155 elif [[ -f "${S}/Setup.hs" ]]; then
159 setupmodule="${S}/Setup.hs" 156 setupmodule="${S}/Setup.hs"
160 else 157 else
161 die "No Setup.lhs or Setup.hs found" 158 die "No Setup.lhs or Setup.hs found"
162 fi
163 fi 159 fi
164 160
165 # We build the setup program using the latest version of 161 # We build the setup program using the latest version of
166 # cabal that we have installed 162 # cabal that we have installed
167 if version_is_at_least "6.4" "$(ghc-version)"; then
168 cabalpackage=Cabal-$(cabal-version) 163 cabalpackage=Cabal-$(cabal-version)
169 else
170 # older ghc's don't support package versioning
171 cabalpackage=Cabal
172 fi
173 einfo "Using cabal-$(cabal-version)." 164 einfo "Using cabal-$(cabal-version)."
165
166 make_setup() {
174 $(ghc-getghc) -package "${cabalpackage}" --make "${setupmodule}" -o setup \ 167 set -- -package "${cabalpackage}" --make "${setupmodule}" \
168 ${GHC_BOOTSTRAP_FLAGS} \
169 "$@" \
170 -o setup
171 echo $(ghc-getghc) ${HCFLAGS} "$@"
172 $(ghc-getghc) "$@"
173 }
174 if $(ghc-supports-shared-libraries); then
175 # # some custom build systems might use external libraries,
176 # # for which we don't have shared libs, so keep static fallback
177 # Disabled '-dynamic' as ghc does not embed RPATH to used extra-libraries:
178 # bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3
179 # make_setup -dynamic "$@" ||
175 || die "compiling ${setupmodule} failed" 180 make_setup "$@" || die "compiling ${setupmodule} failed"
181 else
182 make_setup "$@" || die "compiling ${setupmodule} failed"
183 fi
176} 184}
177 185
178cabal-mksetup() { 186cabal-mksetup() {
179 local setupdir 187 local setupdir
180 188
185 fi 193 fi
186 194
187 rm -f "${setupdir}"/Setup.{lhs,hs} 195 rm -f "${setupdir}"/Setup.{lhs,hs}
188 196
189 echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \ 197 echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
190 > $setupdir/Setup.hs 198 > $setupdir/Setup.hs || die "failed to create default Setup.hs"
191} 199}
192 200
193cabal-hscolour() { 201cabal-hscolour() {
194 ./setup hscolour || die "setup hscolour failed" 202 set -- hscolour "$@"
203 echo ./setup "$@"
204 ./setup "$@" || die "setup hscolour failed"
195} 205}
196 206
197cabal-haddock() { 207cabal-haddock() {
198 ./setup haddock || die "setup haddock failed" 208 set -- haddock "$@"
209 echo ./setup "$@"
210 ./setup "$@" || die "setup haddock failed"
199} 211}
200 212
201cabal-hscolour-haddock() { 213cabal-hscolour-haddock() {
202 # --hyperlink-source implies calling 'setup hscolour' 214 # --hyperlink-source implies calling 'setup hscolour'
215 set -- haddock --hyperlink-source
216 echo ./setup "$@"
203 ./setup haddock --hyperlink-source || die "setup haddock failed" 217 ./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed"
204} 218}
205 219
206cabal-configure() { 220cabal-configure() {
207 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 221 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
208 222
224 cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" 238 cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs"
225 fi 239 fi
226 if [[ -n "${CABAL_USE_CPPHS}" ]]; then 240 if [[ -n "${CABAL_USE_CPPHS}" ]]; then
227 cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" 241 cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs"
228 fi 242 fi
243
244 local option
245 for option in ${HCFLAGS}
246 do
247 cabalconf+=" --ghc-option=$option"
248 done
229 249
230 # Building GHCi libs on ppc64 causes "TOC overflow". 250 # Building GHCi libs on ppc64 causes "TOC overflow".
231 if use ppc64; then 251 if use ppc64; then
232 cabalconf="${cabalconf} --disable-library-for-ghci" 252 cabalconf="${cabalconf} --disable-library-for-ghci"
233 fi 253 fi
234 254
235 if version_is_at_least "1.4" "$(cabal-version)"; then 255 # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
256 # so translate LDFLAGS to ghc parameters (without filtering)
257 local flag
258 for flag in $LDFLAGS; do cabalconf="${cabalconf} --ghc-option=-optl$flag"; done
259
236 # disable executable stripping for the executables, as portage will 260 # disable executable stripping for the executables, as portage will
237 # strip by itself, and pre-stripping gives a QA warning. 261 # strip by itself, and pre-stripping gives a QA warning.
238 # cabal versions previous to 1.4 does not strip executables, and does 262 # cabal versions previous to 1.4 does not strip executables, and does
239 # not accept the flag. 263 # not accept the flag.
240 # this fixes numerous bugs, amongst them; 264 # this fixes numerous bugs, amongst them;
241 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494 265 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
242 cabalconf="${cabalconf} --disable-executable-stripping" 266 cabalconf="${cabalconf} --disable-executable-stripping"
243 fi
244 267
245 if version_is_at_least "1.2.0" "$(cabal-version)"; then
246 cabalconf="${cabalconf} --docdir=${EPREFIX}/usr/share/doc/${PF}" 268 cabalconf="${cabalconf} --docdir=${EPREFIX}/usr/share/doc/${PF}"
247 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes 269 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
248 # it's better if the configure chatter is in the build logs: 270 # it's better if the configure chatter is in the build logs:
249 cabalconf="${cabalconf} --verbose" 271 cabalconf="${cabalconf} --verbose"
250 fi
251 # Note: with Cabal-1.1.6.x we do not have enough control
252 # to put the docs into the right place. They're currently going
253 # into /usr/share/${P}/ghc-x.y/doc/
254 # rather than /usr/share/doc/${PF}/
255 # Because we can only set the datadir, not the docdir.
256 272
273 # We build shared version of our Cabal where ghc ships it's shared
274 # version of it. We will link ./setup as dynamic binary againt Cabal later.
275 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
276 $(ghc-supports-shared-libraries) && \
277 cabalconf="${cabalconf} --enable-shared"
278
257 ./setup configure \ 279 set -- configure \
258 --ghc --prefix="${EPREFIX}"/usr \ 280 --ghc --prefix="${EPREFIX}"/usr \
259 --with-compiler="$(ghc-getghc)" \ 281 --with-compiler="$(ghc-getghc)" \
260 --with-hc-pkg="$(ghc-getghcpkg)" \ 282 --with-hc-pkg="$(ghc-getghcpkg)" \
261 --prefix="${EPREFIX}"/usr \ 283 --prefix="${EPREFIX}"/usr \
262 --libdir="${EPREFIX}"/usr/$(get_libdir) \ 284 --libdir="${EPREFIX}"/usr/$(get_libdir) \
263 --libsubdir=${P}/ghc-$(ghc-version) \ 285 --libsubdir=${P}/ghc-$(ghc-version) \
264 --datadir="${EPREFIX}"/usr/share/ \ 286 --datadir="${EPREFIX}"/usr/share/ \
265 --datasubdir=${P}/ghc-$(ghc-version) \ 287 --datasubdir=${P}/ghc-$(ghc-version) \
266 ${cabalconf} \ 288 ${cabalconf} \
267 ${CABAL_CONFIGURE_FLAGS} \ 289 ${CABAL_CONFIGURE_FLAGS} \
290 ${CABAL_EXTRA_CONFIGURE_FLAGS} \
291 "$@"
292 echo ./setup "$@"
268 "$@" || die "setup configure failed" 293 ./setup "$@" || die "setup configure failed"
269} 294}
270 295
271cabal-build() { 296cabal-build() {
272 unset LANG LC_ALL LC_MESSAGES 297 unset LANG LC_ALL LC_MESSAGES
273 ./setup build \ 298 set -- build ${CABAL_EXTRA_BUILD_FLAGS} "$@"
299 echo ./setup "$@"
300 ./setup "$@" \
274 || die "setup build failed" 301 || die "setup build failed"
275} 302}
276 303
277cabal-copy() { 304cabal-copy() {
278 has "${EAPI:-0}" 0 1 2 && ! use prefix && ED=${D} 305 has "${EAPI:-0}" 0 1 2 && ! use prefix && ED=${D}
279 306
280 ./setup copy \ 307 set -- copy --destdir="${D}" "$@"
281 --destdir="${D}" \ 308 echo ./setup "$@"
282 || die "setup copy failed" 309 ./setup "$@" || die "setup copy failed"
283 310
284 # cabal is a bit eager about creating dirs, 311 # cabal is a bit eager about creating dirs,
285 # so remove them if they are empty 312 # so remove them if they are empty
286 rmdir "${ED}/usr/bin" 2> /dev/null 313 rmdir "${ED}/usr/bin" 2> /dev/null
287
288 # GHC 6.4 has a bug in get/setPermission and Cabal 1.1.1 has
289 # no workaround.
290 # set the +x permission on executables
291 if [[ -d "${ED}/usr/bin" ]] ; then
292 chmod +x "${ED}/usr/bin/"*
293 fi
294 # TODO: do we still need this?
295} 314}
296 315
297cabal-pkg() { 316cabal-pkg() {
298 # This does not actually register since we're using true instead 317 # This does not actually register since we're using true instead
299 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can 318 # of ghc-pkg. So it just leaves the .conf file and we can
300 # register that ourselves (if it exists). 319 # register that ourselves (if it exists).
301 local result
302 local err
303 320
304 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then 321 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
305 if version_is_at_least "1.2.0" "$(cabal-version)"; then
306 # Newer cabal can generate a package conf for us: 322 # Newer cabal can generate a package conf for us:
307 ./setup register --gen-pkg-config="${T}/${P}.conf" 323 ./setup register --gen-pkg-config="${T}/${P}.conf"
308 ghc-setup-pkg "${T}/${P}.conf" 324 ghc-setup-pkg "${T}/${P}.conf"
309 ghc-install-pkg 325 ghc-install-pkg
310 else
311 # With older cabal we have to hack it by replacing its ghc-pkg
312 # with true and then just picking up the .installed-pkg-config
313 # file and registering that ourselves (if it exists).
314 sed -i "s|$(ghc-getghcpkg)|$(type -P true)|" .setup-config
315 ./setup register || die "setup register failed"
316 if [[ -f .installed-pkg-config ]]; then
317 ghc-setup-pkg .installed-pkg-config
318 ghc-install-pkg
319 else
320 die "setup register has not generated a package configuration file"
321 fi
322 fi
323 fi 326 fi
324} 327}
325 328
326# Some cabal libs are bundled along with some versions of ghc 329# Some cabal libs are bundled along with some versions of ghc
327# eg filepath-1.0 comes with ghc-6.6.1 330# eg filepath-1.0 comes with ghc-6.6.1
339} 342}
340 343
341# exported function: check if cabal is correctly installed for 344# exported function: check if cabal is correctly installed for
342# the currently active ghc (we cannot guarantee this with portage) 345# the currently active ghc (we cannot guarantee this with portage)
343haskell-cabal_pkg_setup() { 346haskell-cabal_pkg_setup() {
344 ghc-package_pkg_setup
345 if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then 347 if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
346 eerror "The package dev-haskell/cabal is not correctly installed for" 348 eerror "The package dev-haskell/cabal is not correctly installed for"
347 eerror "the currently active version of ghc ($(ghc-version)). Please" 349 eerror "the currently active version of ghc ($(ghc-version)). Please"
348 eerror "run ghc-updater or haskell-updater or re-build dev-haskell/cabal." 350 eerror "run haskell-updater or re-build dev-haskell/cabal."
349 die "cabal is not correctly installed" 351 die "cabal is not correctly installed"
350 fi 352 fi
351 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then 353 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
352 eerror "QA: Neither bin nor lib are in CABAL_FEATURES." 354 eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES."
353 fi 355 fi
354 if [[ -n "${CABAL_UNKNOWN}" ]]; then 356 if [[ -n "${CABAL_UNKNOWN}" ]]; then
355 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}" 357 eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
356 fi 358 fi
357 if cabal-is-dummy-lib; then 359 if cabal-is-dummy-lib; then
358 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." 360 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
359 fi 361 fi
360} 362}
361 363
362haskell-cabal_src_configure() { 364haskell-cabal_src_configure() {
363 if ! cabal-is-dummy-lib; then 365 cabal-is-dummy-lib && return
366
364 pushd "${S}" > /dev/null 367 pushd "${S}" > /dev/null
365 368
366 cabal-bootstrap 369 cabal-bootstrap
367 370
368 ghc_flags=""
369 # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
370 # so translate LDFLAGS to ghc parameters (without filtering)
371 for flag in $LDFLAGS; do ghc_flags="${ghc_flags} --ghc-option=-optl$flag"; done
372
373 cabal-configure $ghc_flags "$@" 371 cabal-configure "$@"
374 372
375 popd > /dev/null 373 popd > /dev/null
376 fi
377} 374}
378 375
379# exported function: nice alias 376# exported function: nice alias
380cabal_src_configure() { 377cabal_src_configure() {
381 haskell-cabal_src_configure "$@" 378 haskell-cabal_src_configure "$@"
382} 379}
383 380
384# exported function: cabal-style bootstrap configure and compile 381# exported function: cabal-style bootstrap configure and compile
385cabal_src_compile() { 382cabal_src_compile() {
386 if ! cabal-is-dummy-lib; then 383 # it's a common mistake when one bumps ebuild to EAPI="2" (and upper)
384 # and forgets to separate src_compile() to src_configure()/src_compile().
385 # Such error leads to default src_configure and we lose all passed flags.
386 if ! has "${EAPI:-0}" 0 1; then
387 local passed_flag
388 for passed_flag in "$@"; do
389 [[ ${passed_flag} == --flags=* ]] && \
390 eqawarn "QA Notice: Cabal option '${passed_flag}' has effect only in src_configure()"
391 done
392 fi
393
394 cabal-is-dummy-lib && return
395
387 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@" 396 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
388 cabal-build 397 cabal-build
389 398
390 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 399 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
391 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then 400 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
392 # hscolour and haddock 401 # hscolour and haddock
393 cabal-hscolour-haddock 402 cabal-hscolour-haddock
394 else
395 # just haddock
396 cabal-haddock
397 fi
398 else 403 else
404 # just haddock
405 cabal-haddock
406 fi
407 else
399 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then 408 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
400 # just hscolour 409 # just hscolour
401 cabal-hscolour 410 cabal-hscolour
402 fi
403 fi 411 fi
404 fi 412 fi
405} 413}
406 414
407haskell-cabal_src_compile() { 415haskell-cabal_src_compile() {
417 425
418 if cabal-is-dummy-lib; then 426 if cabal-is-dummy-lib; then
419 einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}" 427 einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}"
420 else 428 else
421 einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}" 429 einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
430 set -- test "$@"
431 echo ./setup "$@"
422 ./setup test || die "cabal test failed" 432 ./setup "$@" || die "cabal test failed"
423 fi 433 fi
424 434
425 popd > /dev/null 435 popd > /dev/null
426} 436}
427 437
428# exported function: cabal-style copy and register 438# exported function: cabal-style copy and register
429cabal_src_install() { 439cabal_src_install() {
430 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 440 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
431 441
432 if cabal-is-dummy-lib; then 442 if ! cabal-is-dummy-lib; then
433 # create a dummy local package conf file for the sake of ghc-updater
434 local ghc_confdir_with_prefix="$(ghc-confdir)"
435 # remove EPREFIX
436 dodir ${ghc_confdir_with_prefix#${EPREFIX}}
437 echo '[]' > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
438 else
439 cabal-copy 443 cabal-copy
440 cabal-pkg 444 cabal-pkg
441
442 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
443 if ! version_is_at_least "1.1.6" "$(cabal-version)"; then
444 dohtml -r dist/doc/html/*
445 fi
446 fi 445 fi
447 fi 446
447 # create a dummy local package conf file for haskell-updater
448 # if it does not exist (dummy libraries and binaries w/o libraries)
449 local ghc_confdir_with_prefix="$(ghc-confdir)"
450 # remove EPREFIX
451 dodir ${ghc_confdir_with_prefix#${EPREFIX}}
452 local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
453 [[ -e $conf_file ]] || echo '[]' > "$conf_file" || die
448} 454}
449 455
450haskell-cabal_src_install() { 456haskell-cabal_src_install() {
451 pushd "${S}" > /dev/null 457 pushd "${S}" > /dev/null
452 458

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.30

  ViewVC Help
Powered by ViewVC 1.1.20