Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file types.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245moduleContext=struct(** ABI V2 is the version 2 of the supported list of ABIs *)moduleAbi_v2=structtypet=|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|Windows_arm64|Windows_arm32[@@derivingeq,ord,enum]letof_string=function|"Android_arm64v8a"->OkAndroid_arm64v8a|"Android_arm32v7a"->OkAndroid_arm32v7a|"Android_x86"->OkAndroid_x86|"Android_x86_64"->OkAndroid_x86_64|"Darwin_arm64"->OkDarwin_arm64|"Darwin_x86_64"->OkDarwin_x86_64|"Linux_arm64"->OkLinux_arm64|"Linux_arm32v6"->OkLinux_arm32v6|"Linux_arm32v7"->OkLinux_arm32v7|"Linux_x86_64"->OkLinux_x86_64|"Linux_x86"->OkLinux_x86|"Windows_x86_64"->OkWindows_x86_64|"Windows_x86"->OkWindows_x86|"Windows_arm64"->OkWindows_arm64|"Windows_arm32"->OkWindows_arm32|s->Error("Unknown v2 ABI: "^s)(** [to_string abi] is the enumeration value of
[abi]; for example ["Linux_x86"]. *)letto_string=function|Android_arm64v8a->"Android_arm64v8a"|Android_arm32v7a->"Android_arm32v7a"|Android_x86->"Android_x86"|Android_x86_64->"Android_x86_64"|Darwin_arm64->"Darwin_arm64"|Darwin_x86_64->"Darwin_x86_64"|Linux_arm64->"Linux_arm64"|Linux_arm32v6->"Linux_arm32v6"|Linux_arm32v7->"Linux_arm32v7"|Linux_x86_64->"Linux_x86_64"|Linux_x86->"Linux_x86"|Windows_x86_64->"Windows_x86_64"|Windows_x86->"Windows_x86"|Windows_arm64->"Windows_arm64"|Windows_arm32->"Windows_arm32"(** [to_canonical_string abi] will give the canonical representation of
the ABI to DkML tools and APIs. *)letto_canonical_string=function|Android_arm64v8a->"android_arm64v8a"|Android_arm32v7a->"android_arm32v7a"|Android_x86->"android_x86"|Android_x86_64->"android_x86_64"|Darwin_arm64->"darwin_arm64"|Darwin_x86_64->"darwin_x86_64"|Linux_arm64->"linux_arm64"|Linux_arm32v6->"linux_arm32v6"|Linux_arm32v7->"linux_arm32v7"|Linux_x86_64->"linux_x86_64"|Linux_x86->"linux_x86"|Windows_x86_64->"windows_x86_64"|Windows_x86->"windows_x86"|Windows_arm64->"windows_arm64"|Windows_arm32->"windows_arm32"letshow=to_stringletppfmtabi=Format.pp_print_stringfmt(showabi)letis_windows=function|Windows_x86_64|Windows_x86|Windows_arm64|Windows_arm32->true|_->falseletis_linux=function|Linux_arm64|Linux_arm32v6|Linux_arm32v7|Linux_x86_64|Linux_x86->true|_->falseletis_darwin=functionDarwin_arm64|Darwin_x86_64->true|_->falseletis_android=function|Android_arm64v8a|Android_arm32v7a|Android_x86|Android_x86_64->true|_->false(** [word_size] is the number of bits in a word for the machine's CPU architecture.
The number of bits will be [32] or [64], but may be something else for
more exotic future architectures. *)letword_size=function|Android_arm64v8a->64|Android_arm32v7a->32|Android_x86->32|Android_x86_64->64|Darwin_arm64->64|Darwin_x86_64->64|Linux_arm64->64|Linux_arm32v6->32|Linux_arm32v7->32|Linux_x86_64->64|Linux_x86->32|Windows_x86_64->64|Windows_x86->32|Windows_arm64->64|Windows_arm32->32letvalues=List.init(max-min+1)(funi->matchof_enum(min+i)withSomev->Somev|None->None)|>List.filter_mapFun.idendtypet={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.
{1 Context Fields}
The following fields are available from the context:
{ul
{- [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 {{:https://www.gnu.org/prep/standards/html_node/Directory-Variables.html} 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.
{e {b 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
{e {b 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:
- {b 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.
}
}
*)end