B0_ocaml
OCaml B0 file support.
A few high-level build units.
val libname : string -> B00_ocaml.Lib.Name.t
libname n
is n
as an OCaml library name. This is shortcut for B00_ocaml.Lib.Name.v
.
val exe : ?wrap:(B0_unit.proc -> B0_unit.proc) -> ?doc:string -> ?meta:B0_meta.t -> ?action:B0_unit.action -> ?requires:B00_ocaml.Lib.Name.t list ->
?name:string -> string -> srcs:B0_srcs.sels -> B0_unit.t
exe n
is a build unit for an executable named n
(without the platform specific extension).
doc
is the unit doc string.meta
is the initial metadata.requires
are the OCaml libraries required to compile the executable.name
is the name of the unit (defaults to n
).srcs
are the executable sources. All files with extension .ml
, .mli
, .c
and .h
are considered for compiling and linking the executable.wrap
allows to extend the build procedure you must call the given build procedure. TODO maybe remove once we have good Build fragments.val lib : ?wrap:(B0_unit.proc -> B0_unit.proc) -> ?doc:string -> ?meta:B0_meta.t -> ?action:B0_unit.action -> ?requires:B00_ocaml.Lib.Name.t list ->
?name:string -> B00_ocaml.Lib.Name.t -> srcs:B0_srcs.sels -> B0_unit.t
lib n ~srcs
is a built unit for a library named l
made of sources src
.
doc
is the unit doc string.meta
is the initial metadata.requires
are the OCaml libraries required to compile the library.name
is the name of the build unit (default to n
with .
substituted by -
)srcs
are the library sources. extension .ml
, .mli
, .c
and .h
are considered for compiling and linking the executable.wrap
allows to extend the build procedure you must call the given build procedure. TODO maybe remove once we have good Build fragments.val conf : B00_ocaml.Conf.t B00.Store.key
conf
is a memo key store with the OCaml configuration.
val version : B0_build.t -> (int * int * int * string option) B00_std.Fut.t
ocaml_version b
gets B00_ocaml
.Tool.Conf.version from conf
.
In a build it is desirable to know which code is being produced because if both are produced the compilers may compete to produce some of the shared build artefacts. The following store keys allow to express build code desires and determine the actual decision. Note the desires may actually be altered units that may build FIXME maybe we should stick to must.
val pp_built_code : built_code B00_std.Fmt.t
pp_built_code
formats built_code
values.
val wanted_code : [ built_code | `Auto ] B00.Store.key
wanted_code
indicates which code should be built, default determines to `Auto
. If `Auto
is used and no unit that may build has specific Meta.needs_code
then `Native
is used if ocamlopt
can be found in the memo environment and `Byte
otherwise.
val built_code : built_code B00.Store.key
build_code
is a memo key indicating the built code. By default determines by consulting wanted_code
.
See TODO.
val tag : unit B0_meta.key
tag
indicates the entity is related to OCaml.
module Meta : sig ... end
Metadata keys
val lib_resolver : B00_ocaml.Lib.Resolver.t B00.Store.key
lib_resolver
is the library resolver used by the build units defined by this module. See default_lib_resolver
for the default.
val default_lib_resolver : B00.Store.t -> B00.Memo.t -> B00_ocaml.Lib.Resolver.t B00_std.Fut.t
default_lib_resolver
determines the default value of lib_resolver
. This resolver does the following:
lib_of_unit
.B00_ocaml.Lib.Resolver.ocamlpath
and B00_ocaml.Lib.Resolver.ocamlfind
using the B0_build.shared_build_dir
directory of the build.val lib_of_unit : B0_build.t -> B00_ocaml.Conf.t -> B0_unit.t -> B00_ocaml.Lib.t option B00_std.Fut.t
lib_of_unit b ocaml_conf u
defines a library from unit u
by consulting Meta.requires
, Meta.library
and Meta.mod_srcs
. As a side effect this B0_build.require
u
.
val lib_resolver_build_scope : B0_build.t -> B00_ocaml.Conf.t -> B00_ocaml.Lib.Resolver.scope
lib_resolver_build_scope b conf
is a library resolver scope for OCaml libraries that can be built in b
. For a unit u
to be recognized as such it has to:
B0_build.may_build
set of b
.Meta.library
and Meta.requires
in its metadata.