Support for c2hs
Bazel

Support for c2hs


c2hs_library

c2hs_library(name, deps, srcs, extra_args, src_strip_prefix, version)

Process c2hs source into a Haskell module.

Attributes

name Name; required

A unique name for this target.

deps List of labels; optional; default is []
srcs List of labels; optional; default is []
extra_args List of strings; optional; default is []

Extra arguments that should be passedto c2hs.

src_strip_prefix String; optional; default is ""

Directory in which module hierarchy starts.

version String; optional; default is ""

Executable version. If this is specified, CPP version macros will be generated for this build.


c2hs_toolchain

c2hs_toolchain(name, c2hs, kwargs)

Declare a Haskell c2hs toolchain.

You need at least one of these declared somewhere in your BUILD files for the chs_library rule to work. Once declared, you then need to register the toolchain using register_toolchains in your WORKSPACE file (see example below).

Examples

In a BUILD file:

c2hs_toolchain(
    name = "c2hs",
    c2hs = "@c2hs//:bin",
)

where @c2hs is an external repository defined in the WORKSPACE, e.g. using:

nixpkgs_package(
    name = "c2hs",
    attribute_path = "haskell.packages.ghc822.c2hs",
)

register_toolchains("//:c2hs")

Attributes

name required

A unique name for the toolchain.

c2hs required

The c2hs executable.

kwargs optional

Common rule attributes. See Bazel documentation.