summaryrefslogtreecommitdiff
path: root/bittorrent.cabal
blob: f985f76ba6190e3f3e3486d6baaa1fed41d81480 (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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
name:                  bittorrent
version:               0.0.0.3
license:               BSD3
license-file:          LICENSE
author:                Sam Truzjan
maintainer:            Sam Truzjan <pxqr.sta@gmail.com>
copyright:             (c) 2013, Sam Truzjan
category:              Network
build-type:            Simple
cabal-version:         >= 1.10
tested-with:           GHC == 7.6.3
homepage:              https://github.com/cobit/bittorrent
bug-reports:           https://github.com/cobit/bittorrent/issues
synopsis:              BitTorrent protocol implementation.
description:

  A library for making Haskell bittorrent applications easy.
  .
  For more information see:
  <https://github.com/cobit/bittorrent/blob/master/README.md>

extra-source-files:    res/dapper-dvd-amd64.iso.torrent
                       res/pkg.torrent
                       README.md
                       ChangeLog
                       cbits/*.h


source-repository head
  type:                git
  location:            git://github.com/cobit/bittorrent.git

source-repository this
  type:                git
  location:            git://github.com/cobit/bittorrent.git
  branch:              master
  tag:                 v0.0.0.3

flag testing
  description:         Whether to build tests.
  default:             False

flag examples
  description:         Whether to build examples.
  default:             False

flag network-uri
  description:         Use network-uri package.
  default:             True

flag bits-extras
  description:         Use more-effecient bits-extras bitwise operations.
  default:             False

flag dht-only
  description:         Build only DHT related modules.
  default:             True

flag builder
  description: Use older bytestring package and bytestring-builder.
  default: False

flag aeson
  description: Use aeson for pretty-printing bencoded data.
  default: True

flag thread-debug
  description: Add instrumentation to threads.
  default: True

library
  default-language:    Haskell2010
  default-extensions:  PatternGuards
                     , OverloadedStrings
                     , RecordWildCards
  hs-source-dirs:      src, .
  exposed-modules:  Network.SocketLike
                    Data.Digest.CRC32C
                    Data.Bits.ByteString
                    Data.Wrapper.PSQ
                    Data.Wrapper.PSQInt
                    Data.MinMaxPSQ
                    Network.Address
                    Network.DHT.Routing
                    Data.Torrent
                    Network.BitTorrent.DHT.ContactInfo
                    Network.BitTorrent.DHT.Token
                    Network.BitTorrent.DHT.Search
                    Network.QueryResponse
                    Network.StreamServer
                    Data.BEncode.Pretty
                    Tasks
                    Kademlia
                    Mainline
                    Global6

  build-depends:      base
                    , containers
                    , array
                    , hashable
                    , iproute
                    , stm
                    , base16-bytestring
                    , base32-bytestring
                    , base64-bytestring
                    , psqueues
                    , reflection
                    , deepseq
                    , text
                    , filepath
                    , directory
                    , bencoding

                    , cryptonite
                    , memory
                    , time
                    , random
                    , entropy

                    , cereal
                    , http-types

                    , process
                    , split
                    , pretty
                    , convertible
                    , data-default

                    , lens
                    , lifted-async
                    , lifted-base
                    , monad-control
                    , transformers-base
                    , mtl

  if flag(network-uri)
      Build-depends:  network      >= 2.6
                    , network-uri  >= 2.6
  else
      Build-depends:  network      >= 2.4 && < 2.6


  other-modules:       Paths_bittorrent
                       Crypto.Cipher.Salsa
                       Crypto.Cipher.XSalsa
                       Crypto.ECC.Class
                       Crypto.ECC.Simple.Prim
                       Crypto.ECC.Simple.Types
                       Crypto.Error.Types
                       Crypto.Internal.ByteArray
                       Crypto.Internal.Compat
                       Crypto.Internal.DeepSeq
                       Crypto.Internal.Imports
                       Crypto.PubKey.Curve25519

  C-sources:           cbits/cryptonite_xsalsa.c, cbits/cryptonite_salsa.c

  if !flag(dht-only)
     exposed-modules:  Network.BitTorrent
                       Network.BitTorrent.Client
                       Network.BitTorrent.Client.Types
                       Network.BitTorrent.Client.Handle
                       Network.BitTorrent.Exchange
                       Network.BitTorrent.Exchange.Bitfield
                       Network.BitTorrent.Exchange.Block
                       Network.BitTorrent.Exchange.Connection
                       Network.BitTorrent.Exchange.Download
                       Network.BitTorrent.Exchange.Manager
                       Network.BitTorrent.Exchange.Message
                       Network.BitTorrent.Exchange.Session
                       Network.BitTorrent.Tracker
                       Network.BitTorrent.Tracker.List
                       Network.BitTorrent.Tracker.Message
                       Network.BitTorrent.Tracker.RPC
                       Network.BitTorrent.Tracker.RPC.HTTP
                       Network.BitTorrent.Tracker.RPC.UDP
                       Network.BitTorrent.Tracker.Session
                       System.Torrent.Storage
  if !flag(dht-only)
    if flag(testing)
      exposed-modules:
                       Network.BitTorrent.Internal.Cache
                       Network.BitTorrent.Internal.Progress
                       Network.BitTorrent.Internal.Types
                       System.Torrent.FileMap
                       System.Torrent.Tree
    else
      other-modules:
                       Network.BitTorrent.Internal.Cache
                       Network.BitTorrent.Internal.Progress
                       Network.BitTorrent.Internal.Types
                       System.Torrent.FileMap
                       System.Torrent.Tree
  if flag(aeson)
    build-depends: aeson, aeson-pretty, unordered-containers, vector
    cpp-options:   -DBENCODE_AESON
  if flag(thread-debug)
    exposed-modules: Control.Concurrent.Lifted.Instrument
                     Control.Concurrent.Async.Lifted.Instrument
    cpp-options:   -DTHREAD_DEBUG

  if flag(builder)
    build-depends: bytestring >= 0.9, bytestring-builder
  else
    build-depends: bytestring >= 0.10
  if impl(ghc < 7.6)
    build-depends:     ghc-prim
  ghc-options:         -Wall
  ghc-prof-options:


test-suite spec
  if !flag(testing)
    buildable:         False
  default-language:    Haskell2010
  default-extensions:  OverloadedStrings
  type:                exitcode-stdio-1.0
  hs-source-dirs:      tests
  main-is:             Main.hs
  other-modules:       Spec
                       Config
                       Network.KRPCSpec
                       Network.KRPC.MethodSpec
                       Network.DatagramServer.MainlineSpec
                       Data.TorrentSpec
                       Network.BitTorrent.Client.HandleSpec
                       Network.BitTorrent.CoreSpec
                       Network.BitTorrent.DHTSpec
                       Network.BitTorrent.DHT.TestData
                       Network.BitTorrent.DHT.MessageSpec
                       Network.BitTorrent.DHT.QuerySpec
                       Network.DHT.RoutingSpec
                       Network.BitTorrent.DHT.SessionSpec
                       Network.BitTorrent.DHT.TokenSpec
                       Network.BitTorrent.Internal.CacheSpec
                       Network.BitTorrent.Internal.ProgressSpec
                       Network.BitTorrent.Tracker.TestData
                       Network.BitTorrent.Tracker.ListSpec
                       Network.BitTorrent.Tracker.MessageSpec
                       Network.BitTorrent.Tracker.RPCSpec
                       Network.BitTorrent.Tracker.RPC.HTTPSpec
                       Network.BitTorrent.Tracker.RPC.UDPSpec
                       Network.BitTorrent.Tracker.SessionSpec
                       Network.BitTorrent.Exchange.BitfieldSpec
                       Network.BitTorrent.Exchange.ConnectionSpec
                       Network.BitTorrent.Exchange.DownloadSpec
                       Network.BitTorrent.Exchange.MessageSpec
                       Network.BitTorrent.Exchange.SessionSpec
                       System.Torrent.StorageSpec
                       System.Torrent.FileMapSpec
  build-depends:       base == 4.*

                       -- * Concurrency
                     , async

                       -- * Data
                     , bytestring
                     , bytestring-arbitrary
                     , containers
                     , convertible
                     , data-default
                     , text
                     , time

                       -- * Serialization
                     , cereal

                       -- * Monads
                     , mtl
                     , resourcet
                     , conduit
                     , conduit-extra
                     , monad-loops
                     , monad-logger

                       -- * Network
                     , http-types
                     , iproute

                       -- * System
                     , optparse-applicative >= 0.8
                     , process
                     , directory
                     , filepath

                       -- * Testing
                     , hspec >= 1.8.2
                     , QuickCheck
                     , quickcheck-instances

                       -- * Bittorrent
                     , bittorrent
                     , temporary
                     , bencoding         >= 0.4.3
  if flag(network-uri)
    Build-depends:     network      >= 2.6
                     , network-uri  >= 2.6
  else
    Build-depends:     network      >= 2.4 && < 2.6
  ghc-options:         -Wall -fno-warn-orphans


--benchmark bench
--  default-language:    Haskell2010
--  default-extensions:
--  type:                exitcode-stdio-1.0
--  hs-source-dirs:      bench
--  main-is:             Main.hs
--  build-depends:       base
--                     , bytestring
--                     , cereal
--                     , network
--
--                     , criterion
--                     , deepseq
--
--                     , bittorrent
--  ghc-options:         -O2 -Wall -fno-warn-orphans
benchmark bench
  type:                exitcode-stdio-1.0
  default-language:    Haskell2010
  hs-source-dirs:      bench
  main-is:             Main.hs
  build-depends:       base == 4.*
                     , bytestring
                     , mtl
                     , monad-logger
                     , criterion
  ghc-options:         -O2 -fforce-recomp

executable dht
  hs-source-dirs:      examples
  main-is:             dht.hs
  default-language:    Haskell2010
  build-depends:       base, haskeline, network, bytestring, transformers

executable dhtd
  hs-source-dirs:      examples
  main-is:             dhtd.hs
  default-language:    Haskell2010
  build-depends:       base, network, bytestring, hashable, deepseq
                     , aeson
                     , pretty
                     , bittorrent
                     , unix
                     , containers
                     , stm
                     , cereal
                     , bencoding
  if flag(thread-debug)
    build-depends: time
    cpp-options:   -DTHREAD_DEBUG

-- Utility to work with torrent files.
executable mktorrent
  if !flag(examples)
    buildable:         False
  default-language:    Haskell2010
  hs-source-dirs:      examples
  main-is:             MkTorrent.hs
  other-modules:       Paths_bittorrent
  build-depends:       base == 4.*
                     , bytestring
                     , text
                     , pretty

                     , mtl
                     , conduit
                     , lens
                     , lifted-async
                     , parallel-io

                     , bittorrent

                     , filepath
                     , optparse-applicative
                     , hslogger
--  if flag(network-uri)
--    Build-depends:
                     , network      >= 2.6
                     , network-uri  >= 2.6
--  else
--    Build-depends:     network      >= 2.4 && < 2.6
  ghc-options:         -Wall -O2 -threaded

-- nonfunctioning example of very basic bittorrent client
executable client
  if !flag(examples)
    buildable:         False
  default-language:    Haskell2010
  hs-source-dirs:      examples
  main-is:             Client.hs
  build-depends:       base        == 4.*
                     , bittorrent
                     , mtl
                     , pretty
                     , data-default
                     , optparse-applicative