basic haskell DistUtils

Isaac Jones ijones@syntaxpolice.org
Tue, 15 Jul 2003 16:35:11 -0400


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings!

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
system: http://www.syntaxpolice.org/tmp/DistUtils-0.0.1.tgz

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
tools.

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.

peace,

isaac


[1]
- -- 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",
                                                   "GhcPackage.hs"
                        ],
            haskellMainMods=["Setup.lhs"],
            docs          =["etc", "hugsWrap", "examples", "README"]
           }
 
main :: IO ()
main = distUtilsMain toolInfo
- ------------------------------------------------------------

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

iD8DBQE/FGV/BLPTZ7K4MaIRAoB0AKCraBFr9IGzyF3329oCY3oeX7VZaQCfTxlV
6D1zX9yhNsk/TUIza3h3H3w=
=lj7M
-----END PGP SIGNATURE-----