ocamlfind
ocamlfind copied to clipboard
Windows build fixes (MSYS2, Cygwin, etc.)
This PR fixes various issues:
-
ocamlfinddoes not build with OCaml 5.0+ on Cygwin (a build failure occurs owing to mishandling of the;inpathin the generation offindlib.conf). (https://github.com/ocaml/opam/pull/6732) - When building on mingw-w64/MSVC with OCaml 5.0+ using MSYS2 for the build environment,
findlib.confis (silently) misgenerated which causes bothocamlfind listandtopfindto fail. (https://github.com/ocaml/opam-repository/issues/28636) -
ocamlfind installcontains an incorrect check forMETA.pkgeven whenmetadiris not in use (which happened to affect the non-opam installation ofnum). - Two minor Windows wrinkles:
-sis not a necessary, nor even always valid, flag tocygpathany more and the technically the legacy command for retrieving the Standard Library is broken on old versions of OCaml.
The opening commits are fairly straightforward. The last commit is fiddly, but enacts the following sequence of changes:
- The generation of
findlib.confis shifted from being a build operation to aconfigureoperation. That requires the tracking of the native / "Unix" version of various path variables inconfigure, but is fundamentally simpler overall, because we only have to worry about escaping the backslashes which physically go intofindlib.confand not also escaping characters which may interfere with an escapingsedexpression! - That allows
tools/patchto be able to assume that it has received a native path (modulo the highly legacy stuff for the MinGW environment, but this probably ought to all be removed). - That then allows various variables which are no longer required the the build to be removed.
Fixes Cygwin failure in https://github.com/ocaml/opam/pull/6732 Closes https://github.com/ocaml/opam-repository/issues/28636
cc @kit-ty-kate (opam), @jmid (opam-repository), @Leonidas-from-XIV (Dune package management)
I can confirm that this fixes the annoying topkg failure on the opam repository :slightly_smiling_face: