basic haskell DistUtils

Isaac Jones
Tue, 15 Jul 2003 16:35:11 -0400

Hash: SHA1


For those interested in the LibraryInfrastructure project, I'd like
you to take a look at some example source code I wrote (about 650 not
completely beautiful lines) for a haskell-based build and install

BTW, I'm taking suggestions for the name of this project / module.

This is a basic prototype for my vision of a pure haskell based system
for building, installing, & packaging pure haskell stuff (like hunit,
which is included as an example).  This system will, in the future,
act as a wrapper around a more complex build system (there are two
such systems in the works).  Hopefully "DistUtils" can provide extra
targets, like bdist-deb, to such systems for free.

What it does now is build stuff for ghc and make a distribution for
Hugs.  It can create a packages.conf file for ghc registration, and
does something funny for hugs registration (see the README).  I
promise I'll make it do something for nhc soon.  Commands for this
version include "sdist" for a tarball, "install-hugs", "install-ghc",
"register-ghc" etc.

The library author will only have to provide information like [1],
and DistUtils will do the rest.

The module hierarchy is not exactly what I _want_ it to be.  I really
envision something more like [2].

I also envision the "ToolInfo" module to be merged with Ghc's Package
module and hugs and nhc be made to use it (perhaps nhc already does).
DistUtils also provides a means by which applications can easily add
an --toolinfo flag so that other tools can interrogate executable
programs (see the Example example).

So in the long term, I see DistUtils as a module to each of the
Haskell Implementations, including whatever /usr/bin/haskell is.
Users can run ./Setup.lhs which will ask the compilers about
themselves (or read packages.conf to get information about the
compilers or maybe it'll use autoconf or something), then create
possible targets based on the compilers and versions of available

Peter Simons seems to have a lot of ideas for building Haskell code,
and some stuff can definitely be taken from HMake.  Right now we just
do some simple stuff.



- -- Setup.hs
module Main where
import DistUtils.Core
import DistUtils.ToolInfo
toolInfo = (basicPackage (OtherTool "DistUtils") (Version 0 0 1))
           {haskellSources= map ("DistUtils/" ++) ["Info.hs", "Core.hs",
                                                   "Compilers.hs", "ToolInfo.hs",
            docs          =["etc", "hugsWrap", "examples", "README"]
main :: IO ()
main = distUtilsMain toolInfo
- ------------------------------------------------------------

      .distributionMain :: ToolInfo -> IO () -- implements standard functionality
               .SystemConfig { installedPackages  :: [Package],
                               installedCompilers :: [Compiler],
                               defaultCompiler    :: Compiler
               .getSystemConfig :: IO SystemConfig
               .defaultFlags (like --toolInfo)
               .Package {depends      :: [Package],
                         buildDepends :: [Package],
                       .depends      :: [Package] -> Graph Package
                       .buildDepends :: [Package] -> Graph Package
                                 .installedCompilers :: [Compiler]
                                 .defaultCompiler    :: Compiler
                  .dependancies :: [HaskellModule] -> Graph HaskellModule
                  .build :: Package -> Compiler -> IO ()
                  .install  :: Package -> Compiler -> IO ()
                  .register :: Package -> Compiler -> IO ()
                  .export  :: Package -> IO () --put the sources somewhere
                  .sourceDist :: Package -> IO () -- make a tarball
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <>