168 lines
4.4 KiB
Plaintext
168 lines
4.4 KiB
Plaintext
cabal-version: 2.2
|
|
name: lukko
|
|
version: 0.1.1.3
|
|
x-revision: 2
|
|
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 ==7.6.3
|
|
|| ==7.8.4
|
|
|| ==7.10.3
|
|
|| ==8.0.2
|
|
|| ==8.2.2
|
|
|| ==8.4.4
|
|
|| ==8.6.5
|
|
|| ==8.8.4
|
|
|| ==8.10.7
|
|
|| ==9.0.1
|
|
|| ==9.2.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.5 && <4.17
|
|
build-tool-depends: hsc2hs:hsc2hs >=0.67 && <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.3.0.0 || ^>=1.4.0.0
|
|
, lukko
|
|
, singleton-bool ^>=0.1.5
|
|
, tasty ^>=1.4.0.1
|
|
, tasty-expected-failure ^>=0.11.1.2 || ^>=0.12.2
|
|
, tasty-hunit ^>=0.10.0.2
|
|
, temporary ^>=1.3
|
|
|
|
if !impl(ghc >=7.8)
|
|
build-depends: tagged ^>=0.8.5
|
|
|
|
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.9.2.1 && <0.12
|
|
, 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
|