HASKELL-CABAL.ECLASS

Section: eclass-manpages (5)
Updated: Sep 2023
Index Return to Main Contents

NAME

haskell-cabal.eclass - for packages that make use of the Haskell Common Architecture for Building Applications and Libraries (cabal)

DESCRIPTION

Basic instructions:

Before inheriting the eclass, set CABAL_FEATURES to reflect the tools and features that the package makes use of.

Currently supported features:
  haddock    --  for documentation generation
  hscolour   --  generation of colourised sources
  hoogle     --  generation of documentation search index
  profile    --  if package supports to build profiling-enabled libraries
  bootstrap  --  only used for the cabal package itself
  lib        --  the package installs libraries
  nocabaldep --  don't add dependency on cabal.
                 only used for packages that _must_ not pull the dependency
                 on cabal, but still use this eclass (e.g. haskell-updater).
  ghcdeps    --  constraint dependency on package to ghc once
                 only used for packages that use libghc internally and _must_
                 not pull upper versions
  test-suite --  add support for cabal test-suites (introduced in Cabal-1.8)
  rebuild-after-doc-workaround -- enable doctest test failure workaround.
                 Symptom: when `./setup haddock` is run in a `build-type: Custom`
                 package it might cause cause the test-suite to fail with
                 errors like:
                 > <command line>: cannot satisfy -package-id singletons-2.7-3Z7pnljD8tU1NrslJodXmr
                 Workaround re-reginsters the package to avoid the failure
                 (and rebuilds changes).
                 FEATURE can be removed once https://github.com/haskell/cabal/issues/7213
                 is fixed.

SUPPORTED EAPIS

6 7 8

FUNCTIONS

cabal_flag
ebuild.sh:use_enable() taken as base

Usage examples:


    CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
 leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')


    CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
 also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')

cabal_chdeps
Allows easier patching of $CABAL_FILE (${S}/${PN}.cabal by default) depends

Accepts argument list as pairs of substitutions: <from-string> <to-string>...

Dies on error.

Usage examples:

src_prepare() {
   cabal_chdeps        'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7'        'containers ==0.4.*' 'containers >= 0.4 && < 0.6' } or src_prepare() {
   CABAL_FILE=${S}/${CABAL_PN}.cabal cabal_chdeps        'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7'
   CABAL_FILE=${S}/${CABAL_PN}-tools.cabal cabal_chdeps        'base == 3.*' 'base >= 4.2 && < 4.7' }

cabal-constraint
Allows to set constraints to the libraries that are used by the specified package.
replace-hcflags <old> <new>
Replace the <old> flag with <new> in HCFLAGS. Accepts shell globs for <old>. The implementation is picked from flag-o-matic.eclass:replace-flags()

ECLASS VARIABLES

CABAL_EXTRA_CONFIGURE_FLAGS (USER VARIABLE)
User-specified additional parameters passed to 'setup configure'. example: /etc/portage/make.conf:
   CABAL_EXTRA_CONFIGURE_FLAGS="--enable-shared --enable-executable-dynamic"
CABAL_EXTRA_BUILD_FLAGS (USER VARIABLE)
User-specified additional parameters passed to 'setup build'. example: /etc/portage/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v
GHC_BOOTSTRAP_FLAGS (USER VARIABLE)
User-specified additional parameters for ghc when building _only_ 'setup' binary bootstrap. example: /etc/portage/make.conf: GHC_BOOTSTRAP_FLAGS=-dynamic to make linking 'setup' faster.
CABAL_EXTRA_HADDOCK_FLAGS (USER VARIABLE)
User-specified additional parameters passed to 'setup haddock'. example: /etc/portage/make.conf:
   CABAL_EXTRA_HADDOCK_FLAGS="--haddock-options=--latex --haddock-options=--pretty-html"
CABAL_EXTRA_HOOGLE_FLAGS (USER VARIABLE)
User-specified additional parameters passed to 'setup haddock --hoogle'. example: /etc/portage/make.conf:
   CABAL_EXTRA_HOOGLE_FLAGS="--haddock-options=--show-all"
CABAL_EXTRA_HSCOLOUR_FLAGS (USER VARIABLE)
User-specified additional parameters passed to 'setup hscolour'. example: /etc/portage/make.conf:
   CABAL_EXTRA_HSCOLOUR_FLAGS="--executables --tests"
CABAL_EXTRA_TEST_FLAGS (USER VARIABLE)
User-specified additional parameters passed to 'setup test'. example: /etc/portage/make.conf:
   CABAL_EXTRA_TEST_FLAGS="-v3 --show-details=streaming"
CABAL_DEBUG_LOOSENING
Show debug output for 'cabal_chdeps' function if set. Needs working 'diff'.
CABAL_REPORT_OTHER_BROKEN_PACKAGES ?= yes
Show other broken packages if 'cabal configure' fails. It should be normally enabled unless you know you are about to try to compile a lot of broken packages. Default value: 'yes' Set to anything else to disable.
CABAL_HACKAGE_REVISION ?= 0 (SET BEFORE INHERIT)
Set the upstream revision number from Hackage. This will automatically add the upstream cabal revision to SRC_URI and apply it in src_prepare.
CABAL_PN ?= ${PN} (SET BEFORE INHERIT)
Set the name of the package as it is recorded in the Hackage database. This is mostly used when packages use CamelCase names upstream, but we want them to be lowercase in portage.
CABAL_PV ?= ${PV} (SET BEFORE INHERIT)
Set the version of the package as it is recorded in the Hackage database. This can be useful if we use a different versioning scheme in Portage than the one from upstream
CABAL_P = "${CABAL_PN}-${CABAL_PV}" (GENERATED BY ECLASS)
The combined $CABAL_PN and $CABAL_PV variables, analogous to $P
CABAL_FILE ?= "${S}/${CABAL_PN}.cabal"
The location of the .cabal file for the Haskell package. This defaults to "${S}/${CABAL_PN}.cabal".
CABAL_DISTFILE (GENERATED BY ECLASS)
The name of the .cabal file downloaded from Hackage. This filename does not include $DISTDIR
CABAL_CHDEPS
Specifies changes to be made to the .cabal file. Uses the cabal_chdeps function internally and shares the same syntax.
CABAL_LIVE_VERSION (SET BEFORE INHERIT)
Set this to any value to prevent SRC_URI from being set automatically.
GHC_BOOTSTRAP_PACKAGES
Extra packages that need to be exposed when compiling Setup.hs

AUTHORS

Original author: Andres Loeh <kosmikus@gentoo.org>
Original author: Duncan Coutts <dcoutts@gentoo.org>

MAINTAINERS

Haskell herd <haskell@gentoo.org>

REPORTING BUGS

Please report bugs via https://bugs.gentoo.org/

FILES

haskell-cabal.eclass

SEE ALSO

ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/haskell-cabal.eclass


Index

NAME
DESCRIPTION
SUPPORTED EAPIS
FUNCTIONS
ECLASS VARIABLES
AUTHORS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:27:01 GMT, September 22, 2023