README.md
1The cabal-install package
2=========================
3
4See the [Cabal web site] for more information.
5
6The `cabal-install` package provides a command line tool named `cabal`.
7It uses the [Cabal] library and provides a user interface to the
8Cabal/[Hackage] build automation and package management system. It can
9build and install both local and remote packages, including
10dependencies.
11
12[Cabal web site]: http://www.haskell.org/cabal/
13[Cabal]: ../Cabal/README.md
14
15Installing the `cabal` command-line tool
16========================================
17
18The `cabal-install` package requires a number of other packages, most of
19which come with a standard GHC installation. It requires the [network]
20package, which is sometimes packaged separately by Linux distributions;
21for example, on Debian or Ubuntu, it is located in the
22"libghc6-network-dev" package.
23
24`cabal` requires a few other Haskell packages that are not always
25installed. The exact list is specified in the [.cabal] file or in the
26[bootstrap.sh] file. All these packages are available from [Hackage].
27
28Note that on some Unix systems you may need to install an additional
29zlib development package using your system package manager; for example,
30on Debian or Ubuntu, it is located in the "zlib1g-dev" package; on
31Fedora, it is located in the "zlib-devel" package. It is required
32because the Haskell zlib package uses the system zlib C library and
33header files.
34
35The `cabal-install` package is now part of the [Haskell Platform], so you
36do not usually need to install it separately. However, if you are
37starting from a minimal GHC installation, you need to install
38`cabal-install` manually. Since it is an ordinary Cabal package,
39`cabal-install` can be built the standard way; to facilitate this, the
40process has been partially automated. It is described below.
41
42[.cabal]: cabal-install.cabal
43[network]: http://hackage.haskell.org/package/network
44[Haskell Platform]: http://www.haskell.org/platform/
45
46Quick start on Unix-like systems
47--------------------------------
48
49As a convenience for users on Unix-like systems, there is a
50[bootstrap.sh] script that will download and install each of
51`cabal-install`'s dependencies in turn.
52
53 $ ./bootstrap.sh
54
55It will download and install the dependencies. The script will install the
56library packages (vanilla, profiling and shared) into `$HOME/.cabal/` and the
57`cabal` program into `$HOME/.cabal/bin/`. If you don't want to install profiling
58and shared versions of the libraries, use
59
60 $ EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh
61
62You then have the choice either to place `$HOME/.cabal/bin` on your
63`$PATH` or move the `cabal` program to somewhere on your `$PATH`. Next,
64you can get the latest list of packages by running:
65
66 $ cabal update
67
68This will also create a default configuration file, if it does not
69already exist, at `$HOME/.cabal/config`.
70
71By default, `cabal` will install programs to `$HOME/.cabal/bin`. If you
72do not want to add this directory to your `$PATH`, you can change
73the setting in the config file; for example, you could use the
74following:
75
76 installdir: $HOME/bin
77
78
79Quick start on Windows systems
80------------------------------
81
82For Windows users, a precompiled program ([cabal.exe]) is provided.
83Download and put it somewhere on your `%PATH%` (for example,
84`C:\Program Files\Haskell\bin`.)
85
86Next, you can get the latest list of packages by running:
87
88 $ cabal update
89
90This will also create a default configuration file (if it does not
91already exist) at
92`C:\Documents and Settings\%USERNAME%\Application Data\cabal\config`.
93
94[cabal.exe]: http://www.haskell.org/cabal/release/cabal-install-latest/
95
96Using `cabal`
97=============
98
99There are two sets of commands: commands for working with a local
100project build tree and those for working with packages distributed
101from [Hackage].
102
103For the list of the full set of commands and flags for each command,
104run:
105
106 $ cabal help
107
108
109Commands for developers for local build trees
110---------------------------------------------
111
112The commands for local project build trees are almost the same as the
113`runghc Setup` command-line interface you may already be familiar with.
114In particular, it has the following commands:
115
116 * `cabal configure`
117 * `cabal build`
118 * `cabal haddock`
119 * `cabal clean`
120 * `cabal sdist`
121
122The `install` command is somewhat different; it is an all-in-one
123operation. If you run `cabal install` in your build tree, it will
124configure, build, and install. It takes all the flags that `configure`
125takes such as `--global` and `--prefix`.
126
127In addition, `cabal` will download and install any dependencies that are
128not already installed. It can also rebuild packages to ensure a
129consistent set of dependencies.
130
131
132Commands for released Hackage packages
133--------------------------------------
134
135 $ cabal update
136
137This command gets the latest list of packages from the [Hackage] server.
138On occasion, this command must be run manually--for instance, if you
139want to install a newly released package.
140
141 $ cabal install xmonad
142
143This command installs one or more named packages, and all their
144dependencies, from Hackage. By default, it installs the latest available
145version; however, you may specify exact versions or version ranges. For
146example, `cabal install alex-2.2` or `cabal install parsec < 3`.
147
148 $ cabal list xml
149
150This does a search of the installed and available packages. It does a
151case-insensitive substring match on the package name.
152
153
154[Hackage]: http://hackage.haskell.org
155[bootstrap.sh]: bootstrap.sh
156