|
Packit |
47c06b |
The cabal-install package
|
|
Packit |
47c06b |
=========================
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
See the [Cabal web site] for more information.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
The `cabal-install` package provides a command line tool named `cabal`.
|
|
Packit |
47c06b |
It uses the [Cabal] library and provides a user interface to the
|
|
Packit |
47c06b |
Cabal/[Hackage] build automation and package management system. It can
|
|
Packit |
47c06b |
build and install both local and remote packages, including
|
|
Packit |
47c06b |
dependencies.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
[Cabal web site]: http://www.haskell.org/cabal/
|
|
Packit |
47c06b |
[Cabal]: ../Cabal/README.md
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Installing the `cabal` command-line tool
|
|
Packit |
47c06b |
========================================
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
The `cabal-install` package requires a number of other packages, most of
|
|
Packit |
47c06b |
which come with a standard GHC installation. It requires the [network]
|
|
Packit |
47c06b |
package, which is sometimes packaged separately by Linux distributions;
|
|
Packit |
47c06b |
for example, on Debian or Ubuntu, it is located in the
|
|
Packit |
47c06b |
"libghc6-network-dev" package.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
`cabal` requires a few other Haskell packages that are not always
|
|
Packit |
47c06b |
installed. The exact list is specified in the [.cabal] file or in the
|
|
Packit |
47c06b |
[bootstrap.sh] file. All these packages are available from [Hackage].
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Note that on some Unix systems you may need to install an additional
|
|
Packit |
47c06b |
zlib development package using your system package manager; for example,
|
|
Packit |
47c06b |
on Debian or Ubuntu, it is located in the "zlib1g-dev" package; on
|
|
Packit |
47c06b |
Fedora, it is located in the "zlib-devel" package. It is required
|
|
Packit |
47c06b |
because the Haskell zlib package uses the system zlib C library and
|
|
Packit |
47c06b |
header files.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
The `cabal-install` package is now part of the [Haskell Platform], so you
|
|
Packit |
47c06b |
do not usually need to install it separately. However, if you are
|
|
Packit |
47c06b |
starting from a minimal GHC installation, you need to install
|
|
Packit |
47c06b |
`cabal-install` manually. Since it is an ordinary Cabal package,
|
|
Packit |
47c06b |
`cabal-install` can be built the standard way; to facilitate this, the
|
|
Packit |
47c06b |
process has been partially automated. It is described below.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
[.cabal]: cabal-install.cabal
|
|
Packit |
47c06b |
[network]: http://hackage.haskell.org/package/network
|
|
Packit |
47c06b |
[Haskell Platform]: http://www.haskell.org/platform/
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Quick start on Unix-like systems
|
|
Packit |
47c06b |
--------------------------------
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
As a convenience for users on Unix-like systems, there is a
|
|
Packit |
47c06b |
[bootstrap.sh] script that will download and install each of
|
|
Packit |
47c06b |
`cabal-install`'s dependencies in turn.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ ./bootstrap.sh
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
It will download and install the dependencies. The script will install the
|
|
Packit |
47c06b |
library packages (vanilla, profiling and shared) into `$HOME/.cabal/` and the
|
|
Packit |
47c06b |
`cabal` program into `$HOME/.cabal/bin/`. If you don't want to install profiling
|
|
Packit |
47c06b |
and shared versions of the libraries, use
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ EXTRA_CONFIGURE_OPTS="" ./bootstrap.sh
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
You then have the choice either to place `$HOME/.cabal/bin` on your
|
|
Packit |
47c06b |
`$PATH` or move the `cabal` program to somewhere on your `$PATH`. Next,
|
|
Packit |
47c06b |
you can get the latest list of packages by running:
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ cabal update
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
This will also create a default configuration file, if it does not
|
|
Packit |
47c06b |
already exist, at `$HOME/.cabal/config`.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
By default, `cabal` will install programs to `$HOME/.cabal/bin`. If you
|
|
Packit |
47c06b |
do not want to add this directory to your `$PATH`, you can change
|
|
Packit |
47c06b |
the setting in the config file; for example, you could use the
|
|
Packit |
47c06b |
following:
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
symlink-bindir: $HOME/bin
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Quick start on Windows systems
|
|
Packit |
47c06b |
------------------------------
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
For Windows users, a precompiled program ([cabal.exe]) is provided.
|
|
Packit |
47c06b |
Download and put it somewhere on your `%PATH%` (for example,
|
|
Packit |
47c06b |
`C:\Program Files\Haskell\bin`.)
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Next, you can get the latest list of packages by running:
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ cabal update
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
This will also create a default configuration file (if it does not
|
|
Packit |
47c06b |
already exist) at
|
|
Packit |
47c06b |
`C:\Documents and Settings\%USERNAME%\Application Data\cabal\config`.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
[cabal.exe]: http://www.haskell.org/cabal/release/cabal-install-latest/
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Using `cabal`
|
|
Packit |
47c06b |
=============
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
There are two sets of commands: commands for working with a local
|
|
Packit |
47c06b |
project build tree and those for working with packages distributed
|
|
Packit |
47c06b |
from [Hackage].
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
For the list of the full set of commands and flags for each command,
|
|
Packit |
47c06b |
run:
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ cabal help
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Commands for developers for local build trees
|
|
Packit |
47c06b |
---------------------------------------------
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
The commands for local project build trees are almost the same as the
|
|
Packit |
47c06b |
`runghc Setup` command-line interface you may already be familiar with.
|
|
Packit |
47c06b |
In particular, it has the following commands:
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
* `cabal configure`
|
|
Packit |
47c06b |
* `cabal build`
|
|
Packit |
47c06b |
* `cabal haddock`
|
|
Packit |
47c06b |
* `cabal clean`
|
|
Packit |
47c06b |
* `cabal sdist`
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
The `install` command is somewhat different; it is an all-in-one
|
|
Packit |
47c06b |
operation. If you run `cabal install` in your build tree, it will
|
|
Packit |
47c06b |
configure, build, and install. It takes all the flags that `configure`
|
|
Packit |
47c06b |
takes such as `--global` and `--prefix`.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
In addition, `cabal` will download and install any dependencies that are
|
|
Packit |
47c06b |
not already installed. It can also rebuild packages to ensure a
|
|
Packit |
47c06b |
consistent set of dependencies.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
Commands for released Hackage packages
|
|
Packit |
47c06b |
--------------------------------------
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ cabal update
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
This command gets the latest list of packages from the [Hackage] server.
|
|
Packit |
47c06b |
On occasion, this command must be run manually--for instance, if you
|
|
Packit |
47c06b |
want to install a newly released package.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ cabal install xmonad
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
This command installs one or more named packages, and all their
|
|
Packit |
47c06b |
dependencies, from Hackage. By default, it installs the latest available
|
|
Packit |
47c06b |
version; however, you may specify exact versions or version ranges. For
|
|
Packit |
47c06b |
example, `cabal install alex-2.2` or `cabal install parsec < 3`.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
$ cabal list xml
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
This does a search of the installed and available packages. It does a
|
|
Packit |
47c06b |
case-insensitive substring match on the package name.
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
|
|
Packit |
47c06b |
[Hackage]: http://hackage.haskell.org
|
|
Packit |
47c06b |
[bootstrap.sh]: bootstrap.sh
|