Attempt to guess correct libdir from current exe #327
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In cases where the libdir computed by
ocamlbuild -where
doesn't contain the expected ocamlbuild library files, attempt to guess an alternative libdir relative to the currently running executable's path (usingSys.executable_name
). If the resulting libdir does contain the expected ocamlbuild library files then a warning is printed and the guessed libdir is used.The motivation for this change is to allow the ocamlbuild (opam) package to be built by dune's package management features. Dune builds opam packages by executing their build and install commands in a temporary sandbox environment, and then copying the resulting artifacts to a final installation path. This creates a problem for ocamlbuild as the
OCAMLBUILD_LIBDIR
variable set at build time will be a path inside the temporary sandbox. That path is then used to compute the value printed byocamlbuild -where
which consequently reports a non-existant path.This is an attempt to satisfy dune's constraint that a package's installed files must work after copying them out of their original install location.
We discussed this a little in #326. This is intended to fix this issue: ocaml/dune#10290.