[opam-devel] shared directory

Thomas Gazagnaire thomas.gazagnaire at gmail.com
Thu Nov 21 09:27:08 GMT 2013


As Louis and Anil already stated, the symlink-only approach is  bit fragile currently as most of the OCaml binaries are not relocatable (so you need to install them in the right symlink and then you cannot use them outside that path, which means cross-compilation won't work), so we didn't go that way as we though tweaking the PATH was more flexible and portable (don't forget, you have OS and file-systems which do not support symlinks).

An other point, where you can't go without tweaking the PATH anyway is when you use the system compiler: you need to export CAML_LD_LIBRARY_PATH anyway.

I think the right approach for this is to have a "global" switch where you can install everything you want to export in there -- or have a separate OPAM root for this. We can also improve the output of 'opam config var <VAR> --sexp' to remove the \n.

--
Thomas

On 21 Nov 2013, at 01:59, Sean McLaughlin <seanmcl at gmail.com> wrote:

> I'm installing elisp files.  What would you tell the user to put in their .emacs?  
> This is Louis' proposal:
> 
> (setq path-to-opam-shared 
>   (replace-regexp-in-string "\n" "" (shell-command-to-string "opam config var share")))
> 
> It would be nicer to do 
> 
> (setq path-to-opam-shared "~/.opam/current/shared")
> 
> What is opam exec?
> 
> $ opam --version
> 1.1.0
> $ opam exec
> opam: unknown command `exec'
> Usage: opam COMMAND ...
> Try `opam --help' for more information.
> EXIT STATUS 1
> 
> 
> 
> 
> On Wed, Nov 20, 2013 at 7:17 PM, Anil Madhavapeddy <anil at recoil.org> wrote:
> It breaks the nice property that you can start a shell with "opam exec" and have it do the right thing with respect to dependent tools.  If your scripts depend on an environment variable, then they'll work, but a symlink approach isn't quite as flexible.
> 
> Having said that, if people think that the symlink is really convenient and don't care about `opam exec`, I have no objection to a symlink being maintained.
> 
> -anil
> 
> On 20 Nov 2013, at 13:53, Louis Gesbert <louis.gesbert at ocamlpro.com> wrote:
> 
>> Updating a symlink whenever you do `opam switch` wouldn't be too much of a problem indeed. What I am concerned about is that people may start using it from opam, which would break when the OPAMROOT and --root opam options are used.
>>  
>> But perhaps I am being too cautious ? I'm myself using a ~/opam link pointing to ~/.opam/4.01.0 ...
>>  
>> Best,
>> Louis
>> 
>> 
>>  
>> Le lundi 18 novembre 2013 10:17:56 Sean McLaughlin a écrit :
>> > Hi Louis,
>> 
>> 
>> > 
>> > What are the issues to using a symlink?  Couldn't opam switch just move it
>> 
>> 
>> > around?
>> > 
>> > Best,
>> 
>> 
>> > 
>> > Sean
>> > 
>> 
>> > 
>> > On Mon, Nov 18, 2013 at 3:30 AM, Louis Gesbert
>> > <louis.gesbert at ocamlpro.com>wrote:
>> > 
>> > >  Le dimanche 17 novembre 2013 16:54:15 Sean McLaughlin a écrit :
>> 
>> 
>> > >
>> > > > I'm trying to package a library that installs files in share. When I had
>> 
>> 
>> > >
>> > > > only one compiler installed, the %{prefix}% argument sent them to
>> 
>> 
>> > >
>> > > > .opam/system/share. However, when I installed another compiler and made
>> 
>> 
>> > > it
>> > >
>> > > > current, the files went into .opam/4.00.1/share. I am trying to tell the
>> > >
>> > > > user where to find the files. Is there a generic directory where I could
>> > >
>> > > > point the user? Perhaps you could make a symlink 'current' for the
>> > >
>> > > > current compiler?
>> 
>> 
>> > >
>> > >
>> > >
>> 
>> 
>> > > You should use $(opam config var prefix)/share, or even $(opam config var
>> > > share). A symlink could be an option worth considering, but it has its own
>> > > issues.
>> > >
>> 
>> 
>> > >
>> > >
>> > > Best,
>> 
>> 
>> > >
>> > > Louis
>> > >
>> _______________________________________________
>> opam-devel mailing list
>> opam-devel at lists.ocaml.org
>> http://lists.ocaml.org/listinfo/opam-devel
> 
> 
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel
> 
> 
> _______________________________________________
> opam-devel mailing list
> opam-devel at lists.ocaml.org
> http://lists.ocaml.org/listinfo/opam-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/opam-devel/attachments/20131121/c40beae8/attachment.html>


More information about the opam-devel mailing list