[opam-devel] [ocaml-platform] A small script for compiler hackers: create short-lived opam switches out of any git branch

Gabriel Scherer gabriel.scherer at gmail.com
Mon Mar 18 18:03:10 GMT 2013

I think my approach and the "patch" feature fulfill different needs:
the point here is that opam does *not* recompile the sources when
installing the switch. If you only provide an archive and a patch,
opam will have to recompile the sources.
I see my script as useful locally for compiler hackers (make
world.opt, hack a bit, make all to recompile only what's changed, opam
install & test, hack a bit, make all, opam install & test).
On the other side, the "patch" feature is useful if you want to
distribute your patches to less savvy users ("check my new
optimization patchset against your own programs", BER-MetaOCaml,

On Mon, Mar 18, 2013 at 5:41 PM, Wojciech Meyer
<wojciech.meyer at gmail.com> wrote:
> So the idea here was to use command line to quick apply patches and
> test the integrity them after reviewing, but do this in such way I am
> not forced to make the tree full of diffs.
> On other hand maybe Gabriel idea scales better, I agree as we want to
> commit them eventually.
> The idea came to my mind after struggling with testing my patches and
> trying out ocamlbuild on OPAM repo which I did but saying just "make
> world.opt opt.opt install".
> So probably the shell script takes precedence.
> On Mon, Mar 18, 2013 at 4:13 PM, Anil Madhavapeddy <anil at recoil.org> wrote:
>> On 17 Mar 2013, at 14:18, Wojciech Meyer <wojciech.meyer at gmail.com> wrote:
>>> Hi Gabriel,
>>> all is needed for testing ocamlbuild and local patches for the compiler,
>>> thank you.
>>> Other useful thing in general for OPAM would be something like:
>>> opam patch add <ordered list_of_patches>
>>> opam patch reset
>>> then we are able quickly test some local patches without touching
>>> command line and invoking makefiles.
>> Just to clarify this, are you asking for this for the compiler switches,
>> or for packages, or for both?
>> Local patches can be made to work with packages via `opam pin`, although
>> supporting a patch queue model may be useful in the future.
>> Compiler patches don't exist at the moment within OPAM, but I like Gabriel's
>> approach of taking an existing tree (that's, e.g., a git repo) and moving
>> it into the OPAM space.  You can just use the underlying VCS to track your
>> patches and branches without requiring more complexity in OPAM.
>> -anil
>>> Gabriel Scherer <gabriel.scherer at gmail.com> writes:
>>>> As part of the slowly-evolving benchmark work, I have developed a
>>>> script to turn any repository that quacks like an OCaml compiler and
>>>> can run "make world.opt" into an OPAM compiler switch.
>>>>  https://github.com/gasche/opam-compiler-conf
>>>> The intended use case is to change something, recompile what need be,
>>>> get a compiler switch for that, and install one or two packages for
>>>> testing something. You could envision, for example, OPAM being used in
>>>> the internal loop of a bisection process. In this case it is important
>>>> that OPAM does not recompile the compiler on its side (so the usual
>>>> technique of making a tarball of the compiler source and letting OPAM
>>>> do its job from there is not pleasant in that situation); the scripts
>>>> makes use of voodoo OPAM compiler options (thanks to Thomas in
>>>> https://github.com/OCamlPro/opam/pull/519 ) to have it just run "make
>>>> install" each time "opam switch reinstall" is called.
>>>> This is a quick&dirty shell script that works on my machine. No
>>>> guarantee that it will work on yours. It also assumes that the
>>>> version-control system (VCS) used is git, and calls "git branch" to
>>>> infer the name of the compiler switch to use. Eventual patches to
>>>> support other VCSs (or, for example, infer the switch name from the
>>>> directory name) would be welcome.
>>> _______________________________________________
>>> Platform mailing list
>>> Platform at lists.ocaml.org
>>> http://lists.ocaml.org/listinfo/platform

More information about the opam-devel mailing list