package dkml-install

  1. Overview
  2. Docs

Context is a module providing a record type for the context.

module Abi_v2 : sig ... end

ABI V2 is the version 2 of the supported list of ABIs

type t = {
  1. path_eval : string -> Fpath.t;
  2. eval : string -> string;
  3. target_abi_v2 : Abi_v2.t;
  4. 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 except needs_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 with eval. However unlike path_eval the eval function will do no path conversions on Windows. In addition eval has templates that are not available in path_eval.

    Templates available to eval but not in path_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-safety ctx.target_abi_v2 will give a Result.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.

OCaml

Innovation. Community. Security.