diff --git a/cardano-crypto-class/cardano-crypto-class.cabal b/cardano-crypto-class/cardano-crypto-class.cabal index 20ba0362c..bd3e5c576 100644 --- a/cardano-crypto-class/cardano-crypto-class.cabal +++ b/cardano-crypto-class/cardano-crypto-class.cabal @@ -39,6 +39,15 @@ flag secp256k1-support default: True manual: True +flag use-haskell-clibs + description: + Use Haskell *-clib packages (blst-clib, sodium-clib, secp256k1-clib) instead + of system-provided C libraries via pkg-config. Don't enable this flag when + building cardano-node! It is there for less sensitive clients, such as + Plinth. + default: False + manual: True + common base build-depends: base >=4.18 && <5 @@ -143,13 +152,19 @@ library th-compat, transformers, vector, + if flag(use-haskell-clibs) + build-depends: + blst-clib >=0.3.14, + sodium-clib + ghc-options: -Wno-unused-packages + else + pkgconfig-depends: + libblst, + libsodium if impl(ghc <9.0.0) build-depends: integer-gmp - pkgconfig-depends: - libblst >=0.3.14, - libsodium, c-sources: cbits/blst_util.c include-dirs: cbits @@ -161,7 +176,10 @@ library Cardano.Crypto.SECP256K1.C Cardano.Crypto.SECP256K1.Constants - pkgconfig-depends: libsecp256k1 + if flag(use-haskell-clibs) + build-depends: secp256k1-clib + else + pkgconfig-depends: libsecp256k1 cpp-options: -DSECP256K1_ENABLED library testlib diff --git a/cardano-crypto-praos/cardano-crypto-praos.cabal b/cardano-crypto-praos/cardano-crypto-praos.cabal index b413ad184..19f7d99c1 100644 --- a/cardano-crypto-praos/cardano-crypto-praos.cabal +++ b/cardano-crypto-praos/cardano-crypto-praos.cabal @@ -60,6 +60,14 @@ flag external-libsodium-vrf default: True manual: True +flag use-haskell-clibs + description: + Use Haskell *-clib packages (sodium-clib) instead of system-provided C + libraries via pkg-config. Don't enable this flag when building cardano-node! + It is there for less sensitive clients, such as Plinth. + default: False + manual: True + common base build-depends: base >=4.18 && <5 @@ -91,7 +99,11 @@ library nothunks, primitive, - pkgconfig-depends: libsodium + if flag(use-haskell-clibs) + build-depends: sodium-clib + ghc-options: -Wno-unused-packages + else + pkgconfig-depends: libsodium if !flag(external-libsodium-vrf) c-sources: