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
use DUNE_LIBDIR environent variable #2540
Conversation
This helps me solve the following problem when porting for OpenBSD:
The OCaml libdir on OpenBSD is ``/usr/local/lib/ocaml``.
When creating binary packages the installation is made into a "fake"
root, which results in a libdir like
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
which is constructed from ``PREFIX`` and ``DESTDIR``:
``${DESTDIR}/${TRUEPREFIX}/lib/ocaml``
Now, since the pre-dune era, we set ``OCAMLFIND_DESTDIR`` to
``/usr/local/lib/ocaml`` when building a port, but to
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
when (fake-)installing a port. This is not exactly how a ``DESTDIR`` is supposed to
work, but it did the job.
Now dune actually respects ``DESTDIR`` and will prepend it to
``OCAMLFIND_DESTDIR``, which will then result in
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
during (fake-)installation, which is obviously not what I want.
To solve this I currently need to special treat all ports using dune and
unset ``OCAMLFIND_DESTDIR`` for them.
For me it would be convenient if I could directly configure dune by
environment variables and bypass ocamlfind completely.
This commit accomplishes this only for ``dune install``. It would be nice if
dune would respect ``DUNE_LIBDIR`` for ``dune build``, too.
This may be related to ocaml#1707.
Here's GNU's definition of DESTDIR, LIBDIR, PREFIX and so on:
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
Signed-off-by: Christopher Zimmermann <madroach@gmerlin.de>
Would that mean looking up installed libraries in Regarding the name of the variable, is there something more standard already? Such as just |
|
Fedora has libdir as The deeper problem in Fedora is we can't use You can see how the build/install is done: |
Exactly!
But now that you ask, why doesn't dune simply do The documented behaviour seems to be arbitrary:
If you know where ocamlc is you can call it and ask for the location of the stdlib. This is a better guess for LIBDIR than just doing |
|
You are right that this behaviour is completely arbitrary! I did that because I didn't know what the standard was. I'd welcome the opinion of the experts here :) /cc @bobot who looked at this as well in the past. @rwmjones dune actually has a Regarding opam-installer, it's no longer needed since dune 1.0.0 :) Dune is able to perform installation itself since 1.0.0. |
|
Thanks, I've created a Fedora bug to track changes in packaging: https://bugzilla.redhat.com/show_bug.cgi?id=1740196 |
|
The |
|
Ok. Do you still need this PR then? |
|
no, sorry for the noise. |
|
No worries, useful things came out of it :) |
|
No I don't need it either :-) |
This helps me solve the following problem when porting for OpenBSD:
The OCaml libdir on OpenBSD is
/usr/local/lib/ocaml.When creating binary packages the installation is made into a "fake"
root, which results in a libdir like
/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocamlwhich is constructed from
PREFIXandDESTDIR:${DESTDIR}/${TRUEPREFIX}/lib/ocamlNow, since the pre-dune era, we set
OCAMLFIND_DESTDIRto/usr/local/lib/ocamlwhen building a port, but to/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocamlwhen (fake-)installing a port. This is not exactly how a
DESTDIRis supposed towork, but it did the job.
Now dune actually respects
DESTDIRand will prepend it toOCAMLFIND_DESTDIR, which will then result in/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocamlduring (fake-)installation, which is obviously not what I want.
To solve this I currently need to special treat all ports using dune and
unset
OCAMLFIND_DESTDIRfor them.For me it would be convenient if I could directly configure dune by
environment variables and bypass ocamlfind completely.
This commit accomplishes this only for
dune install. It would be nice ifdune would respect
DUNE_LIBDIRfordune build, too.This may be related to #1707.
Here's GNU's definition of DESTDIR, LIBDIR, PREFIX and so on:
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html