Building GHC 5.02 on Solaris x86
Simon Marlow
simonmar at microsoft.com
Mon Nov 5 12:07:02 EST 2001
> Simon Marlow <simonmar at microsoft.com> writes:
> >
> > Having just looked at the code, it seems we could recover the
> > platform-independentness in the I/O library with just a
> small amount of
> > wrapperage: most of the offending code is in PrelPosix.hsc,
> with a few
> > #const's scattered around PrelHandle and PrelIO, and none of the
> > affected areas are particularly performance-critical.
> >
> > Also needing wrappers are Time, CPUTime, Directory &
> System. I'd say
> > stop there, though - this is purely to make bootstrapping
> on a new OS
> > easier, so we only need to apply the no-tool restriction to
> libraries
> > needed by the compiler.
> >
>
> Good, let's sort this one out. ghc/compiler/ has its fingers
> deep in the pie
> that is hslibs/, so presumably the restriction applies there also?
I would extend it as far as necessary in order to satisfy the
dependencies of a non-GHCi compiler. That means only converting IOExts
from hslibs, I think. net isn't needed, and neither is Readline. I'll
have to be careful with Posix when I rewrite it.
> I'll happily convert some of these files (once I know what
> wrapper story you have in mind); let me know.
That'd be great.
PrelPosix.fdFileSize is a tricky one, because we can't return an Integer
from C land and we can't return an off_t because the size of that is
OS-dependent. Probably we'll have to return an Int64 even though that's
quite ugly. The other functions in PrelPosix shouldn't present too much
of a problem - I imagine most of PrelPosix can be moved into C land
leaving a small Haskell wrapper.
For the #const's, we'll have to do something like this:
something.c
HsInt get_BUFSIZ(void) { return BUFSIZ; }
PrelHandle.hs:
bUFSIZ = unsafePerformIO get_BUFSIZ
foreign import get_BUFSIZ :: IO Int
Directory needs some #const wrappers, and it can get isDirectory from
the I/O library. System is already wrappered. Time will be ugly, but
then it already is. The CPUTime wrapper is probably going to have to
use Int64.
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list