ocaml / opam-repository

Main public package repository for opam, the source package manager of OCaml.
https://opam.ocaml.org
Creative Commons Zero v1.0 Universal
509 stars 1.1k forks source link

Install `num.1.5` in findlib directory as well as stdlib #26178

Open Leonidas-from-XIV opened 3 days ago

Leonidas-from-XIV commented 3 days ago

Num does a bit of an unusual thing for findlib packages as it installs into (what it considers) the OCaml stdlib.

This works as long as the stdlib is in %{lib_root}%/ocaml and thus it doesn't findlib to add it to the compiler search path. In the new dune package management %{lib_root}%/ocaml will not point to the ocaml compiler stdlib thus num will not be found unless its installation directory is added to the search path (via findlib or dune or any other mechanism that evaluates META files).

In OCaml 5.0 this is the default already, num is never installed in the stdlib but always into its package folder.

This patch changes the behavior for OCaml 4.x where before num was only installed into the stdlib folder (and didn't need to be stated as dependency) but referencing it via findlib did not hurt to install it in both the stdlib and the package folder.

This way if a package depends on num in the stdlib without referencing num it will find num in the stdlib, but if num is referenced via findlib it will add the package folder to the search path and find either copy.

This patch has been merged upstream, see the discussion at https://github.com/ocaml/num/pull/40 for more details. This patch just backports the change to the latest released num version as future versions of num will come with this change. The next num release might be some time off given num is mostly "done" therefore this patch is meant to bridge the gap and a recommendation from @dra27 who is maintaining num upstream.