obazl / tools_opam

Bazel rules for OPAM support
https://obazl.github.io/docs_obazl/
Eclipse Public License 2.0
5 stars 1 forks source link
bazel ocaml opam

OBazl tools_opam

Tools & rules for using OPAM with OBazl

See also:

manpages

You can open them by file path:

$ man ./man/man1/coswitch.1

outdated

summary:

development/testing

In https://github.com/obazl/dev_obazl/toolchains

Run in debug mode:

E.g.

$ bazel run @opam//here/opam:install --@opam//bzl/debug:trace -- -DdVv <pkg>

opam commands

Useful commands:

These commands have lots of options, use --help to see them.

"core" libraries/archives/packages

WARNING OBSOLETE

WARNING In the literature "standard library" is sometimes used to refer to lib/ocaml. Not to be confused with the module Stdlib, "The OCaml Standard Library", which is a namespaced archive (stdlib.cmxa) installed in lib/ocaml.

The standard compiler distribution contains a set of resources (archives, plugins) that the findlib system describes in "special" META files. The packages desribed in these META files refer to files in lib/ocaml; the directory holding the META file contains no Ocaml files. In contrast, most (all?) other META package specs refer to files in the same directory or one of its subdirectories.

Since these are standard, their BUILD.bazel files are predefined by OBazl. That is, they are not generated from the META files by the bootstrapper.

Furthermore we adapt findlib names to make them more idiomatic in Bazel. Where findlib has compiler-libs.X, we have @rules_ocaml//cfg/compiler-libs:X:

The others we also put in the @ocaml namespace:

The stdlib module is always included (and opened) by the compiler, so there is no build target for it.

Threads require special treatment because threading support has changed over the years. ocamlfind has command-line switchs (-mt, -mt_vm, -mt_posix) for threading, but there are no corresponding options for the compilers; building with thread support just requires depending the the threading lib. Support for virtual threads was removed in version X, but threads/META still exposes threads.vm.

OBazl does not support the ocamlfind threading options, eliminates the distinction between posix and vm threads.

The list:

Note that these correspond to archives or subdirs in /lib/ocaml.

Creating a fresh 4.13.0 switch installs the following in ${SWITCHPREFIX}/lib. No findlib META files are installed.

special opam packages

compiler libs