-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathlukko.cabal
163 lines (143 loc) · 4.37 KB
/
lukko.cabal
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
cabal-version: 2.2
name: lukko
version: 0.1.2
x-revision: 1
synopsis: File locking
category: System, Concurrency
description:
This package provides access to platform dependent file locking APIs:
.
* <https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html Open file descriptor locking> on Linux ("Lukko.OFD")
* BSD-style @flock(2)@ locks on UNIX platforms ("Lukko.FLock")
* Windows locking via <https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-lockfilee LockFileEx> ("Lukko.Windows")
* No-op locking, which throws exceptions ("Lukko.NoOp")
* "Lukko" module exports the best option for the target platform with uniform API.
.
There are alternative file locking packages:
.
* "GHC.IO.Handle.Lock" in @base >= 4.10@ is good enough for most use cases.
However, uses only 'Handle's so these locks cannot be used for intra-process locking.
(You should use e.g. 'MVar' in addition).
.
* <https://hackage.haskell.org/package/filelock filelock> doesn't support OFD locking.
.
/Lukko/ means lock in Finnish.
.
Submodules "Lukko.OFD", "Lukko.Windows" etc are available based on following conditions.
.
@
if os(windows)
\ cpp-options: -DHAS_WINDOWS_LOCK
.
elif (os(linux) && flag(ofd-locking))
\ cpp-options: -DHAS_OFD_LOCKING
\ cpp-options: -DHAS_FLOCK
.
elif !(os(solaris) || os(aix))
\ cpp-options: -DHAS_FLOCK
@
.
"Lukko.FLock" is available on not (Windows or Solaris or AIX).
"Lukko.NoOp" is always available.
maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
license: GPL-2.0-or-later AND BSD-3-Clause
license-files:
LICENSE
LICENSE.GPLv2
LICENSE.GPLv3
build-type: Simple
extra-source-files: CHANGELOG.md
tested-with:
GHC ==8.6.5
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.8
|| ==9.4.8
|| ==9.6.6
|| ==9.8.4
|| ==9.10.1
|| ==9.12.1
source-repository head
type: git
location: https://github.com/haskellari/lukko/
flag ofd-locking
default: True
manual: True
description:
Enable open file descriptor locking. Available on Linux (kernel 3.15, released Jun 8, 2014).
library
default-language: Haskell2010
hs-source-dirs: src
build-depends: base >=4.12.0.0 && <4.22
build-tool-depends: hsc2hs:hsc2hs >=0.68.5 && <0.69
-- Main library module
exposed-modules:
Lukko
Lukko.NoOp
if os(windows)
hs-source-dirs: src-windows
cpp-options: -DUSE_WINDOWS_LOCK
exposed-modules: Lukko.Windows
c-sources: cbits/windows.c
elif (os(linux) && flag(ofd-locking))
hs-source-dirs: src-ofd
hs-source-dirs: src-flock
hs-source-dirs: src-unix
cpp-options: -DUSE_OFD_LOCKING
exposed-modules: Lukko.OFD
elif !(os(solaris) || os(aix))
hs-source-dirs: src-flock
hs-source-dirs: src-unix
cpp-options: -DUSE_FLOCK
else
hs-source-dirs: src-unix
cpp-options: -DUSE_NOOP
-- Cabal check is silly
if (!os(windows) && !(os(solaris) || os(aix)))
exposed-modules: Lukko.FLock
other-modules:
Lukko.Internal.FD
Lukko.Internal.FillBytes
Lukko.Internal.HandleToFD
Lukko.Internal.Types
test-suite test-thread
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Tests.hs
ghc-options: -threaded
build-depends:
, async ^>=2.2.2
, base
, filepath ^>=1.4.2.1 || ^>=1.5.2.0
, lukko
, singleton-bool ^>=0.1.8
, tasty ^>=1.5
, tasty-expected-failure ^>=0.12.3
, tasty-hunit ^>=0.10.0.2
, temporary ^>=1.3
if os(windows)
cpp-options: -DHAS_WINDOWS_LOCK
elif (os(linux) && flag(ofd-locking))
cpp-options: -DHAS_OFD_LOCKING
cpp-options: -DHAS_FLOCK
elif !(os(solaris) || os(aix))
cpp-options: -DHAS_FLOCK
test-suite test-process
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: TestProcess.hs
ghc-options: -threaded
build-depends:
, base
, bytestring >=0.10.8.2 && <0.13
, lukko
if os(windows)
cpp-options: -DHAS_WINDOWS_LOCK
elif (os(linux) && flag(ofd-locking))
cpp-options: -DHAS_OFD_LOCKING
cpp-options: -DHAS_FLOCK
elif !(os(solaris) || os(aix))
cpp-options: -DHAS_FLOCK