package dkml-install
Install
Dune Dependency
Authors
Maintainers
Sources
md5=9c2fc122d49103ce9bf513fcc11b443d
sha512=c746d7a4482109c725bfe44542c146914add4d77e8e76556ce0de6e2567683a7ac7dc9909f1252aea7facbcf130153b8e752607a3c44e35b8cfd8ea5d99eb356
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."%{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.