[opam-devel] Globally-installed OPAM Packages?
thomas at ocamlpro.com
Fri Sep 6 11:11:58 BST 2013
> Are there any (non-hackish) solutions for this issue in the OPAM world?
Unfortunately not really, so I'm very interested to get your use-cases and your feedback on this.
If what you need is just to not generate binaries and you never need to link your libraries, I guess you can go with a simple scheme where you install host and target library and binaries in different OPAM switches, configure OPAM to use the target env by default and add the host bin directory to your PATH (and path your target compiler to never generate binaries).
opam switch host -alias-of system
opam install PKG1 .... PKGn --switch=host # host libraries and binaries
opam switch target -alias-of <your patched compiler name>
eval `opam config env`
export PATH=$(opam config var bin --switch=host):$PATH
opam install PKG1 ... PKGn # target libraries
I guess it would be annoying as you had to duplicate every package installation on the two switches (using `opam install PKG --switch=host && opam install PKG).
Less hackish solution require to have a whole build system chain (ie. ocamlopt + ocamlfind) which manage cross-compilation well, and I'm afraid we don't have that yet out-of-the box.
More information about the opam-devel