Using system OCaml
copy opened this issue · 4 comments
I'd like to use opam-bundle to distribute some command line tools to non OCaml users. It works quite well for that purpose, but I consider it wasteful to bundle and compile the OCaml compiler. Could an option be added to assume the target system has a working and compatible OCaml version installed? I think this is reasonable to expect from users, since OCaml can be installed from the package manager on most distributions.
By the way, very nice piece of software. I tested it on gdbprofiler and it immediately worked out of the box. This will be super-useful to distribute OCaml programs to non OCaml users.
Thanks for the suggestion. It wouldn't be very easy to change, since ocaml
is part of the bootstrapping process, but would certainly be useful.
Is it possible to just delete a bunch of code from bootstrap.sh and make this work? Is there any code not in bootstrap.sh related to this? @AltGr
You would probably want to remove the creation of the specific ocaml-bootstrap
compiler package from opamBundleMain.ml
, and its usage in configure.sh
, and let opam use the normal ocaml-system
package instead. Not including ocaml's source would also be an improvement for this case.
Another possibility would be to keep the full bundle, but offer the option to use the system compiler, if any. Since opam
supports that in normal usage, it should be doable; but in this context we need to be extra careful so that the bundle remains robust to most environments.
Also be careful that we need OCaml to bootstrap opam itself first, which implies that:
- we need at least OCaml 4.02.3 on the system
- we need to duplicate opam's detection of the system OCaml, in a reliable way, from the initial shell scripts
Another issue is that the packages chosen may have constraints on the versions of OCaml they require: by bundling a specific version we are also avoiding possible failures at install time here.
Maybe it could be an option at the "bundle extraction time": don't compile the included compiler
but use the one found on the path.
It is interesting indeed because this will significantly reduce the installation time of a bundle
(people would probably use the ocaml version that is binary-packaged for their distro).
However, I guess this makes for a less portable bundle.