Libraries in home dir

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Libraries in home dir

Maurí­cio
Hi,

I want to use a few libraries from hackage
and have already download and built them. Can
I install those libraries somewhere in my
home dir (I want to avoid installing as root)
so that ghc can find them?

If so, which options should I give to Setup.hs
(with main=defaultMain) so that the libraries
are going to be copy to that dir?

Thanks,
Maurício

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Libraries in home dir

Dougal Stanton-2
On Thu, Oct 9, 2008 at 2:08 PM, Mauricio <[hidden email]> wrote:

> Hi,
>
> I want to use a few libraries from hackage
> and have already download and built them. Can
> I install those libraries somewhere in my
> home dir (I want to avoid installing as root)
> so that ghc can find them?
>
> If so, which options should I give to Setup.hs
> (with main=defaultMain) so that the libraries
> are going to be copy to that dir?

Dpeending on whether you have (and are using) cabal-install, either

$ cabal install diagrams --prefix=$HOME --user

or

$ runhaskell Setup.lhs configure --prefix=$HOME --user


That will (a) put the libraries etc in $HOME/lib and (b) register
these packages locally.

Hope that helps!


D
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Libraries in home dir

Allan Clark
Hi,

In addition if you want to do this all or most of the time, that is there are few/no cabalised libraries you DO wish to install globally, then you can tell 'cabal' to do this all the time by editing your ~/.cabal/config file. Here is mine:

repos: hackage.haskell.org:http://hackage.haskell.org/packages/archive
cachedir: "/home/<USERNAME>/.cabal/packages"
hackage-username: ""
hackage-password: ""
compiler: ghc
user-install: True
user-prefix: "/home/<USERNAME>/install/"

regards
allan


Dougal Stanton wrote:

> On Thu, Oct 9, 2008 at 2:08 PM, Mauricio <[hidden email]> wrote:
>> Hi,
>>
>> I want to use a few libraries from hackage
>> and have already download and built them. Can
>> I install those libraries somewhere in my
>> home dir (I want to avoid installing as root)
>> so that ghc can find them?
>>
>> If so, which options should I give to Setup.hs
>> (with main=defaultMain) so that the libraries
>> are going to be copy to that dir?
>
> Dpeending on whether you have (and are using) cabal-install, either
>
> $ cabal install diagrams --prefix=$HOME --user
>
> or
>
> $ runhaskell Setup.lhs configure --prefix=$HOME --user
>
>
> That will (a) put the libraries etc in $HOME/lib and (b) register
> these packages locally.
>
> Hope that helps!
>
>
> D
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Libraries in home dir

Bugzilla from alfonso.acosta@gmail.com
In reply to this post by Maurí­cio
On Thu, Oct 9, 2008 at 3:08 PM, Mauricio <[hidden email]> wrote:
> I want to use a few libraries from hackage
> and have already download and built them. Can
> I install those libraries somewhere in my
> home dir (I want to avoid installing as root)
> so that ghc can find them?

Sure, just write:

runhaskell Setup.hs configure --user
--prefix=personal/directory/where/to/install/the/package

--user tells cabal to install the package in the user package-database

You might want to use cabal-install [1] in order to automatize the
insallation of Cabal packages. By default it uses the --user flag and
copies the package files under $HOME/.cabal/.

Important caveat: Make sure to also supply the --user flag when
compiling other packages which depend on your library. Otherwise Cabal
will only look for it in the global package-dabatase and won¡t be able
to find it.

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cabal-install
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Libraries in home dir

Daniel Fischer-4
In reply to this post by Maurí­cio
Am Donnerstag, 9. Oktober 2008 15:08 schrieb Mauricio:
> Hi,
>
> I want to use a few libraries from hackage
> and have already download and built them. Can
> I install those libraries somewhere in my
> home dir (I want to avoid installing as root)
> so that ghc can find them?

runghc ./Setup.hs configure --user --prefix=$HOME
runghc ./Setup.hs build
runghc ./Setup.hs install

I'm afraid you would have to build again to get a correct
$TOP/dist/build/autogen/Paths_${library}.hs
>
> If so, which options should I give to Setup.hs
> (with main=defaultMain) so that the libraries
> are going to be copy to that dir?
>
> Thanks,
> Maurício
>

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Libraries in home dir

Duncan Coutts
In reply to this post by Maurí­cio
On Thu, 2008-10-09 at 10:08 -0300, Mauricio wrote:

> Hi,
>
> I want to use a few libraries from hackage
> and have already download and built them. Can
> I install those libraries somewhere in my
> home dir (I want to avoid installing as root)
> so that ghc can find them?
>
> If so, which options should I give to Setup.hs
> (with main=defaultMain) so that the libraries
> are going to be copy to that dir?

$ cabal instsll xmonad

Does exactly that by default. No other flags are required.


By default it stores files under $HOME/.cabal and registers the packages
in ghc's per-user db. So no special permissions are required.

If you want to change the defaults then you can use command line flags
or edit the $HOME/.cabal/config file.

Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Libraries in home dir

Maurí­cio
>> Hi,
>>
>> I want to use a few libraries from hackage
>> and have already download and built them. Can
>> I install those libraries somewhere in my
>> home dir (...)

> $ cabal instsll xmonad
>
> Does exactly that by default. No other flags are required.
> (...)

Nice. Thanks for all tips. Reading them I understood
defaultMain works like usual 'configure' scripts, and
tried Setup.hs --help, and found the full documentation
I needed.

About cabal: the fact that the last versions of packages
are not available in the pointed place mean I should
not use cabal? For instance, utf8-string is using github.com
instead of the darcs page pointed in its hackage page. Does
that mean the package available in hackage is not the one
I should use?

Thanks,
Maurício

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Re: Libraries in home dir

Duncan Coutts
On Thu, 2008-10-09 at 15:14 -0300, Mauricio wrote:

> About cabal: the fact that the last versions of packages
> are not available in the pointed place mean I should
> not use cabal? For instance, utf8-string is using github.com
> instead of the darcs page pointed in its hackage page. Does
> that mean the package available in hackage is not the one
> I should use?

Hackage is for released packages.

If you want to use the development version instead then you do have to
find where that is hosted, which can be less clear at times (though as
of Cabal-1.6 packages can specify a link to darcs/git repos).

If the homepage for a package is wrong you can contact the maintainer.


Duncan

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe