package dkml-install
Install
Dune Dependency
Authors
Maintainers
Sources
md5=5b294da54e4474f8d260c7190fec8c85
sha512=33274eafb995b4ba9d1bdb05e63b466e621255155fe5c6df7f368b086e6658634eff07079a51c0501cd1ab6817ba637f3222a00e146b8c360e24b7488ca66b63
doc/dkml-install.api/Dkml_install_api/Context/index.html
Module Dkml_install_api.Context
Source
Context
is a module providing a record type for the context.
type t = {
path_eval : string -> Fpath.t;
eval : string -> string;
target_abi_v2 : Abi_v2.t;
log_config : Log_config.t;
}
t
is the record type for the context.
Context Fields
The following fields are available from the context:
ctx.path_eval "/some/path/expression"
Evaluates the given path expression, resolving any templates embedded in the expression. You may use slashes ("/") even on Windows; the evaluation of the expression will convert the path into native Windows (ex. C:\Program Files) or Unix format (ex. /usr/local/share).
An example expression is
"%{ocamlrun:share}%/generic/bin/ocamlrun"
which would be the location of ocamlrun.exe within the staging files directory.Templates:
"%{prefix}%"
is the absolute path of the final installation directory. If you are following GNU directory standards, you should populate"%{prefix}%"
with subdirectories "bin/", "share/", etc."%{archive}%"
is the absolute path of the staging files directory."%{tmp}%"
is the absolute path to a temporary directory unique to the component that is currently being installed. No other component will use the same temporary directory."%{_:share-generic}%"
is the absolute path to the ``generic`` Staging Files directory of the component currently being installed."%{_:share-abi}%"
is the absolute path to the ``<abi>`` Staging Files of the component currently being installed, where ``<abi>`` is the ABI currently being installed
More templates available to all
ctx
exceptneeds_admin ctx
:"%{COMPONENT_NAME:share-generic}%"
is the absolute path to the ``generic`` Staging Files of the named component. Only COMPONENT_NAMEs that are transitive dependencies of the currently-being-installed component will be resolved."%{COMPONENT_NAME:share-abi}%"
is the absolute path to the ``<abi>`` Staging Files of the named component, where ``<abi>`` is the ABI currently being installed
Only COMPONENT_NAMEs that are transitive dependencies of the currently-being-installed component will be resolved.
Usually the staging files include a bytecode executable to run a component's installation logic.
Variations:
- Staging Files: When dkml-install-runner.exe is run with the
"--staging-files DIR"
option then the staging directory is simply"<DIR>/<COMPONENT_NAME>"
. During an end-user installation the"--staging-files DIR"
option is automatically used. When dkml-install-runner.exe is run with the"--opam-context"
option then the staging directory is"$OPAM_SWITCH_PREFIX/share/dkml-component-<COMPONENT_NAME>/staging-files"
. You can use the"--opam-context"
option to test your components in an Opam environment.
ctx.eval "/some/expression"
Evaluates the given expression, resolving any templates embedded in the expression.
An example expression is
"%{components:all}%"
.All templates that are available with
path_eval
are available witheval
. However unlikepath_eval
theeval
function will do no path conversions on Windows. In additioneval
has templates that are not available inpath_eval
.Templates available to
eval
but not inpath_eval
:"%{name}%"
is the name of the component currently being installed"%{components:all}%"
is the space separated names of the components that are or will be installed
ctx.target_abi_v2
The ABI for the end-user's machine from the list of V2 ABIs. You cannot rely on inspecting the OCaml bytecode interpreter since the interpreter is often compiled to 32-bit for maximum portability. When more ABIs are supported they will go into a future
ctx.host_abi_v3
or later; for type-safetyctx.target_abi_v2
will give aResult.Error
for those new ABIs.Values for the V2 ABI include:
* Android_arm64v8a * Android_arm32v7a * Android_x86 * Android_x86_64 * Darwin_arm64 * Darwin_x86_64 * Linux_arm64 * Linux_arm32v6 * Linux_arm32v7 * Linux_x86_64 * Linux_x86 * Windows_x86_64 * Windows_x86
ctx.log_config
The logging configuration. See the Logging section of
Dkml_install_api
for how to use it.