| Cabal-1.6.0.3: A framework for packaging Haskell software | Source code | Contents | Index

Distribution.Simple.GHC

Portability | portable
Maintainer | cabal-devel@haskell.org

Description

This is a fairly large module. It contains most of the GHC-specific code for configuring, building and installing packages. It also exports a function for finding out what packages are already installed. Configuring involves finding the `ghc` and `ghc-pkg` programs, finding what language extensions this version of ghc supports and returning a `Compiler` value.

`getInstalledPackages` involves calling the `ghc-pkg` program to find out what packages are installed.

Building is somewhat complex as there is quite a bit of information to take into account. We have to build libs and programs, possibly for profiling and shared libs. We have to support building libraries that will be usable by GHCi and also ghc's `-split-objs` feature. We have to compile any C files using ghc. Linking, especially for `split-objs` is remarkably complex, partly because there tend to be 1,000's of `.o` files and this can often be more than we can pass to the `ld` or `ar` programs in one go.

There is also some code for generating `Makefiles` but the less said about that the better.

Installing for libs and exes involves finding the right files and copying them to the right places. One of the more tricky things about this module is remembering the layout of files in the build directory (which is not explicitly documented) and thus what search dirs are used for various kinds of files.

Synopsis

configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> IO (Compiler, ProgramConfiguration)
getInstalledPackages :: Verbosity -> PackageDB -> ProgramConfiguration -> IO (PackageIndex InstalledPackageInfo)
build :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO ()
makefile :: PackageDescription -> LocalBuildInfo -> MakefileFlags -> IO ()
installLib :: CopyFlags -> LocalBuildInfo -> FilePath -> FilePath -> FilePath -> PackageDescription -> IO ()
installExe :: CopyFlags -> LocalBuildInfo -> InstallDirs FilePath -> InstallDirs FilePath -> FilePath -> (FilePath, FilePath) -> PackageDescription -> IO ()
ghcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcVerbosityOptions :: Verbosity -> [String]

Documentation

configure :: Verbosity -> Maybe FilePath -> Maybe FilePath -> ProgramConfiguration -> IO (Compiler, ProgramConfiguration) | Source

getInstalledPackages :: Verbosity -> PackageDB -> ProgramConfiguration -> IO (PackageIndex InstalledPackageInfo) | Source

build :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO () | Source

Building for GHC. If .ghc-packages exists and is readable, add it to the command-line.

makefile :: PackageDescription -> LocalBuildInfo -> MakefileFlags -> IO () | Source

installLib | Source

:: CopyFlags | verbosity
-> LocalBuildInfo |
-> FilePath | install location
-> FilePath | install location for dynamic librarys
-> FilePath | Build location
-> PackageDescription |
-> IO () |
Install for ghc, .hi, .a and, if --with-ghci given, .o

installExe | Source

:: CopyFlags | verbosity
-> LocalBuildInfo |
-> InstallDirs FilePath | Where to copy the files to
-> InstallDirs FilePath | Where to pretend the files are (i.e. ignores --destdir)
-> FilePath | Build location
-> (FilePath, FilePath) | Executable (prefix,suffix)
-> PackageDescription |
-> IO () |
Install executables for GHC.

ghcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String] | Source

ghcVerbosityOptions :: Verbosity -> [String] | Source

Produced by Haddock version 2.4.2