RE: GHC Installation Location

2001-10-29 Thread Simon Marlow


> On Thu, Oct 25, 2001 at 03:18:33 -0700, Ashley Yakeley wrote:
> > At 2001-10-25 03:01, Simon Marlow wrote:
> > 
> > >I've wondered at various times in the past whether there 
> ought to be a
> > >link from /usr/local/includes/ghc to 
> /usr/local/lib/ghc-5.02/includes.
> > 
> > Won't help, my GHC is installed at /usr/lib/ghc-5.02/, 
> exactly where the 
> > Debian package put it. And now that location is hard-coded 
> in my Makefile.
> 
> What about (finally!) adding the `--print-include-path' and
> `--print-library-path' switches to ghc?  That would be a clean
> solution, IMO.
> 
> IIRC, this has been asked for several times in the past, but was never
> implemented.

In 5.00.X you could say 'ghc-pkg --show-package=std
--field=library_dirs' but now in 5.02 this just says "$libdir" because
we made the package.conf file independent of the install location to
solve some problems with installation on Windows.  The value of $libdir
(aka $topdir) is passed to GHC using the -B option, which on Unix
is hardwired into the shell wrapper script 'ghc'.

So we should have an option like '--print-libdir' to get at the value of
$libdir, and then you can find out the locations of the actual libraries
and include files by interrogating ghc-pkg.  ok?

Cheers,
Simon

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC Installation Location

2001-10-25 Thread Mieszko Lis

On Thu, Oct 25, 2001 at 04:45:13PM -0700, Ashley Yakeley wrote:
> >I'm not sure this would be so good when you want to have two versions of ghc
> >installed on the same machine...
> 
> Currently the Debian ghc5 package installs links such as /usr/bin/ghc 
> using the 'alternatives' system. You'd just need to add a 
> /usr/include/ghc one to that alternatives group.

Right, but if all ghcs always use /usr/include/ghc then you can only run the
ghc that is the `current alternative' -- if you try to run the other one, it
will find the wrong libraries (which may or may not work).  So, without root
intervention to change the current alternative, you could still only run
one, which makes having multiple versions installed a lot less useful.  And,
even if ghc itself did not use /usr/include/ghc, your multilingual makefile
would get the wrong includes if you used the non-current-alternative ghc.

-- Mieszko

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: GHC Installation Location

2001-10-25 Thread Ashley Yakeley

At 2001-10-25 03:18, Ashley Yakeley wrote:

>>I've wondered at various times in the past whether there ought to be a
>>link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.
>
>Won't help, my GHC is installed at /usr/lib/ghc-5.02/, exactly where the 
>Debian package put it.

Actually I suppose this means I could write
#include 

At 2001-10-25 09:05, Mieszko Lis wrote:

>I'm not sure this would be so good when you want to have two versions of ghc
>installed on the same machine...

Currently the Debian ghc5 package installs links such as /usr/bin/ghc 
using the 'alternatives' system. You'd just need to add a 
/usr/include/ghc one to that alternatives group.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC Installation Location

2001-10-25 Thread Mieszko Lis

On Thu, Oct 25, 2001 at 11:01:42AM +0100, Simon Marlow wrote:
> I've wondered at various times in the past whether there ought to be a
> link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.

I'm not sure this would be so good when you want to have two versions of ghc
installed on the same machine...

-- Mieszko

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC Installation Location

2001-10-25 Thread Michael Weber

On Thu, Oct 25, 2001 at 03:18:33 -0700, Ashley Yakeley wrote:
> At 2001-10-25 03:01, Simon Marlow wrote:
> 
> >I've wondered at various times in the past whether there ought to be a
> >link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.
> 
> Won't help, my GHC is installed at /usr/lib/ghc-5.02/, exactly where the 
> Debian package put it. And now that location is hard-coded in my Makefile.

What about (finally!) adding the `--print-include-path' and
`--print-library-path' switches to ghc?  That would be a clean
solution, IMO.

IIRC, this has been asked for several times in the past, but was never
implemented.  I guess it would make at least Malcolm's life much
easier for the nhc98 scripts... :)


Cheers,
Michael
-- 
 /~\ ASCII ribbon | inbox, n.:
 \ / campaign |A catch basin for everything you don't want to deal
  X  against  |with, but are afraid to throw away.
 / \ HTML mail|

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: GHC Installation Location

2001-10-25 Thread Malcolm Wallace

> Is there an easy way to get 'ghc' or one of the other binaries to tell me 
> where the GHC installation directory is? I want to put the includes 
> directory in a gcc -I flag in my makefile.

For ghc >= 5.00, but not on Windows:

#!/bin/sh
GHCDIR=`grep '^libdir' ${whichGHC} | head -1 | sed 's/^libdir=.\(.*\)./\1/'`if 
[ ! -d $GHCDIR/imports ]
then GHCDIR=`grep '^TOPDIROPT' ${whichGHC} | head -1 | sed 
's/^TOPDIROPT="*-B\([^";]*\).*/\1/'`
fi
echo $GHCDIR/imports

For ghc < 5.00, including on Windows:

#!/bin/sh
GHCDIR=`grep '^\$libdir=' ${whichGHC} | head -1 | sed 
's/^\$libdir=[^/]*\(.*\).;/\1/'` 
if [ -d $GHCDIR/imports ]
then echo $GHCDIR/imports
elif [ -d $GHCDIR/lib/imports ]
then echo $GHCDIR/lib/imports
echo echo unknown
fi

Regards,
Malcolm

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: GHC Installation Location

2001-10-25 Thread Simon Marlow

> At 2001-10-25 03:01, Simon Marlow wrote:
> 
> >I've wondered at various times in the past whether there 
> ought to be a
> >link from /usr/local/includes/ghc to 
> /usr/local/lib/ghc-5.02/includes.
> 
> Won't help, my GHC is installed at /usr/lib/ghc-5.02/, 
> exactly where the 
> Debian package put it. And now that location is hard-coded in 
> my Makefile.
> 
> >But the usual way around this problem is to use 'ghc' as 
> your C compiler
> >- then the -I flag gets injected automatically.
> 
> GHC didn't seem to want to compile my .cpp file -- instead it 
> quietly and 
> successfully did nothing.

Yes, I guess GHC should really understand C++ file suffixes.

> Also I had to do this:
> 
> extern "C" {
> #include "Rts.h"
> }

Thanks, I'll look into fixing that.

Cheers,
Simon

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: GHC Installation Location

2001-10-25 Thread Ashley Yakeley

At 2001-10-25 03:01, Simon Marlow wrote:

>I've wondered at various times in the past whether there ought to be a
>link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.

Won't help, my GHC is installed at /usr/lib/ghc-5.02/, exactly where the 
Debian package put it. And now that location is hard-coded in my Makefile.

>But the usual way around this problem is to use 'ghc' as your C compiler
>- then the -I flag gets injected automatically.

GHC didn't seem to want to compile my .cpp file -- instead it quietly and 
successfully did nothing. Also I had to do this:

extern "C" {
#include "Rts.h"
}

...which I've recently entered a bug in SourceForge about.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: GHC Installation Location

2001-10-25 Thread Simon Marlow

> Is there an easy way to get 'ghc' or one of the other 
> binaries to tell me 
> where the GHC installation directory is? I want to put the includes 
> directory in a gcc -I flag in my makefile.

On a Unix platform, the 'ghc' wrapper script contains the installation
directory, which is passed as an option to the ghc-5.02 binary proper.
On Windows platforms, there isn't a wrapper - ghc figures out the
install location from the location of its binary.

I've wondered at various times in the past whether there ought to be a
link from /usr/local/includes/ghc to /usr/local/lib/ghc-5.02/includes.
But the usual way around this problem is to use 'ghc' as your C compiler
- then the -I flag gets injected automatically.

Cheers,
Simon

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



GHC Installation Location

2001-10-25 Thread Ashley Yakeley

Is there an easy way to get 'ghc' or one of the other binaries to tell me 
where the GHC installation directory is? I want to put the includes 
directory in a gcc -I flag in my makefile.

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users