Skip to content

Conversation

@dra27
Copy link
Member

@dra27 dra27 commented Jun 23, 2022

This is an update of #45, compatible with the latest version pushed to ocaml/ocaml#11007. The current proposal is that from OCaml 5.0.0~alpha1, the compiler installs its own META files in directories under the Standard Library directory.

The previous version was not able to guarantee the operation of Dune or opam's ocaml-system because there wasn't a mechanism for reliably determining the location of the compiler's META files. The latest revision proposes that the compiler's META are therefore always installed in the same place, with Dune and ocamlfind using that fact to change their default search paths for packages accordingly.

This PR, therefore:

  • Reverts the addition of the runtime_events META file, since findlib never needs to build it
  • Updates the detection machinery in configure never to generate META files for the compiler for 5.0+
  • Adds the Standard Library directory to the start of path in findlib.conf (unless findlib is configured with -sitelib $(ocamlc -where) as this is then unnecessary)

The last part requires a small tweak for Windows to take advantage of the fact that cygpath knows how to translate PATH-style variables.

@dra27
Copy link
Member Author

dra27 commented Jul 25, 2022

@gerdstolpmann - OCaml 5.0.0~alpha1 is out. Would it be possible to have a 1.9.6 release with this and #54, please?

configure Outdated
# Find out standard library location

ocaml_core_stdlib=`get_stdlib`
ocaml_major="`ocamlc -vnum | cut -f1 -d.`"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ocamlfind also supports old versions of the compiler, the question arises how to figure out the version:

  • -vnum is available since 3.12.0
  • -version is available since 3.06

Maybe:

ocaml_major="`ocamlc -vnum 2>/dev/null | cut -f1 -d.`"
if [ -z "$ocaml_major" ]; then ocaml_major=3; fi     # -vnum was introduced in OCaml-3.12.0 

I am absolutely sure you cannot use ocamlfind with anything before OCaml-3, but it is a bit unclear what the first supported version really is. I am reluctant to remove support for very old versions because ocamlfind is so central in the ecosystem.

@gerdstolpmann
Copy link
Contributor

@dra27 This looks good, just one suggestion for improvement. I can release on this weekend (btw., sorry for the delay, it was a very busy year so far).

Since OCaml 5.0 installs its own
Only the bytes package META file is ever generated for 5.0
OCaml 5.0 ships its own META files which are installed in subdirectories
of the Standard Library. Add the OCaml Standard Library directory to the
path setting in findlib.conf unless findlib is configure'd with
`-sitelib $(ocamlc -where)`
@dra27 dra27 force-pushed the compiler_META_files branch from 57690a7 to 6cbb0fa Compare September 24, 2022 10:20
@dra27
Copy link
Member Author

dra27 commented Sep 24, 2022

No problem at all, @gerdstolpmann! Rebased and updated. findlib hasn't supported OCaml 3.x since 1.8.0 when 23cafe1 introduced a use of String.map (which is a 4.00 stdlib function). I've hardened the configure script as suggested for OCaml 3.x, regardless - and also fixed a typo from an earlier OCaml 5 related change.

findlib has been 3.08+ since findlib 1.1! It's up to you, but 3.08-3.12 can be "re-supported" with these three commits which are in the "old-compilers" branch of my fork:

  • dra27@0875ed7 - removes the use of lazy patterns (which were introduced in OCaml 3.11)
  • dra27@c815a3a - removes the use of String.map and Lazy.from_fun which were both introduced in OCaml 4.00
  • dra27@5c51651 uses the same technique as used for ocamlc -opaque for ocmalopt -g (which was introduced in OCaml 3.10)

@gerdstolpmann
Copy link
Contributor

Nice! I'll apply these patches.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants