summaryrefslogtreecommitdiff
path: root/bittorrent.cabal
blob: 8ad50ecaf50fbbd94d7e7df835643ed1948e94df (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
name:                  bittorrent
version:               0.1.0.0
license:               MIT
license-file:          LICENSE
author:                Sam T.
maintainer:            Sam T. <pxqr.sta@gmail.com>
copyright:             (c) 2013, Sam T.
category:              Network
build-type:            Simple
cabal-version:         >= 1.8
tested-with:           GHC == 7.4.1
                     , GHC == 7.6.3
homepage:              https://github.com/pxqr/bittorrent
bug-reports:           https://github.com/pxqr/bittorrent/issues
synopsis:              Bittorrent protocol implementation.
description:

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


extra-source-files:    res/dapper-dvd-amd64.iso.torrent
-- not a source file, but we need to keep it in tarball for tests


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

flag testing
  description:         Expose debug stuff in export declarations.
  default:             False

library
  exposed-modules:     Data.Torrent
                     , Data.Bitfield
                     , Network.BitTorrent
                     , Network.BitTorrent.Extension
                     , Network.BitTorrent.Peer
                     , Network.BitTorrent.Tracker
                     , Network.BitTorrent.Exchange
                     , System.Torrent.Storage

  other-modules:       Network.BitTorrent.Internal

  if flag(testing)
     exposed-modules:  Network.BitTorrent.Exchange.Protocol
                     , Network.BitTorrent.Tracker.Protocol
                     , System.IO.MMap.Fixed

  if !flag(testing)
     other-modules:    Network.BitTorrent.Exchange.Protocol
                     , Network.BitTorrent.Tracker.Protocol
                     , System.IO.MMap.Fixed


  build-depends:
                       base       == 4.*

                       -- Control
                     , mtl
                     , resourcet
                     , lens
                     , transformers

                       -- Concurrency
                     , SafeSemaphore
                     , BoundedChan >= 1.0.1.0
                     , stm         >= 2.4

                       -- Conduits
                     , conduit          >= 1.0
                     , network-conduit  >= 1.0
                     , cereal-conduit   >= 0.5
                     , binary-conduit

                       -- Data
                     , array       >= 0.4
                     , bytestring  >= 0.10.0.0

                     , containers  >= 0.4
                     , intset      >= 0.1
                     , IntervalMap >= 0.3

                     , text        >= 0.11.0
                     , vector

                       -- Encoding/Serialization
                     , bencoding   >= 0.1.0.1
                     , cereal      >= 0.3
                     , binary      >= 0.5
                     , urlencoded  >= 0.4

                       -- Time
                     , time        >= 0.1
                     , old-locale  >= 1.0

                       -- Network
                     , network    >= 2.4
                     , HTTP       >= 4000.2
                     , krpc

                       -- System
                     , filepath    >= 1
                     , directory   >= 1
                     , mmap        >= 0.5.2

                       -- Misc
                     , data-default
                     , cryptohash
                     , pretty

--                     , bits-atomic >= 0.1

  extensions:          PatternGuards
  hs-source-dirs:      src
  if flag(testing)
    cpp-options:       -DTESTING
  ghc-options:         -Wall



executable example
  main-is:             Main.hs
  hs-source-dirs:      examples
  build-depends:       base == 4.*
                     , bittorrent
                     , mtl

  ghc-options:         -prof
-- -threaded -eventlog
  ghc-prof-options:   -prof -rtsopts

  if !flag(testing)
     buildable:        False



test-suite info-hash
  type:                exitcode-stdio-1.0
  main-is:             InfoHash.hs
  hs-source-dirs:      tests

  build-depends:       base
                     , bytestring
                     , containers
                     , bencoding
                     , bittorrent
                     , Diff

  ghc-options:         -Wall

  if !flag(testing)
     buildable:        False


test-suite properties
  type:                exitcode-stdio-1.0
  main-is:             Main.hs
  hs-source-dirs:      tests
  build-depends:       base == 4.*
                     , bytestring
                     , directory

                     , cereal
                     , network
                     , text

                     , QuickCheck
                     , HUnit
                     , test-framework
                     , test-framework-quickcheck2
                     , test-framework-hunit

                     , bencoding
                     , bittorrent

  ghc-options:         -Wall -fno-warn-orphans

  if !flag(testing)
     buildable:        False



benchmark benchmarks
  type:                exitcode-stdio-1.0
  main-is:             Main.hs
  hs-source-dirs:      bench

  build-depends:       base
                     , bytestring
                     , cereal
                     , network

                     , criterion
                     , deepseq

                     , bittorrent

  ghc-options:         -O2 -Wall -fno-warn-orphans

  if !flag(testing)
     buildable:        False