\chapter{Building darcs}
\section{The Easy Way}
If your distribution provides a pre-built binary package of a recent
Darcs release, you are strongly encouraged to use that rather than
building Darcs yourself.

If you have (or can install) the \texttt{cabal-install} package, this
is the next best option, as this will resolve build dependencies
automatically.  To download, compile and install Darcs and its
dependencies via cabal-install, simply run
\begin{verbatim}
cabal update
cabal install darcs
\end{verbatim}

\section{The Hard Way}
If you cannot install \texttt{cabal-install}, you need to run
\begin{verbatim}
ghc --make Setup
./Setup configure
./Setup build
./Setup install
\end{verbatim}

This will require the following build dependencies:
\begin{itemize}
\item GHC 6.10 or higher; and
\item Cabal 1.6 or higher.
\end{itemize}

%% Note: darcs.cabal tends to have build dependencies [x,y), but I
%% couldn't work out a way to describe this concisely (and
%% intelligibly to non-mathematicians).  So I have lied and simply
%% said `or higher', since the upper bounds usually only declare
%% incompatibility with versions that don't exist yet. --twb, 2009

Additional build dependencies are declared in the \texttt{darcs.cabal}
file, and \texttt{./Setup configure} will tell you if any required
build dependencies aren't found.  The build dependencies at time of
writing (Darcs 2.3) are as follows:
\begin{itemize}
\item the C library zlib;
\item the Haskell packages
  \begin{itemize}
  \item array 1.1 or 1.2;
  \item containers 1.1 or 1.2;
  \item directory 1.0;
  \item filepath 1.1;
  \item hashed-storage 0.3;
  \item haskeline 0.6.1 or higher;
  \item html 1.0;
  \item mtl 1.0 or 1.1;
  \item old-time 1.0;
  \item parsec 2.1 or higher;
  \item process 1.0;
  \item random 1.0; and
  \item regex-compat 0.71 or higher.
  \end{itemize}
\end{itemize}

Missing \emph{optional} build dependencies are only listed if
\texttt{./Setup configure} is passed the \texttt{--verbose} argument.
At time of writing they are:
\begin{itemize}
\item the C library libcurl (7.19.1 or higher recommended);
\item the Haskell packages
  \begin{itemize}
  \item bytestring 0.9;
  \item bytestring-mmap 0.2 or higher;
  \item http 3000 or 3001.1;
  \item network 2.2;
  \item terminfo 0.3.
  \item text 0.3; and
  \item zlib 0.5.
  \end{itemize}
\end{itemize}
