Support being built with crypton rather than cryptonite

crypton is a fork of cryptonite, and cryptonite's github repo has been
archived. Some deps are already using cryptonite so it's clearly the way
forward.

Added a build flag without a default, so cabal configure will select on its
own which to use. stack files pin to cryptonite for now.

Sponsored-by: Nicholas Golder-Manning on Patreon
This commit is contained in:
Joey Hess 2023-09-21 12:43:42 -04:00
parent e03e907705
commit 54da44d42a
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 19 additions and 3 deletions

View file

@ -75,7 +75,11 @@ dependencyVersions = map fmt $ sortBy (comparing (CI.mk . fst))
, ("bloomfilter", VERSION_bloomfilter)
, ("http-client", VERSION_http_client)
, ("persistent-sqlite", VERSION_persistent_sqlite)
#ifdef WITH_CRYPTON
, ("crypton", VERSION_crypton)
#else
, ("cryptonite", VERSION_cryptonite)
#endif
, ("aws", VERSION_aws)
, ("DAV", VERSION_DAV)
#ifdef WITH_TORRENTPARSER

View file

@ -12,6 +12,7 @@ git-annex (10.20230829) UNRELEASED; urgency=medium
* push: When on an adjusted branch, propagate changes to parent branch
before updating export remotes.
* lookupkey: Added --ref option.
* Support being built with crypton rather than cryptonite.
-- Joey Hess <id@joeyh.name> Mon, 28 Aug 2023 13:10:17 -0400

View file

@ -76,8 +76,8 @@ import qualified Data.ByteString.Lazy as L
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Data.IORef
import "cryptonite" Crypto.MAC.HMAC hiding (Context)
import "cryptonite" Crypto.Hash
import Crypto.MAC.HMAC hiding (Context)
import Crypto.Hash
sha1 :: L.ByteString -> Digest SHA1
sha1 = hashlazy

View file

@ -165,6 +165,9 @@ Flag TorrentParser
Flag MagicMime
Description: Use libmagic to determine file MIME types
Flag Crypton
Description: Use the crypton library rather than the no longer maintained cryptonite
Flag Benchmark
Description: Enable benchmarking
Default: True
@ -254,7 +257,6 @@ Executable git-annex
stm-chans,
securemem,
crypto-api,
cryptonite (>= 0.23),
memory,
deepseq,
split,
@ -294,6 +296,12 @@ Executable git-annex
if os(linux) || os(freebsd)
GHC-Options: -optl-Wl,--as-needed
if flag(Crypton)
Build-Depends: crypton
CPP-Options: -DWITH_CRYPTON
else
Build-Depends: cryptonite (>= 0.23)
if (os(windows))
Build-Depends:
Win32 ((>= 2.6.1.0 && < 2.12.0.0) || >= 2.13.4.0),

View file

@ -8,6 +8,7 @@ flags:
dbus: false
debuglocks: false
benchmark: true
crypton: false
packages:
- '.'
resolver: lts-18.13

View file

@ -8,6 +8,7 @@ flags:
dbus: false
debuglocks: false
benchmark: true
crypton: false
packages:
- '.'
resolver: nightly-2023-08-01

View file

@ -8,6 +8,7 @@ flags:
dbus: false
debuglocks: false
benchmark: false
crypton: false
packages:
- '.'
extra-deps: