haskell-cabal.eclass
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 onces only used for packages that use
libghcinternally 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 failue workaround.
Symptom: when
./setup haddockis run in abuild-type: Custompackage it might cause cause the test-suite to fail with errors like:<command line>: cannot satisfy -package-id singletons-2.7-3Z7pnljD8tU1NrslJodXmrWorkaround 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.
Exported Phases
-
pkg_setup -
pkg_postrm -
pkg_postinst -
src_compile -
src_test -
src_install -
src_prepare -
src_configure
Functions
- cabal_flag
-
ebuild.sh:use_enable()taken as baseUsage examples:
CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)leads to
--flags=guior--flags=-gui(useflaggui)CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)also leads to
--flags=guior--flags=-gui(useflaggtk) - cabal_chdeps
-
Allows easier patching of
${CABAL_FILE}(${S}/${PN}.cabalby default) dependsAccepts 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
-
Allowes to set contraint to the libraries that are used by specified package
- replace-hcflags <old> <new>
-
Replace the
<old>flag with<new>inHCFLAGS. Accepts shell globs for<old>. The implementation is picked fromflag-o-matic.eclass:replace-flags()
Variables
- CABAL_EXTRA_CONFIGURE_FLAGS (USER VARIABLE)
-
User-specified additional parameters passed to
setup configure.Example
/etc/portage/make.confCABAL_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
setupbinary bootstrap.Example
/etc/portage/make.conf:# to make linking 'setup' faster. GHC_BOOTSTRAP_FLAGS="-dynamic" - 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_chdepsfunction if set. Needs workingdiff. - CABAL_REPORT_OTHER_BROKEN_PACKAGES ?= yes
-
Show other broken packages if
cabal configurefails. It should be normally enabled unless you know you are about to try to compile a lot of broken packages. Default value:yesSet 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_URIand apply it insrc_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
.cabalfile for the Haskell package. This defaults to${S}/${CABAL_PN}.cabal. - CABAL_DISTFILE (GENERATED BY ECLASS)
-
The name of the
.cabalfile downloaded from Hackage. This filename does not include${DISTDIR} - CABAL_CHDEPS
-
Specifies changes to be made to the
.cabalfile. Uses thecabal_chdepsfunction internally and shares the same syntax.CABAL_CHDEPS=( 'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7' 'containers ==0.4.*' 'containers >= 0.4 && < 0.6' ) - CABAL_LIVE_VERSION (SET BEFORE INHERIT)
-
Set this to any value to prevent
SRC_URIfrom being set automatically. - GHC_BOOTSTRAP_PACKAGES
-
Extra packages that need to be exposed when compiling
Setup.hsGHC_BOOTSTRAP_PACKAGES=( cabal-doctest )
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/