<div dir="ltr"><div>Hello, I've been looking at <a href="http://ghc.haskell.org/trac/ghc/ticket/8244">http://ghc.haskell.org/trac/ghc/ticket/8244</a>, following the discussions:</div><div>-<a href="http://www.mail-archive.com/haskell-cafe@haskell.org/msg107850.html">http://www.mail-archive.com/haskell-cafe@haskell.org/msg107850.html</a></div>
<div>-<a href="http://www.haskell.org/pipermail/ghc-devs/2013-March/000762.html">http://www.haskell.org/pipermail/ghc-devs/2013-March/000762.html</a></div><div><br></div><div>This is basically about the fact that GHC-as-a-library as a dependency on the Cabal library, which causes all kinds of grief for tools using the GHC API (can't upgrade Cabal).</div>
<div>The ticket has a nice dependency diagram, thanks to lemao.</div><div><br></div><div>So I tried to see what could work. This is what I've done so far:</div><div>- created a new distribution-base library (the name avoids any reference to Cabal, don't know if it's wise)</div>
<div>- build that library instead of Cabal in stage0 and stage1</div><div>- reference that library instead of Cabal in ghc.cabal, pkg-pkg.cabal, Cabal.Cabal</div><div>- add the dependency when building ghc-cabal and ghc-tags, both need the full Cabal anyway.</div>
<div><br></div><div>The distribution-base library contains the following modules:</div><div>- Distribution.Compat.ParseUtils: the bits of Cabal's Distribution.ParseUtils we need</div><div>- Distribution.Compat.ReadP: Cabal's ReadP</div>
<div>- Distribution.InstalledPackageInfo: Cabal's Distribution.InstalledPackageInfo</div><div>- Distribution.License: Cabal's Distribution.License</div><div>- Distribution.ModuleName: Cabal's Distribution.ModuleName</div>
<div>- Distribution.Package: Cabal's Distribution.Package minus the Dependency type and related functions (unused in GHC)</div><div>- Distribution.PackageIndex: the bits of Cabal's Distribution.Simple.PackageIndex we need</div>
<div>- Distribution.Text: Cabal's Distribution.Text</div><div>- Distribution.Utils: the bits of Cabal's Distribution.Simple.Utils we need</div><div><br></div><div>Note that Distribution.Version is not needed by GHC, even though it used to import it, it only used the datatype from base, and the Data instance I've moved to Distribution.Package.</div>
<div>I've created a new Cabal module called Distribution.Dependency since the Dependency type is not needed, in the Cabal source code it's mainly imports that need to change.</div><div><br></div><div>All seems to build on my machine. It doesn't really help the build itself since Cabal is still needed for ghc-cabal, but at least the GHC API does not require the Cabal library any more.</div>
<div><br></div><div>What do you think? Is it a step in the right direction?</div><div><br></div><div>Thanks</div><div><br></div><div>JP</div><div><br></div><div><br></div>-- <br>JP Moresmau<br><a href="http://jpmoresmau.blogspot.com/">http://jpmoresmau.blogspot.com/</a>
</div>