[ANN] opam-compiler 0.1.0


On behalf of the opam maintainers, I’d like to announce the first release of opam-compiler, a plugin to work with compiler variants, branches and forks.

This can cover a pretty wide range of use cases, so the first version is starting small with a single command to create a switch from a branch or github PR:

% opam compiler create '#9921'
Opam plugin "compiler" is not installed. Install it on the current switch? [Y/n] y


<><> Carrying on to "opam compiler create #9921" ><><><><><><><><><><><><><><><>

[ocaml-variants.4.12.0+trunk+no-flat-float-array] synchronised from git+https://github.com/gasche/ocaml#Atomic.create
ocaml-variants is now pinned to git+https://github.com/gasche/ocaml#Atomic.create (version 4.12.0+trunk)
% opam switch
→  ocaml-ocaml-9921                            
          [opam-compiler] ocaml/ocaml#9921 - stdlib: rename Atomic.make into Atomic.create

You can also override the arguments passed to --configure.

As you can see in the above snippet, it’s an opam plugin so it will auto-install if needed (assuming you ran opam update recently) and will be available across all switches. Its sources and issue tracker are available here.

For the next releases, our plan is to add a user-friendly way to setup a switch based on a local git clone, so that it’s easy to test your compiler fork with opam packages. You can find the other features we’d like to add in the future in the relevant part of the opam roadmap.

Thanks and have fun compiling compilers!


Thanks for the nice work!

Currently, if I understand correctly, the plugin makes it easy to create a new switch from a given PR on the github repository. I’m not sure from the documentation whether I will get a “local switch”, or a new switch in my global root.

This sounds convenient and ideal for people who want to test a PR authored by someone else. (Previously people wanting feedback on their PR would build a separate opam repository with a proposed switch, and this was fairly cumbersome.)

On the other hand, currently the plugin (at least the documented features) is not so useful for someone developing on a branch of the compiler. For those use-cases, using the in-compiler opam files (plus pinning / local install), as documented in the compiler’s HACKING.adoc file, is more appropriate.

1 Like

By default, you get a global switch with an “automatic” name - something like ocaml-ocaml-pr1234, but you can pass --switch $NAME to override this. In particular, if you pass --switch . it will create a local switch in the current directory. I’ll update the documentation to add this.

That is correct, these features are for next releases. The goal of this plugin is to wrap the opam files and commands you’re referring to under a high-level interface.

Boy howdy, it does exactly what it says on the tin! I wanted to create a switch with a -minor- change to the 4.10.0 compiler, and … it was precisely as easy as described in opam compiler create --help. Yowza, so nice!

Thank you for this!

Glad you like it! Please reach out if you have some use cases that are a bit too complicated with the current tooling.