package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.kit/B0_ocaml/index.html
Module B0_ocaml
OCaml B0 file support.
Units
A few high-level build units.
val libname : string -> B00_ocaml.Lib.Name.tlibname 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 ->
?c_requires:B0_std.Cmd.t ->
?requires:B00_ocaml.Lib.Name.t list ->
?name:string ->
string ->
srcs:B0_srcs.sels ->
B0_unit.texe n is a build unit for an executable named n (without the platform specific extension).
docis the unit doc string.metais the initial metadata.c_requiresFIXME hack, something more sensitive should be done. This each of these options are passed as-ccliboptions.requiresare the OCaml libraries required to compile the executable.nameis the name of the unit (defaults ton).srcsare the executable sources. All files with extension.ml,.mli,.cand.hare considered for compiling and linking the executable.wrapallows 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 ->
?c_requires:B0_std.Cmd.t ->
?requires:B00_ocaml.Lib.Name.t list ->
?name:string ->
B00_ocaml.Lib.Name.t ->
srcs:B0_srcs.sels ->
B0_unit.tlib n ~srcs is a built unit for a library named l made of sources src.
docis the unit doc string.metais the initial metadata.c_requiresFIXME hack, something more sensitive should be done. This each of these options are passed as-ccliboptions.requiresare the OCaml libraries required to compile the library.nameis the name of the build unit (default tonwith.substituted by-)srcsare the library sources. extension.ml,.mli,.cand.hare considered for compiling and linking the executable.wrapallows to extend the build procedure you must call the given build procedure. TODO maybe remove once we have good Build fragments.
Build configuration
val conf : B00_ocaml.Conf.t B00.Store.keyconf is a memo key store with the OCaml configuration.
val version : B0_build.t -> (int * int * int * string option) B0_std.Fut.tocaml_version b gets B00_ocaml.Tool.Conf.version from conf.
Generated code
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 B0_std.Fmt.tpp_built_code formats built_code values.
val wanted_code : [ built_code | `Auto ] B00.Store.keywanted_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.keybuild_code is a memo key indicating the built code. By default determines by consulting wanted_code.
Build fragments
See TODO.
Metadata
val tag : unit B0_meta.keytag indicates the entity is related to OCaml.
module Meta : sig ... endMetadata keys
Library resolution
val lib_resolver : B00_ocaml.Lib.Resolver.t B00.Store.keylib_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 B0_std.Fut.tdefault_lib_resolver determines the default value of lib_resolver. This resolver does the following:
- It first looks if the library name is defined by a unit that may be built. If that is the case it creates a library out of that build unit via
lib_of_unit. - It looks into the build environment via
B00_ocaml.Lib.Resolver.ocamlpathandB00_ocaml.Lib.Resolver.ocamlfindusing theB0_build.shared_build_dirdirectory of the build.
val lib_of_unit :
B0_build.t ->
B00_ocaml.Conf.t ->
B0_unit.t ->
B00_ocaml.Lib.t option B0_std.Fut.tlib_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.scopelib_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:
- Be in the
B0_build.may_buildset ofb. - Define the
Meta.libraryandMeta.requiresin its metadata.