The build environment controls build tool lookups and spawn
[ `Build_os | `Host_os ]
`Build_osis the OS on which the build tools are executed.
`Host_osis the OS on which the build outcomes are eventually hosted and run.
Most of the time the build OS coincides with the host OS. The build OS does however differ in cross-compiled builds. In this case tool lookup, process environments and configuration needs to be distinguished in case the build system is creating build outcomes to be used by the build system itself.
This happens for example if pre-processors or programs
generating source files are built and used by the build itself.
If these pre-processors also need to be used on the host OS this
lead those units being built twice: once for the build OS and
once for the host OS. Units can specify that
they support only one mode of building, this is mainly used for
programs that are built for the build but are not deployed to
the host OS.
B0.Fpath.t list -> B0.Fpath.t B0.result
The expected semantics is similar to a lookup made in a POSIX
PATH environment variable. Notably if a given path has
B0.Fpath.dir_sep no search should occur and the path be returned
as is. However this is left to the discretion of the entity that
setups the environment.
If no tool can be found the function should return an
intellligible error message that mentions the given tools and
where exactly it was looked up.
val pp_tool_alts :
B0.Fpath.t list B0.Fmt.t
pp_tool_altscan be used as a preamble for reporting failures to lookup tools e.g.
R.error_msgf "%a: Not found in ..." pp_tool_alts tools.
val env_tool_lookup :
?sep:string -> ?var:string -> B0.OS.Env.t -> tool_lookup
env_tool_lookup ~sep ~var envis a tool lookup that gets the value of the
varvariable (defaults to
envand performs a POSIX PATH variable search. Directories in the search path are separated by
val v :
?host_forced_env:B0.OS.Env.t -> B0.OS.Env.t -> t
v ~build_lookup ~build_forced_env ~build_env ~host_lookup ~host_forced_env host_envis an environment with:
host_env, the consulted process environment for tools which aim at producing artefacts for the
host_forced_env, an overriding process environment passed to all tools which aim at producing artefacts for the
host_lookup, the tool lookup function for tools which aim at producing artefacts for the
build_env, the consulted process environment for tools which aim at producing artefacts for the
build_forced_env, an overriding environment passed to all tools which aim at producing artefacts for the
build_lookup, the tool lookup function for tools which aim at producing artefacts for the
build_envis defined explicitely or host_lookup otherwise).
val env :
t -> build_aim -> B0.OS.Env.t
env e aimis
e's consulted process environment for tools runs which aim at producing artefacts for
val forced_env :
t -> build_aim -> B0.OS.Env.t
forced_env e aimis
e's forced process environment for tools which aim at producing artefacts for
val tool :
t -> build_aim -> B0.Fpath.t list -> B0.Fpath.t B0.result
tool e aim toolsis the first file executable which can be found among
toolsfor runs which aim at producing artefacts for