You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current state of the install subcommand is currently
unsatisfactory (cf. #250, #372, #202). I promised to improve it, but I
have not delivered the code due to lack of time, and the time needed for understanding the current usage. I perhaps found someone willing to do it, but the design must be set
first. I'm going to edit this comment with the current state of the
design once something is agreed on.
to be able to support opam environnement but also usual
distribution. The place where distribution put files is similar to
opam (standard filesystem hierarchy)
except for /etc and for the ocaml library files.
to keep all the section from opam install file, except misc and with
the addition of ocamllib: ocamllib, lib, libexec, bin, sbin, toplevel, share, share_root , etc, doc, stublibs, man. Supporting misc means to be able
to ask the user if it accept to put files in an unorthodox location and
to understand what is the location given by the developper in the
different environments. Adding ocamllib is needed because linux
distribution put it in /usr/lib/ocaml and not $PREFIX/lib like opam.
So the design is:
install subcommand should work in different layout namely (in
order of precedence):
opam: installed from opam (configure.ml --opam-prefix prefix)
base: use autoconf defaults and options (e.g. /usr/local and --prefix), with the help of ocamlfind for ocaml path
configure of dune (configure.ml) allows to select the
environment:
--opam-prefix $prefix select opam layout at directory $prefix, so for installing package $pkg:
ocamllib, lib, libexec: $prefix/lib/$pkg
bin: $prefix/bin
sbin: $prefix/sbin
toplevel: $prefix/sbin
share: $prefix/share/$pkg
share_root: $prefix/share
etc: $prefix/etc
doc: $prefix/doc/$pkg
stublibs: $prefix/lib/stublibs
man: $prefix/man
if --opam-prefix is not used the base layout is used and the following options could be
used (from configure generated by autoconf):
--prefix=PREFIX install architecture-independent files in PREFIX [/usr/local]
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--libdir=DIR object code libraries [EPREFIX/lib]
--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
--datadir=DIR read-only architecture-independent data [DATAROOTDIR]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
For ocamllib: --ocamllib=DIR ocaml library root [LIBDIR/ocaml/]
or the result of ocamlfind printconf destdir is available.
So for installing package $pkg the layout is:
ocamllib: $OCAMLLIB/$pkg
lib : $LIBDIR/$pkg
libexec: $LIBDIR/$pkg
bin: $BINDIR
sbin: $SBINDIR
toplevel: ??
share: $DATADIR/$pkg
share_root: $DATAROOTDIR
etc: $SYSCONFDIR
doc: $DOCDIR
stublibs: $OCAMLLIB/stublibs
man: $MANDIR
configure of a package dune configure allows to override the
layout with the same options. The choice is written in an sexp file
in _build.
The following options of configure from autoconf are not kept --exec-prefix, --sharedstatedir, --localstatedir, --runstatedir, --includedir, --oldincludedir, --infodir, --localedir, --htmldir, --dvidir, --pdfdir, --psdir. But --includedir could be useful.
When copying file to install to _build, only one layout must be
used for reproductibility. And I think the base layout (with
default directory) is preferable because the sections are more
separated (ocamllib,lib,libexec).
Variable for all the final locations of the sections must be accessible in
jbuild configuration file (e.g. $bindir). Also the local version
(in _build) must be accessible once Configure variable set by jbuilder exec #205 is done.
Same handling of .exe as currently.
Should windows be supported only with opam? Otherwise what are a
good default?
@Andily (for debian), @AltGr (for opam), @dra27 (for windows) what do
you think of that?
which isn't as straight forward as one would wish for... Probably I've missed some opportunities to optimize this, but in order to make this more manageable, the DESTDIR feature is crucial, and creating any missing directories another.
As a packager, the DESTDIR feature is most important. As you can see from the snippet above, all used paths have to be specified in order to get opam-installer to install into another destination. Hence, a packager needs to determine, which paths are needed.
Most useful would be an install command like:
%install
DESTDIR=%{buildroot} jbuilder install
or variations thereof.
The rest of the proposition looks reasonable from my POV, but beware, I'm not that deep into the ocaml specific installation details, sorry.
Okay. It would still be helpful to spec out dune configure separately I think however. It doesn't look as nice when open proposals are partially implemented.
Hi @glondu, since you packaged dune for debian do you have any comment on this proposition which could touch the way packages that use dune are packaged?
Yes, this ticket is quite confusing and I'm not sure which parts are still relevant. I also vote to close and create a new issue with the relevant points
Yes, this ticket is quite confusing and I'm not sure which parts are still relevant. I also vote to close and create a new issue with the relevant points
Actually I was wrong on my analysis, this issue is still pretty much relevant, as of today some of the ideas here are needed, otherwise dune install can't work for Debian systems, see for example #4723
Note that we committed a quick fix for 2.9 in #4744 , by adding support for etcdir and docdir, this helps quite a bit as it solves (I believe) all issues with Debian packages, but there was a TODO in such PR that was left for 3.0:
How about we just treat all directories the same way and make them all overridable? e.g. share. I don't see the downsides of doing this, and the upside is that it's one less thing to remember for users. It's rather annoying to maintain a map in your head between overridable directories and versions of dune.
This wasn't done as in the PR as backporting to 2.9 would have been tricky.
We've had more recent changes in this department so it's worth revisiting where we stand with the rest of the team. @bobot could you let us know where things stand at the next meeting?
If anybody would have a problem with bringing up dune on the system where there no exept working compiler (like loongarch64), here the commands which allow install dune globaly.
This issue doesn't seem to get more traction anymore. According to the comments above and the changes made, we consider it as done. Feel free to reopen if you think this is relevant 👍
Activity
bobot commentedon Apr 6, 2018
The main goals are:
opamenvironnement but also usualdistribution. The place where distribution put files is similar to
opam (standard filesystem hierarchy)
except for
/etcand for the ocaml library files.DESTDIRfeature out-of-the-box.miscand withthe addition of
ocamllib:ocamllib,lib,libexec,bin,sbin,toplevel,share,share_root,etc,doc,stublibs,man. Supportingmiscmeans to be ableto ask the user if it accept to put files in an unorthodox location and
to understand what is the location given by the developper in the
different environments. Adding
ocamllibis needed because linuxdistribution put it in
/usr/lib/ocamland not$PREFIX/liblike opam.So the design is:
installsubcommand should work in different layout namely (inorder of precedence):
opam: installed from opam (configure.ml --opam-prefix prefix)base: use autoconf defaults and options (e.g./usr/localand--prefix), with the help of ocamlfind for ocaml pathconfigure of
dune(configure.ml) allows to select theenvironment:
--opam-prefix $prefixselectopamlayout at directory$prefix, so for installing package$pkg:ocamllib,lib,libexec:$prefix/lib/$pkgbin:$prefix/binsbin:$prefix/sbintoplevel:$prefix/sbinshare:$prefix/share/$pkgshare_root:$prefix/shareetc:$prefix/etcdoc:$prefix/doc/$pkgstublibs:$prefix/lib/stublibsman:$prefix/man--opam-prefixis not used thebaselayout is used and the following options could beused (from
configuregenerated byautoconf):--prefix=PREFIXinstall architecture-independent files in PREFIX[/usr/local]--bindir=DIRuser executables[EPREFIX/bin]--sbindir=DIRsystem admin executables[EPREFIX/sbin]--libexecdir=DIRprogram executables[EPREFIX/libexec]--sysconfdir=DIRread-only single-machine data[PREFIX/etc]--libdir=DIRobject code libraries[EPREFIX/lib]--datarootdir=DIRread-only arch.-independent data root[PREFIX/share]--datadir=DIRread-only architecture-independent data[DATAROOTDIR]--mandir=DIRman documentation[DATAROOTDIR/man]--docdir=DIRdocumentation root[DATAROOTDIR/doc/PACKAGE]For
ocamllib:--ocamllib=DIRocaml library root[LIBDIR/ocaml/]or the result of
ocamlfind printconf destdiris available.So for installing package
$pkgthe layout is:ocamllib:$OCAMLLIB/$pkglib:$LIBDIR/$pkglibexec:$LIBDIR/$pkgbin:$BINDIRsbin:$SBINDIRtoplevel: ??share:$DATADIR/$pkgshare_root:$DATAROOTDIRetc:$SYSCONFDIRdoc:$DOCDIRstublibs:$OCAMLLIB/stublibsman:$MANDIRconfigure of a package
dune configureallows to override thelayout with the same options. The choice is written in an sexp file
in
_build.The following options of
configurefrom autoconf are not kept--exec-prefix,--sharedstatedir,--localstatedir,--runstatedir,--includedir,--oldincludedir,--infodir,--localedir,--htmldir,--dvidir,--pdfdir,--psdir. But--includedircould be useful.When copying file to install to
_build, only one layout must beused for reproductibility. And I think the
baselayout (withdefault directory) is preferable because the sections are more
separated (
ocamllib,lib,libexec).Variable for all the final locations of the sections must be accessible in
jbuild configuration file (e.g.
$bindir). Also the local version(in
_build) must be accessible once Configure variable set byjbuilder exec#205 is done.Same handling of
.exeas currently.Should windows be supported only with opam? Otherwise what are a
good default?
@Andily (for debian), @AltGr (for opam), @dra27 (for windows) what do
you think of that?
frispete commentedon Jun 4, 2018
Thanks @dra27 for pointing me to this place.
I would like to give you some real world inspiration to the problem.
Here here two projects, which were ported to dune lately:
https://build.opensuse.org/package/show/home:frispete:ocaml/ocaml-gapi
https://build.opensuse.org/package/show/home:frispete:ocaml/google-drive-ocamlfuse
The spec files define typical rpm package builds.
An attempt to use
jbuilder installfailed completely due to current limitations. I came up with:which isn't as straight forward as one would wish for... Probably I've missed some opportunities to optimize this, but in order to make this more manageable, the DESTDIR feature is crucial, and creating any missing directories another.
bobot commentedon Jun 12, 2018
Thanks @frispete for this post-mortem analysis and the pointers. Do you think the current proposition will work for rpm package?
frispete commentedon Jun 12, 2018
As a packager, the DESTDIR feature is most important. As you can see from the snippet above, all used paths have to be specified in order to get opam-installer to install into another destination. Hence, a packager needs to determine, which paths are needed.
Most useful would be an install command like:
or variations thereof.
The rest of the proposition looks reasonable from my POV, but beware, I'm not that deep into the ocaml specific installation details, sorry.
rgrinberg commentedon Jul 30, 2018
I'm closing this ticket as diml already implemented most of this. The only thing that remains is the
DESTDIRenv var which already has its own ticket.rgrinberg commentedon Jul 30, 2018
Okay. It would still be helpful to spec out dune configure separately I think however. It doesn't look as nice when open proposals are partially implemented.
bobot commentedon Aug 21, 2018
Hi @glondu, since you packaged dune for debian do you have any comment on this proposition which could touch the way packages that use dune are packaged?
ArchangeGabriel commentedon Nov 25, 2018
The proposal is not even fully respected currently, e.g:
DATAROOTDIRis apparently set toPREFIXonly, and I still have to fix it on my side.But we have great progress now with
DESTDIRbeing supported. :)ejgallego commentedon Apr 28, 2021
It seems to me that most of this is solved by various advances in the codebase, I propose we close this issue and keep #3978 open for now.
rgrinberg commentedon Apr 30, 2021
Yes, this ticket is quite confusing and I'm not sure which parts are still relevant. I also vote to close and create a new issue with the relevant points
ejgallego commentedon Jun 11, 2021
Actually I was wrong on my analysis, this issue is still pretty much relevant, as of today some of the ideas here are needed, otherwise
dune installcan't work for Debian systems, see for example #4723ejgallego commentedon Jun 18, 2021
Note that we committed a quick fix for 2.9 in #4744 , by adding support for
etcdiranddocdir, this helps quite a bit as it solves (I believe) all issues with Debian packages, but there was a TODO in such PR that was left for 3.0:This wasn't done as in the PR as backporting to 2.9 would have been tricky.
rgrinberg commentedon May 15, 2022
We've had more recent changes in this department so it's worth revisiting where we stand with the rest of the team. @bobot could you let us know where things stand at the next meeting?
kant2002 commentedon Feb 1, 2023
If anybody would have a problem with bringing up dune on the system where there no exept working compiler (like loongarch64), here the commands which allow install dune globaly.
I can submit PR to README, but if this would be implemented, that's would be no-op, since command lines would work.
maiste commentedon Jan 28, 2025
This issue doesn't seem to get more traction anymore. According to the comments above and the changes made, we consider it as done. Feel free to reopen if you think this is relevant 👍