-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Try a new layout for compiler flags for OCaml 4.12.0 (and add 4.12.0~alpha1) #17541
Conversation
Instead of many variants, the compiler is now `ocaml-variants.4.12.0~alpha1`, and the variants are selected using the different `ocaml-options-*` packages. Use `ocaml-options-vanilla` if you want to ensure no special options will be selected, even if some packages depend on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary look through - but thanks for whipping this one up so quickly! ocaml-base-compiler.4.12.0~alpha1
is missing and we don't (yet) have the full suite of ocaml-options-only-
packages.
packages/ocaml-options-flambda-only/ocaml-options-flambda-only.1/opam
Outdated
Show resolved
Hide resolved
Commit: 7cc7d51 As you wish, master! 🌤️ opam-lint warnings 7cc7d51
🌤️ Installability check (+14)
🌤️ 10 ignored non-opam files:
|
opam 2.1 can handle the new 'hidden-version' flag that can more nicely replace this artificial dependency.
Fixed all the trivial issues; not sure yet what to do with The biggest use I think could be through the variables defined by the
of course, this should be fixed if
Another question: do you think we need |
For now, I think we should keep For the |
I agree on keeping About |
Just to be sure, the shortest command line to install the vanilla compiler under the new layout will be opam switch create alpha-testing --packages=ocaml-base-compiler.4.12.0~alpha1 --repositories=default,beta ? |
@Octachron you can do shorter :)
So it could be reduced to
To go the "newer way", that could be instead:
(1 - you will need @dra27 one issue I could see is that if we keep |
The package doesn't exist yet though... alpha/betas used to be under `variants`, do we want to change that ?
For the announcement, I suggest we stick with the opam-2.0 compatible version - it should be the case by the time OCaml 4.13 is branched that 2.1 is out, so we could for that announcement have the shorter 2.1 syntax and then have the 2.0-compatible version as a footnote, but at this stage I think it's more confusing! |
For the |
This won't matter until release time, but we also need to remember that |
…base-compiler esp. for opam 2.0 and for the 'opam switch create NAME VERSION' shortcut
Not strictly required, as since all the options have a post-depend on the proper |
packages/ocaml-variants/ocaml-variants.4.12.0~alpha1+options/opam
Outdated
Show resolved
Hide resolved
The ocaml-config package also needs to be updated to make gen_ocaml_config.ml.in aware of ~, otherwise the installation fails with a version mismatch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted a stray ocaml-compiler
@@ -0,0 +1 @@ | |||
share_root: ["config.cache" {"ocaml/config.cache"}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file needs renaming to ocaml-variants.install
src: "https://github.com/ocaml/ocaml/archive/4.12.0-alpha1.tar.gz" | ||
checksum: "sha256=bee59cb94067410d02f0bc4e7e47e3e878689aabf61e6d2f0cb4316f8563e55d" | ||
} | ||
extra-files: ["ocaml-compiler.install" "md5=3e969b841df1f51ca448e6e6295cb451"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra-files: ["ocaml-compiler.install" "md5=3e969b841df1f51ca448e6e6295cb451"] | |
extra-files: ["ocaml-variants.install" "md5=3e969b841df1f51ca448e6e6295cb451"] |
Another point, installing compiler with opam switch create 4.12.0~alpha1+flambda --packages=ocaml-variants.4.12.0~alpha1+options,ocaml-options-flambda --repo=beta yields a warning with opam 2.07
Should the option packages set this compiler flag for compatibility's sake? Also, I have a patch for ocaml-config, would it help if I sent it as a subpr? |
Oops, sorry - I'd had a discussion with @AltGr offline and not reported the relevant bits back here. I agree that I'd also proposed dra27@7bf0c44 which adds |
Yep, my changes in ocaml-config were equivalent. Are there any blockers left for a release in the beginning of next week? |
I don't believe so, no - just needs @AltGr to push the changes here, if you're happy for this PR to turn into the "OCaml 4.12.0 Alpha1" PR! |
I think it is better to have an early release for this first alpha, and fix any remaining issues in the following alphas. |
Not strictly needed, but that avoids a warning on opam 2.0; they will show up in 'opam switch list-available' though
Indeed, the OCaml configuration script nicely detects |
Removing the conflict is OK because the 3 depend options are mutually exclusive
Thanks, @kit-ty-kate! This PR is supposed to be an incremental step towards an ultimate neat solution so the intention with some of the corners has been to be paranoid about preserving existing use-cases. Thanks to @Octachron's agreement, the idea is to experiment with solely within the non-critical 4.12/4.13 development release packages, so from the OCaml-side we are willing to take a risk and if it turns out it's disastrous for some unforeseen reason then revert later as part of the alpha/beta/rc cycle.
There shouldn't be any breakage - what are you seeing?
I could do with a technical reason. The reason for correcting the semver (i.e. using The inconsistency with
I like this idea!
@AltGr has also commented on this. The ultimate aim if we go with this experiment is that there would no longer be
I don't completely follow - do you mean that
There are
There's no need to block a test in pre-release versions of the package, though. I'm not particularly convinced that concern for a future opam feature needs to block changes to an opam 2.0 repository. Whatever feature is brought in, opam 2.0 is in LTS for longer than that, so either the new feature needs a compatibility story with the existing layout or it needs to be trivially possible to maintain both. The point with this layout - ignoring the |
To match previously existing variants
Note: @camelus rejects the "new broken package: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another pass
packages/ocaml-base-compiler/ocaml-base-compiler.4.12.0~alpha1/opam
Outdated
Show resolved
Hide resolved
packages/ocaml-base-compiler/ocaml-base-compiler.4.12.0~alpha1/opam
Outdated
Show resolved
Hide resolved
packages/ocaml-config/ocaml-config.2/files/gen_ocaml_config.ml.in
Outdated
Show resolved
Hide resolved
packages/ocaml-variants/ocaml-variants.4.12.0~alpha1+options/opam
Outdated
Show resolved
Hide resolved
packages/ocaml-variants/ocaml-variants.4.12.0~alpha1+options/opam
Outdated
Show resolved
Hide resolved
packages/ocaml-base-compiler/ocaml-base-compiler.4.12.0~alpha1/opam
Outdated
Show resolved
Hide resolved
packages/ocaml/ocaml.4.12.0/opam
Outdated
"ocaml-base-compiler" {>= "4.12.0~" & < "4.12.1~"} | | ||
"ocaml-variants" {>= "4.12.0~" & < "4.12.1~"} | | ||
"ocaml-system" {>= "4.12.0" & < "4.12.1~"} | | ||
"metaocaml" {>= "4.12.0~" & < "4.12.1~"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the metaocaml
line go in a separate PR as and when that's moved
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from this one small suggestion, after talking about this change more globally I think this experiment looks good to merge
depends: [ | ||
"ocaml" {= "4.12.0" & post} | ||
"base-unix" {post} | ||
"base-bigarray" {post} | ||
"base-threads" {post} | ||
"ocaml-beta" | ||
"ocaml-beta" {opam-version < "2.1"} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
] | |
"ocaml-option-vanilla" | |
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note it's remained ocaml-options-vanilla
(in plural) - so you depend on "vanilla options" (i.e. no options) rather than "the vanilla option" (which, alas, OCaml does not in fact have 🍦)
I think this is already achieved, though, because of the conflict-class, which prevents ocaml-base-compiler switching to ocaml-variants already, @AltGr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, do we want to move the remaining ocaml-options-*
to their singular counterparts before that? I think it's a bit confusing and potential source of errors to have both.
Apart from that, the request itself isn't a blocker, it's more for the sake of completeness. I don't care about it that much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, indeed, in the case of ocaml-base-compiler
, we have two options:
- Have
ocaml-base-compiler
be just an alias forocaml-variants.x+options
&ocaml-options-vanilla
- Have it stand-alone as before
- (indeed 3: replace
base-compiler
by the version with options, not needing thevariants.x+options
at all. Not right away though)
The two should be equivalent in what you will get in the resulting switch ; my first take was option 1 here, to avoid duplication of the build instruction, but after some thought we decided to be more conservative and keep the stand-alone definition: it's less disruptive to current users of ocaml-base-compiler
.
@dra27 yes, ocaml-variants
and ocaml-base-compiler
are mutually exclusive as before, and all options require variants
so this is not needed; I guess @kit-ty-kate wanted the presence of options-vanilla
to be a reliable marker that you are on the vanilla case; since the ocaml-options-vanilla
package has already been made compatible with ocaml-base-compiler
, there would be no harm in adding this dependency here to that purpose I guess.
Looks alright. Feel free to revert at any point if something is really broken. Thanks! |
This PR is a continuation of #16753 and the general attempt to reduce the number of
ocaml-variants
packages in the repository.It's proposed to test this layout with the 4.12 development releases of OCaml - if successful, there can be further discussion for updating 4.11 and earlier to use the same idea.
What you can now do:
opam 2.1
opam switch create alpha-testing 4.12.0~alpha1
to get the normal compiler release.opam switch create alpha-testing-flambda ocaml-variants.4.12.0~alpha1+options ocaml-option-flambda
to get alpha1 with flambda enabled.opam 2.0
opam repo add beta git+https://github.com/ocaml/ocaml-beta-repository.git
]opam switch create alpha-testing 4.12.0~alpha1 --repos=default,beta
to get the normal compiler release (i.e. you need the beta repository enabled, as in previous releases)opam switch create alpha-testing-flambda --packages=ocaml-variants.4.12.0~alpha1+options,ocaml-option-flambda --repos=default,beta
How it works:
ocaml-base-compiler
is unchanged and, as today, compiles and installs OCaml with default optionsocaml-variants.4.12.0+trunk
package and the newocaml-variants.4.12.0~alpha1+options
packages both allow compiler options to be customised by also installingocaml-options-
packages:ocaml-option-32bit
- 32bit buildocaml-option-afl
- enable AFL supportocaml-option-bytecode-only
- build bytecode compiler onlyocaml-option-default-unsafe-string
- enable unsafe-string by defaultocaml-option-flambda
- enable flambdaocaml-option-fp
- enable frame pointersocaml-option-musl
- use musl instead of libcocaml-option-nnp
- enable no-naked-pointers modeocaml-option-no-flat-float-array
- disable flat float arrays in the runtimeocaml-option-spacetime
(obviously, for 4.12 this option is not available)ocaml-option-static
- no dynamic linkingocaml-options-32bit
andocaml-options-flambda
enables a 32-bit flambda compiler.ocaml-options-vanilla
can be used to makeocaml-variants.4.12.0~alpha1+options
orocaml-variants.4.12.0+trunk
behave likeocaml-base-compiler
. In particular if your base packages (or opam 2.1 switch invariant) includeocaml-options-vanilla
then you can be sure that the compiler will not be altered if you install a package which depends on an option (for example, a package which depends onocaml-options-flambda
will not cause a switch to recompile).~name
instead of+name
. Support for this was added but intentionally not used in 4.11.ocaml-config
needs a small update to support this. In order to prevent lots of switches needing to recompile, this is done inocaml-config.2
which is only available for 4.12.0 onwards.