| 547 | | First, download the package. For example (using `$(TOP)` to stand for the root directory of your build tree): |
| | 547 | The easiest way is to just use [http://hackage.haskell.org/trac/hackage/wiki/CabalInstall cabal-install]: |
| | 548 | |
| | 549 | {{{ |
| | 550 | $ cabal install --with-ghc=$(TOP)/inplace/bin/ghc-stage2 <package> |
| | 551 | }}} |
| | 552 | |
| | 553 | where `$(TOP)` stands for the root directory of your build tree, and `<package>` is the name of the package you want to install. This will install the package in your home directory (e.g. somewhere under `~/.cabal/lib` on a Unix system) , so you'll probably want to remove it by hand when you've finished. |
| | 554 | |
| | 555 | There's also a way to build and register a package with GHC but without actually installing it in your home directory. For example, if you want to install a package from its darcs repository: |
| 554 | | runhaskell Setup configure --with-ghc=$(TOP)/inplace/bin/ghc-stage2 |
| 555 | | runhaskell Setup build |
| 556 | | runhaskell Setup install --inplace |
| 557 | | }}} |
| 558 | | The `--inplace` flag to `install` is passed by Cabal to `ghc-pkg` (which in turn is found form the `--with-ghc` flag you gave to `configure`, and tells `ghc-pkg` not to copy the compiled package, but rather to leave it right where it is. |
| | 562 | $ runhaskell Setup configure --with-ghc=$(TOP)/inplace/bin/ghc-stage2 |
| | 563 | $ runhaskell Setup build |
| | 564 | $ runhaskell Setup register --inplace |
| | 565 | }}} |
| | 566 | The `--inplace` flag to `register` tells Cabal not to copy the compiled package, but rather to leave it right where it is, and register this location in the package database in your GHC build tree. |