
New patches:

[Do proper pre-processing for Haddock 2
David Waern <davve@dtek.chalmers.se>**20071109162557
 Besides pre-processing, this patch adds include paths and output paths
 to the ghc flags passed to Hadddock.
] {
hunk ./Distribution/Simple/Build.hs 46
-	build, makefile
+	build, makefile, initialBuildSteps
hunk ./Distribution/Simple/Haddock.hs 61
+import Distribution.Simple.Build (initialBuildSteps)
hunk ./Distribution/Simple/Haddock.hs 78
-import Control.Monad (liftM, when, join)
+import Control.Monad (liftM, when, unless, join)
hunk ./Distribution/Simple/Haddock.hs 80
-import Data.List     (nub)
hunk ./Distribution/Simple/Haddock.hs 81
+import Data.List     (nub)
hunk ./Distribution/Simple/Haddock.hs 120
-    let mockAll bi = mapM_ (mockPP ["-D__HADDOCK__"] bi tmpDir)
hunk ./Distribution/Simple/Haddock.hs 127
+
+    let mockFlags
+          | isVersion2 = []
+          | otherwise  = ["-D__HADDOCK__"]
+
+    let mockAll bi = mapM_ (mockPP mockFlags bi tmpDir)
+
hunk ./Distribution/Simple/Haddock.hs 196
-    let haddock2options bi = if isVersion2
-          then ("-B" ++ ghcLibDir) : map ("--optghc=" ++) (ghcSimpleOptions lbi bi)
+    let haddock2options bi preprocessDir = if isVersion2
+          then ("-B" ++ ghcLibDir) : map ("--optghc=" ++) (ghcSimpleOptions lbi bi preprocessDir)
hunk ./Distribution/Simple/Haddock.hs 200
+    when isVersion2 $ initialBuildSteps pkg_descr lbi verbosity suffixes
+
hunk ./Distribution/Simple/Haddock.hs 204
-        inFiles <- getModulePaths lbi bi (exposedModules lib ++ otherModules bi)
-        mockAll bi inFiles
+            modules = exposedModules lib ++ otherModules bi
+        inFiles <- getModulePaths lbi bi modules
+        unless isVersion2 $ mockAll bi inFiles
hunk ./Distribution/Simple/Haddock.hs 213
-        let outFiles = replaceLitExts inFiles
+        let targets
+              | isVersion2 = modules
+              | otherwise  = replaceLitExts inFiles
hunk ./Distribution/Simple/Haddock.hs 231
-                 ++ haddock2options bi
-                 ++ outFiles
+                 ++ haddock2options bi (buildDir lbi)
+                 ++ targets
hunk ./Distribution/Simple/Haddock.hs 250
-        let outFiles = replaceLitExts inFiles
+        let targets
+              | isVersion2 = srcMainPath : otherModules bi
+              | otherwise = replaceLitExts inFiles
+        let preprocessDir = buildDir lbi </> exeName exe </> exeName exe ++ "-tmp"
hunk ./Distribution/Simple/Haddock.hs 263
-                 ++ haddock2options bi
-                 ++ outFiles
+                 ++ haddock2options bi preprocessDir
+                 ++ targets
hunk ./Distribution/Simple/Haddock.hs 290
-ghcSimpleOptions :: LocalBuildInfo -> BuildInfo -> [String]
-ghcSimpleOptions lbi bi
+ghcSimpleOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
+ghcSimpleOptions lbi bi mockDir
hunk ./Distribution/Simple/Haddock.hs 293
-  ++ ["-i" ++ autogenModulesDir lbi]
-  ++ ["-i" ++ l | l <- nub (hsSourceDirs bi)]
hunk ./Distribution/Simple/Haddock.hs 294
+  ++ ["-i"]
hunk ./Distribution/Simple/Haddock.hs 296
+  ++ ["-i" ++ autogenModulesDir lbi]
+  ++ ["-i" ++ l | l <- nub (hsSourceDirs bi)]
+  ++ ["-i" ++ mockDir]
+  ++ ["-I" ++ dir | dir <- includeDirs bi]
+  ++ ["-odir", mockDir]
+  ++ ["-hidir", mockDir]
}

Context:

[fix compilation with GHC 6.2.x
Simon Marlow <simonmar@microsoft.com>**20071105113004] 
[Install the haddock interface file to the right place
Ian Lynagh <igloo@earth.li>**20071030170254] 
[Add an interfacedir configure flag, for where to put haddock insterface files
Ian Lynagh <igloo@earth.li>**20071029174908] 
[put the binary-dist copy in the right place
Simon Marlow <simonmar@microsoft.com>**20071026132515] 
[fix $(TOP)
Simon Marlow <simonmar@microsoft.com>**20071026101915] 
[fix XML (at least, makes it work here)
Simon Marlow <simonmar@microsoft.com>**20071026101907] 
[no longer need to pass --allow-missing-html to haddock
Ross Paterson <ross@soi.city.ac.uk>**20071026084124
 
 This option only affects Haddock if it is invoked with --use-package,
 and Cabal no longer uses that option, as it now gets the arguments for
 --read-interface from ghc-pkg directly (cf patch "rejig location of
 package interfaces for haddock").
] 
[no longer need to pass --ghc-pkg to haddock
Ross Paterson <ross@soi.city.ac.uk>**20071026073126
 
 Haddock only runs ghc-pkg if invoked with --use-package, and Cabal no
 longer uses that option, as it now gets the arguments for --read-interface
 from ghc-pkg directly (cf patch "rejig location of package interfaces
 for haddock").
] 
[fix help text (--PROG-arg is now --PROG-option)
Ross Paterson <ross@soi.city.ac.uk>**20071026001045] 
[Adjust verbosity of a step in configure
Duncan Coutts <duncan@haskell.org>**20071024160758] 
[Compile a .c rather than a .hs file to make a .o file in ld -x configure test
Duncan Coutts <duncan@haskell.org>**20071024150505
 Since when bootstrapping ghc we're not in any position to compile .hs files
 that easily.
] 
[Create the dist/ dir early in the configuration process
Duncan Coutts <duncan@haskell.org>**20071024133554] 
[Create temp files in dist, since it is now guaranteed to exist
Duncan Coutts <duncan@haskell.org>**20071024102850] 
[Regenerate GHC/Makefile.hs from GHC/Makefile.in
Duncan Coutts <duncan@haskell.org>**20071023183804] 
[Only use ld -x on systems where ld supports that.
Duncan Coutts <duncan@haskell.org>**20071023183738
 Hopefully this fixes it for both ordinary builds and via ghc makefiles.
] 
[pass cpp-options to cpphs
Ross Paterson <ross@soi.city.ac.uk>**20071023184210] 
[Refuse to run any commands if the .cabal has been modified
Simon Marlow <simonmar@microsoft.com>**20071023093111
 See GHC bug #1372
 This is a consistency check, intended to prevent this class of build
 failures:
 
    * Package P is updated, its version number is bumped, the
      new version is compiled and installed.
 
    * Package Q depends on P.  Q is modified to use the new P, and Q's
      .cabal file is updated with changes to the build-depends field to
      depend on the new version of P.
 
    * The user has an old build of Q.  They pull the changes to Q and
      'setup build' without cleaning or re-configuring.  Build errors
      ensue, because the code of Q depends on changes to P's API, and
      we're still building against the old P.
 
 Note that you can't get segfaults this way, only build errors.
 
 This also relies on some new consistency checking in GHC 6.8 to work
 properly.  If the user re-configures their Q build and then issues
 'setup build' without cleaning, GHC must now realise that the package
 flags have changed, and re-compile all the affected Q modules.  GHC
 6.6 would not do this, but 6.8 does.
] 
[Be explicit about the base version dependency
Duncan Coutts <duncan@haskell.org>**20071023122417
 don't just leave it up to the default search order
] 
[typo in comment
Ross Paterson <ross@soi.city.ac.uk>**20071022091235] 
[Fix a bug in the Unlit pre-processor
David Waern <davve@dtek.chalmers.se>**20071024181908
 With this patch, unlit can handle line pragmas with filenames that contain
 spaces.
] 
[Correct the spelling of mingw32 in os alias list
Duncan Coutts <duncan@haskell.org>**20071018195641
 Doh!
] 
[refinement of fix for #1785: don't use xargs' -s option at all
Simon Marlow <simonmar@microsoft.com>**20071019124522] 
[FIX GHC bug #1785: use 2048 as the maximum command-line size
Simon Marlow <simonmar@microsoft.com>**20071018140500
 Apparently Solaris sets a limit of 2048 here
] 
[don't fail if xxx_hsc_make.c is gone
Ross Paterson <ross@soi.city.ac.uk>**20071018164245
 
 The non-GHC hsc2hs deletes it even if the compilation fails.
] 
[Use cpp-options rather than abusing ghc-options
Duncan Coutts <duncan@haskell.org>**20071017164914] 
[Add a "cpp-options:" field and use it for pre-processing .hs .hsc .chs files
Duncan Coutts <duncan@haskell.org>**20071017164747
 This is for pre-processing Haskell modules, not for C code. We already have
 cc-options for that purpose. Up 'til now people have been abusing ghc-options
 for this purpose. Even Cabal itself was guilty of doing that.
] 
[Figure out if hsc2hs is using gcc or ghc as it's C compiler
Duncan Coutts <duncan@haskell.org>**20071017143108
 and pass the appropriate flags on the basis of knowing that.
 This is a hack.
 What we should do longer term is make hsc2hs always use gcc as it's C compiler
 and have Cabal figure out the right flags to pass it, rather than using ghc
 to pass on the appropriate flags to gcc.
] 
[Change the handling of cpp & ghc flags for hsc2hs
Duncan Coutts <duncan@haskell.org>**20071016231652
 The hsc2hs that comes with ghc uses ghc as the C compiler. This means we must
 escape the real cc flags. It also means we can ask ghc to add extra include
 dirs that we might need to find includes of dependent packages. This is a bit
 of a hack. In the longer term it'd be better for Cabal to collect the include
 dirs and cc options of dependent packages and to pass them explicitly itself.
] 
[Improve error messages for failed sanity checks.
Thomas Schilling <nominolo@gmail.com>**20070925144955] 
[Translate flat files into sectionized files, by duplicating global
Thomas Schilling <nominolo@gmail.com>**20070925144921
 dependecies into each non-empty section.  The previous solution dumped
 them into the library section, even if it would have been empty
 otherwise.
] 
[Move ghcVerbosity function into GHC module to share code
Duncan Coutts <duncan@haskell.org>**20071014165730] 
[Note current development version number in release notes
Duncan Coutts <duncan@haskell.org>**20071012121835] 
[Update the TODO list, mostly removing things.
Duncan Coutts <duncan@haskell.org>**20071012121702
 Most of these are duplicated by Trac bugs.
 We should try and get rid of this TODO file completely and just use Trac.
] 
[Add logging functions notice, info, debug functions and use them consistently
Duncan Coutts <duncan@haskell.org>**20071012113237
 We previously had this kind of code all over the place:
 > when (verbosity >= verbose)
 >      (putStrLn "some message")
 We now replace that with:
 > info verbosity "some message"
 Much nicer.
] 
[When parsing ghc-pkg output, only look at the first package.conf file for GlobalPackageDB and SpecificPackageDB, and all package.conf files for UserPackageDB.
bjorn@bringert.net**20071016095254
 Before, we would consider user packages when fulfilling dependencies
 for global installs. ghc-pkg will refuse to install packages globally if they
 use user packages. Thus, without this patch, global installs can fail when you have user packages installed.
] 
[Pass -c (silent create) to ar when verbosity < normal.
bjorn@bringert.net**20071013220906] 
[Change --verbosity= option of SetupWrapper (cabal-setup) to --verbose=, since that is what the rest of Cabal uses.
bjorn@bringert.net**20071013215617] 
[Pass -w -v0 to ghc when compiling Setup.{lhs,hs} in SetupWrapper when verbosity == silent.
bjorn@bringert.net**20071013214820] 
[Update documentation on configurations
Duncan Coutts <duncan@haskell.org>**20071012015338
 Describe the new syntax and make variuous changes to the
 description of the meaning.
] 
[Use -O2 for compiling .c files when we configure --enable-optimization
Duncan Coutts <duncan@haskell.org>**20071011223607
 Seems a reasonable default behaviour.
] 
[Add support for Haddock 2.0
David Waern <davve@dtek.chalmers.se>**20071021231415] 
[parameterise InstalledPackageInfo over the type of module names
Simon Marlow <simonmar@microsoft.com>**20071003114947
 This is useful in GHC, we can instantiate InstalledPackageInfo to
 ModuleName and avoid lots of String<->FastString conversions.
] 
[Remove commented-out code. 
bjorn@bringert.net**20071006083615
 Push to 1.2.
] 
[Rename parseDescription to parsePackageDescription.
bjorn@bringert.net**20071006083354
 This should be pushed to cabal-1.2 to make cabal-install work with 1.2.
] 
[Bump version number to 1.3
bjorn@bringert.net**20071005105412] 
[Expose parseDescription.
bjorn@bringert.net**20071005104554] 
[Fix GenericPrackageDescription pretty printing to make it parsable. It still does not include all information.
bjorn@bringert.net**20071005102555] 
[Haddock comment for the available dependencies argument to finalizePackageDescription.
bjorn@bringert.net**20071004134544] 
[Add extra-libs to shared library linking
Clemens Fruhwirth <clemens@endorphin.org>**20070927123923] 
[Actually -stubdir only works well in ghc-6.8 due to -I search dir mess
Duncan Coutts <duncan@haskell.org>**20070926131843
 In ghc-6.6 the Foo/Bar.hc files only #include "Bar_stub.h" rather than
 #include "Foo/Bar_stub.h". This means when we set the stubdir so that the
 _stub.h files don't sit next to the .hs file then the include search path
 is not right to find the _stub.h file. In ghc-6.8 this is fixed so that
 it adds the -stubdir path to the include search path when calling gcc.
] 
[The -stubdir flag is supported in ghc-6.6 not just 6.6.1
Duncan Coutts <duncan@haskell.org>**20070926114223] 
[Add -package-name to GHC invocation when linking DSOs
Clemens Fruhwirth <clemens@endorphin.org>**20070926090025] 
[Be more fuzzy with os, arch and impl matching in conditions. Fixes bug #158.
Duncan Coutts <duncan@haskell.org>**20070925132608
 Do all the comparisons case insensitively and add some OS aliases so that
 if os(windows)  works if the System.Info.os is actually "mingw32".
] 
[Don't generate links when dependent docs not installed. Fixes bug #157.
Duncan Coutts <duncan@haskell.org>**20070924142520
 Generates a warning rather than failing as before.
] 
[Fix warnings
Ian Lynagh <igloo@earth.li>**20070923122921] 
[Fix pre-processing for executables
Duncan Coutts <duncan@haskell.org>**20070922105414
 The pre-processed files should go into the exe's build dir, not the
 lib's build dir. Also pre-process main modules, fixing bug #14.
] 
[Add a boring file
Ian Lynagh <igloo@earth.li>**20070913203550] 
[Remove some now-unecessary cleaning that causes problems for haskell-src
Ian Lynagh <igloo@earth.li>**20070920203257
 The code that removes .hs files in the source tree generated from .y files
 had a comment:
     XXX: This is actually no longer necessary, but we keep it, so that
     clean works correctly on packages built with an older version of Cabal
 This was causing problems for source distributions that include such
 generated files (including haskell-src in extralibs).
] 
[Move expensive conviguration actions inside branch where they're used
Duncan Coutts <duncan@haskell.org>**20070917085834
 We only need to configure the compiler and resolve any "Cabal-Version:"
 dependency when we're actually going to compile the Setup.hs program.
 We can otherwise save time by not calling ghc and ghc-pkg unnecessarily.
 (I only noticed this because I've got >150 registered packages which
 causes ghc and ghc-pkg to be very slow to start.)
] 
[Note in .cabal file that we're using a custom build-type
Duncan Coutts <duncan@haskell.org>**20070917033959] 
[Pass on all the cabal-setup options to cabal, not just unrecognised ones
Duncan Coutts <duncan@haskell.org>**20070917025121
 So for example -v and -w get passed on rather than swallowed by cabal-setup
 itself.
] 
[Put setup program and setup .o/.hi files into dist/setup
Duncan Coutts <duncan@haskell.org>**20070917024907
 That way they get cleaned automatically and do not clutter the top dir.
] 
[Correct the verbosity range in the "--help" text
Duncan Coutts <duncan@haskell.org>**20070917024416
 The correct range in 0--3, not 0--2 or 0--5
] 
[look in odir for source and .hs files, not buildDir lbi
Duncan Coutts <duncan@haskell.org>**20070917145030
 odir = buildDir lbi for the lib case, which is why it worked most of the time
 in testing but in the exe case it's a different dir.
] 
[Put _stub.{c|h} files under dist/ so they'll get cleaned. Fixes bug #154.
Duncan Coutts <duncan@haskell.org>**20070917123042
 Only used with ghc-6.6 and later which supports the -stubdir flag.
 With earlier ghc versions the files still end up in the src dirs and so do not
 get cleaned.
] 
[Fix haddockDir
Ian Lynagh <igloo@earth.li>**20070912133051] 
[Add htmlDirTemplate to inplaceDirs
Ian Lynagh <igloo@earth.li>**20070912125749] 
[Add a --htmldir flag
Ian Lynagh <igloo@earth.li>**20070912122145] 
[Don't forcibly append "pkgName (package pkg_descr)" to htmldir
Ian Lynagh <igloo@earth.li>**20070911192814] 
[TAG 2007-09-06
Ian Lynagh <igloo@earth.li>**20070906212150] 
[use OPTIONS instead of OPTIONS_GHC for now, the latter doesn't work with GHC 6.2.x
Simon Marlow <simonmar@microsoft.com>**20070912105243] 
[Don't create empty data dirs. Fixes bug #153.
Duncan Coutts <duncan@haskell.org>**20070912113803
 Patch contributed by Sven Panne.
] 
[Use confgurations to help build Cabal for ghc-6.2.x
Duncan Coutts <duncan@haskell.org>**20070912112934
 Replacing a long-standing comment telling people how to do it manually.
] 
[warning police
Simon Marlow <simonmar@microsoft.com>**20070907140731] 
[Update D.S.GHC/Makefile.hs
Clemens Fruhwirth <clemens@endorphin.org>**20070906213507] 
[Add shared library building to GHC module (also via Makefile)
Clemens Fruhwirth <clemens@endorphin.org>**20070906213132] 
[fix type clash: Data.Version -> Distribution.Version
Malcolm.Wallace@cs.york.ac.uk**20070906163051] 
[fix broken #ifdefs for nhc98
Malcolm.Wallace@cs.york.ac.uk**20070906161553] 
[spell nhc98-options correctly
Malcolm.Wallace@cs.york.ac.uk**20070906150411] 
[Fix various mispellings of nhc98.
Malcolm.Wallace@cs.york.ac.uk**20070906143959] 
[nhc-options should be spelled nhc98-options
Malcolm.Wallace@cs.york.ac.uk**20070906143536] 
[TAG 1.2.0
Duncan Coutts <duncan@haskell.org>**20070906121830] 
Patch bundle hash:
55299b171bec53d8df9673c8c9c307db1a6e320a