summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8e745fd4f645f9bd90eedcf62dafccb05041bbc8 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# Maintainer: Caleb Maclennan <caleb@alerque.com>
#
# Contributor: Nicolas Pouillard <nicolas.pouillard@gmail.com>
# Contributor: Elena “of Valhalla” Grandi <elena.valhalla@gmail.com>

# Cabal Flags:
# The git-annex assistant requires significantly more dependencies.
# If you do not need the assistant or have build issues try:
# _webapp=0

_s3=1
_webdav=1
_inotify=1
_dbus=1
_assistant=1
_webapp=1
_pairing=1
_xmpp=1
_dns=1
# slower build; faster binary
_production=1
_android=0
_testsuite=1
_tdfa=1
_feed=1
_quvi=1
_cryptohash=1

# In _cabal_mode=1 cabal install is used to install the missing dependencies
# for git-annex in a temporary local location to not interfer with you
# installation.
_cabal_mode=1
_cabal_flags=( --force-reinstalls )

# The man page is always built but,
# building the rest of the documentation requires ikiwiki.
# If you want to build the documentation turns this to 1.
_build_docs=0

# When _haskell_core is set to 1, packages available on the [haskell-core]
# repo are used (https://github.com/archhaskell/habs).
# [CHECKED on 2013-01-14]
_haskell_core=1

# When _haskell_web is set to 1, packages available on the [haskell-web]
# repo are used (https://github.com/EffeErre/habs-web).
# [BROKEN as of 2013-05-19]
_haskell_web=0

pkgname=git-annex-git
pkgver=5.20141024
pkgrel=0
pkgdesc='manage files with git, without checking their contents into git'
arch=('i686' 'x86_64')
url="http://git-annex.branchable.com/"
license=(GPL3)
depends=(
         curl
         git
         gmp
         gnupg
         gsasl
         libidn
         libxml2
         lsof
         nss-mdns
         openssh
         rsync
         util-linux
         )
options=(!makeflags)
conflicts=(git-annex git-annex-bin)
makedepends=(ghc)
optdepends=('quvi: Enable use of quvi to download videos')
source=("git://git.kitenet.net/${pkgname%-git}")
md5sums=('SKIP')

_features=()

(( ! _cabal_mode )) ||
  makedepends=("${makedepends[@]}" cabal-install happy alex haskell-cpphs)

(( ! _haskell_core )) ||
  makedepends=("${makedepends[@]}"
              haskell-bloomfilter
              haskell-dataenc
              haskell-edit-distance
              haskell-extensible-exceptions
              haskell-hslogger
              haskell-http
              haskell-ifelse
              haskell-json
              haskell-lifted-base
              haskell-missingh
              haskell-monad-control
              haskell-mtl
              haskell-network
              haskell-quickcheck
              haskell-sha
              haskell-text
              haskell-transformers-base
              haskell-utf8-string
              )

(( ! _haskell_web )) ||
  makedepends=("${makedepends[@]}" haskell-safesemaphore haskell-uuid)

gitannexfeature(){
  case $1 in
    (0) _features=("${_features[@]}" -f-"$2");;
    (*) _features=("${_features[@]}" -f"$2");;
  esac
}

gitannexfeature "$_android"    Android
gitannexfeature "$_assistant"  Assistant
gitannexfeature "$_dbus"       Dbus
gitannexfeature "$_dns"        DNS
gitannexfeature "$_inotify"    Inotify
gitannexfeature "$_pairing"    Pairing
gitannexfeature "$_production" Production
gitannexfeature "$_s3"         S3
gitannexfeature "$_testsuite"  TestSuite
gitannexfeature "$_tdfa"       TDFA
gitannexfeature "$_webapp"     Webapp
gitannexfeature "$_webdav"     WebDAV
gitannexfeature "$_xmpp"       XMPP
gitannexfeature "$_feed"       Feed
gitannexfeature "$_quvi"       Quvi
gitannexfeature "$_cryptohash" CryptoHash

(( ! _s3 || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}" haskell-hs3)

(( ! _assistant || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}" haskell-stm)

(( ! _assistant || ! _haskell_web )) ||
  makedepends=("${makedepends[@]}" haskell-async)

(( ! _inotify || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}" haskell-hinotify)

(( ! _webdav || ! _haskell_web )) ||
  makedepends=("${makedepends[@]}" haskell-dav haskell-http-conduit haskell-xml-conduit)
#(( ! _webdav || ! _cabal_mode || _haskell_web )) ||
#  _cabal_install=("${_cabal_install[@]}" DAV http-conduit xml-conduit)

(( ! _dbus || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}" haskell-dbus)
#(( ! _dbus || ! _cabal_mode || _haskell_core )) ||
#  _cabal_install=("${_cabal_install[@]}" dbus)

(( ! _webapp || ! _assistant || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}"
               haskell-case-insensitive
               haskell-http-types
               haskell-transformers
               haskell-wai
               haskell-warp
               haskell-blaze-builder
               haskell-crypto-api
               haskell-aeson
               haskell-data-default
              )

(( ! _webapp || ! _assistant || ! _haskell_web )) ||
  makedepends=("${makedepends[@]}"
               haskell-clientsession
               haskell-wai-logger
               haskell-yesod
               haskell-yesod-static
               haskell-yesod-form
               haskell-yesod-default
               haskell-hamlet
              )
#(( ! _webapp || ! _assistant || ! _cabal_mode || _haskell_web )) ||
#  _cabal_install=("${_cabal_install[@]}" wai-logger project-template-0.1.0.1 yesod yesod-static yesod-default hamlet)

(( ! _webapp || ! _pairing || ! _haskell_web )) ||
  makedepends=("${makedepends[@]}"
               haskell-network-multicast
               haskell-network-info)
#(( ! _webapp || ! _pairing || ! _cabal_mode || _haskell_web )) ||
#  _cabal_install=("${_cabal_install[@]}"
#                  network-multicast
#                  network-info)

(( ! _xmpp || ! _assistant || ! _haskell_web )) ||
  makedepends=("${makedepends[@]}"
               haskell-xml-types
               haskell-network-protocol-xmpp
               haskell-gnutls)
#(( ! _xmpp || ! _assistant || ! _cabal_mode || _haskell_web )) ||
#  _cabal_install=("${_cabal_install[@]}"
#                  xml-types
#                  network-protocol-xmpp
#                  gnutls)

(( ! _xmpp || ! _assistant || ! _dns || ! _haskell_web )) ||
  makedepends=("${makedepends[@]}" haskell-dns)
#(( ! _xmpp || ! _assistant || ! _dns || ! _cabal_mode || _haskell_web )) ||
#  _cabal_install=("${_cabal_install[@]}" dns)

(( ! _testsuite || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}"
               haskell-hunit)

(( ! _tdfa || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}"
               haskell-regex-tdfa)

### haskell-feed is not packaged yet
#(( ! _feed || ! _haskell_core )) ||
#  makedepends=("${makedepends[@]}"
#               haskell-feed)

(( ! _quvi || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}"
               haskell-aeson)

(( ! _cryptohash || ! _haskell_core )) ||
  makedepends=("${makedepends[@]}"
               haskell-cryptohash)

(( ! _build_docs )) || makedepends=("${makedepends[@]}" ikiwiki)

asking() {
  read -p "$@ (Y/n)" answer
  case "$answer" in
    n|N|no|NO|No|nO) false;;
    *) true;;
  esac
}

_localize-home(){
  ORIG_HOME="$HOME"
  ORIG_TMPDIR="$TMPDIR"
  export HOME="$srcdir/home"
  export TMPDIR="$srcdir/home/tmp"
  export PATH="$HOME/.cabal/bin:$PATH"
}

_restore-home(){
  export HOME="$ORIG_HOME"
  export TMPDIR="$ORIG_TMPDIR"
}

pkgver() {
  cd "$srcdir/${pkgname%-git}"
  git describe --long | sed 's/^v//;s/-/_/g'
}

build() {
  cd "$srcdir/${pkgname%-git}"

  msg "Git checkout done or server timeout"

  _localize-home
  mkdir -p "$HOME" "$TMPDIR"

  msg "Features: ${_features[*]}"

  if (( _cabal_mode )); then
    msg "Cabal mode: installing missing dependencies..."
    #cabal install cabal-install
    #cabal sandbox init
    cabal update
    which c2hs || cabal install c2hs
    # only if _cabal_install non empty
    # cabal install "${_cabal_install[@]}" --user
    cabal install "${_cabal_flags[@]}" --user --only-dependencies "${_features[@]}"
  fi

  msg "Configuring..."
  cabal configure "${_features[@]}"

  msg "Starting build..."
  make
  (( ! _testsuite )) ||
    make test ||
    asking "Tests failed. Continue?"
  _restore-home
}

package() {
  cd "$srcdir/${pkgname%-git}"
  _localize-home
  make DESTDIR="$pkgdir" install
  _restore-home
}