aboutsummaryrefslogtreecommitdiff
path: root/doc/install/fromsource.mdwn
blob: c46321099bdd1a30b5cf587e9a7b5ba9098fab64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
So you want to build git-annex from source. This is encouraged for
users with experience building code from source. But the build may
require some care and feeding. This page will start with the easy
methods and work up to the harder ones.

## prerequisites

Start by installing the 
[Haskell Platform](http://hackage.haskell.org/platform/).

In Debian, this is as simple as:

	sudo apt-get install haskell-platform

## downloading the source code

The easiest way is using git; see [[download]] or just run:

	git clone git://git-annex.branchable.com/ git-annex

## building from source on Debian

This is the method used by git-annex's author, and so it's the one most
likely to work without problems.

First, install everything git-annex needs to build:

	sudo apt-get build-dep git-annex

Now you can build git-annex by running either `make` or `cabal build`
inside the source tree.

## building from source with stack

Using stack automates nearly everything, will work on many systems,
and avoids build failures due to fast-changing haskell libraries.

First, [install stack](https://github.com/commercialhaskell/stack/blob/master/doc/install_and_upgrade.md)
It will be part of the Haskell Platform soon. On Debian unstable/testing:

	sudo apt-get install haskell-stack zlib1g-dev libtinfo-dev

Get the git-annex source code, and inside the source tree run:

	stack setup
	stack install

Move git-annex into some directory that is in your PATH:

	mv ~/.local/bin/git-annex ~/bin # or /usr/local/bin/ or whatever

(Why not run `stack install git-annex`? Because that causes stack to 
[ignore git-annex's stack.yaml file](https://github.com/commercialhaskell/stack/issues/2371),
yielding a less reliable build.)

Note that this build produces a git-annex without the build flags
XMPP, DBUS, and MagicMime.
These optional features require installing additional C libraries.
To try to build with these features 
enabled, pass extra parameters when running stack install: 
`--flag git-annex:XMPP --flag git-annex:DBUS --flag git-annex:MagicMime`

## minimal build from source with cabal

This can be done anywhere, and builds git-annex without some optional
features that require harder-to-install C libraries. This is plenty to let
you get started with git-annex, but it does not include the assistant or
webapp.

Be warned that this involves building a lot of Haskell libraries from
source, and so it has a lot of moving parts, and it's not uncommon for it
to be broken from time to time.

Get the git-annex source code, and inside the source tree, run:

	cabal install -j -f"-assistant -webapp -webdav -pairing -xmpp -dns -dbus -magicmime" --only-dependencies
	cabal configure -f"-assistant -webapp -webdav -pairing -xmpp -dns -dbus -magicmime"
	cabal build -j
	PATH=$HOME/bin:$PATH
	cabal install --bindir=$HOME/bin

## full build from source with cabal

To build with all features enabled, including the assistant and webapp,
you will need to install several C libraries and their headers,
including libgnutls, libgsasl, libxml2, libmagic, and zlib. How to do
that for your OS is beyond the scope of this page. 

Once the C libraries are installed, run inside the source tree:

	cabal install -j --only-dependencies
	cabal configure
	cabal build -j
	PATH=$HOME/bin:$PATH
	cabal install --bindir=$HOME/bin

## EKG

When building with cabal, you can optionally enable the 
[[EKG monitoring interface|ekg]]. This is great for debugging resource
usage problems, but not for general-purpose builds.
Just pass `-f+EKG` to `cabal configure`