Cabal-hooks: API for the Hooks build-type

[ bsd3, distribution, library ] [ Propose Tags ] [ Report a vulnerability ]

User-facing API for the Hooks build-type.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 3.14
Change log changelog.md
Dependencies base (>=4.13 && <5), Cabal (>=3.14 && <3.15), Cabal-syntax (>=3.14 && <3.15), containers (>=0.5.0.0 && <0.8), transformers (>=0.5.6.0 && <0.7) [details]
License BSD-3-Clause
Copyright 2023, Cabal Development Team
Author Cabal Development Team <cabal-devel@haskell.org>
Maintainer cabal-devel@haskell.org
Category Distribution
Home page http://www.haskell.org/cabal/
Bug tracker https://github.com/haskell/cabal/issues
Source repo head: git clone https://github.com/haskell/cabal/(Cabal-hooks)
Uploaded by hecate at 2025-01-02T19:55:14Z
Distributions
Downloads 13 total (13 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2025-01-02 [all 1 reports]

Readme for Cabal-hooks-3.14

[back to package description]

Cabal-hooks

This library provides an API for the Cabal Hooks build type.

What is the Hooks build type?

The Hooks build type is a new Cabal build type that is scheduled to replace the Custom build type, providing better integration with the rest of the Haskell ecosystem.

The original specification for the Hooks build type can be found in the associated Haskell Foundation Tech Proposal.

These setup hooks allow package authors to customise the configuration and building of a package by providing certain hooks that get folded into the general package configuration and building logic within Cabal.

Defining a package with custom hooks

To use the Hooks build type, you will need to

  • Update your .cabal file by:

    • using cabal-version >= 3.14,
    • declaring build-type: Hooks,
    • declaring a custom-setup stanza, with a setup-depends field which includes a dependency on Cabal-hooks.
  • Define a Haskell module SetupHooks, which must be placed at the root of your project and must define a value setupHooks :: SetupHooks.

That is, your .cabal file should contain the following

-- my-package.cabal
cabal-version: 3.14
name: my-package
build-type: Hooks

custom-setup
  setup-depends:
    Cabal-hooks >= 0.1 && < 0.2

and your SetupHooks.hs file should look like:

-- SetupHooks.hs
module SetupHooks ( setupHooks ) where

-- Cabal-hooks
import Distribution.Simple.SetupHooks

setupHooks :: SetupHooks
setupHooks = ...
  -- use the API provided by 'Distribution.Simple.SetupHooks'
  -- to define the hooks relevant to your package

Using the API

The Haddock documentation should help you get started using this library's API.