Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discussion] New compiler flag scheme #16753

Closed
wants to merge 1 commit into from

Conversation

kit-ty-kate
Copy link
Member

This draft PR attacks several issues in how OCaml compilers are defined in opam-repository:

  1. There is currently no ways of saying "this package isn't compatible with this or that compiler variant (e.g. flambda)". To fix that, the meta-package base-<flag> (e.g. base-flambda) is added. Which allows people to either request or conflict with particular variant of the compiler. cc @emillon
  2. There is currently no ways of combining different flags together other than to define a new ocaml-variant.<ver>+<flag1>+<flag2> package. Given the number of available combinations, this can be tedious and unmaintainable. To fix that, the new base-<flag> meta-packages become a optional dependencies of the ocaml-base-compiler package. This way, one could request a new custom variant this way: opam switch create --packages=ocaml-base-compiler.4.10.0,base-flambda,base-spacetime 4.10+flambda+spacetime. This could be improved in opam itself by adding an optional argument of some kind; something of the sort opam switch create --extra-packages=base-flambda 4.10 4.10.0.
  3. The number and different nature of ocaml-variants packages is hard to maintain, this PR or similar would make them obsolete and only to be used for bigger compiler variants/changes such as metaocaml, betas or 32bits variants.

Currently this PR is only a place for discussion, in no way something ready to be merged.
The current issues with this approach is that I couldn't find a way to add the lack of an optional dependency to the switch invariant, so with this one could install base-flambda without realizing and the next thing they know their whole switch is being recompiled... This is less than ideal. I'd be happy to know if there is any ways of doing something like this while keeping the current behaviour of opam. Maybe this could be done by creating a ocaml-base-compiler.config file, then make the new base-<flag> packages available only if ocaml-base-compiler:<flag-name> is set to true. I'm not sure this works, I'll investigate later. cc @rjbou @AltGr @thomasblanc

@camelus
Copy link
Contributor

camelus commented Jul 4, 2020

Commit: 01573f9

Good to see you Madam.

🌩️ opam-lint errors 01573f9
  • base-afl.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • base-flambda.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • base-frame-pointers.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • base-no-flat-float-array.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • base-no-nativecode.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • base-spacetime.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • base-unsafe-string.base has errors:

    • error 23: Missing field 'maintainer'
    • warning 25: Missing field 'authors'
    • warning 35: Missing field 'homepage'
    • warning 36: Missing field 'bug-reports'
  • These packages passed lint tests: ocaml-base-compiler.4.10.0, ocaml-variants.4.10.0+afl, ocaml-variants.4.10.0+bytecode-only, ocaml-variants.4.10.0+default-unsafe-string, ocaml-variants.4.10.0+flambda+no-flat-float-array, ocaml-variants.4.10.0+flambda, ocaml-variants.4.10.0+fp+flambda, ocaml-variants.4.10.0+fp, ocaml-variants.4.10.0+no-flat-float-array, ocaml-variants.4.10.0+spacetime


☀️ Installability check (+8)
  • these releases can now be installed, well done (2): malfunction.0.2 malfunction.0.2.1
  • new installable packages (6): base-afl.base base-flambda.base base-frame-pointers.base base-no-flat-float-array.base base-no-nativecode.base base-spacetime.base

@Blaisorblade
Copy link
Contributor

@kit-ty-kate can one abuse opam configuration variables as package flags, instead of abusing packages for the job? That's one of the options discussed in #16619... Conversely, I'd like some way to build variants of the Coq package.

@dra27
Copy link
Member

dra27 commented Aug 19, 2020

This is a nice idea. I would possibly word the descriptions slightly differently (perhaps even avoiding the prefix base-) - if you depend on base-afl, you don't state the compiler needs to have been built with AFL support, you'll cause opam to recompile it with AFL support.

base-no-nativecode sticks out a bit. Are there packages which would want to conflict base-no-nativecode as opposed to depend on base-ocamlopt or base-native?

@kit-ty-kate
Copy link
Member Author

Superseded by #17541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants