File entropy.cabal of Package ghc-entropy

name:           entropy

x-revision: 1
description:    A mostly platform independent method to obtain cryptographically strong entropy
                (RDRAND, urandom, CryptAPI, and patches welcome)
                Users looking for cryptographically strong (number-theoretically
                sound) PRNGs should see the 'DRBG' package too.
synopsis:       A platform independent entropy source
license:        BSD3
license-file:   LICENSE
copyright:      Thomas DuBuisson <>
author:         Thomas DuBuisson <>
maintainer:     Thomas DuBuisson <>
category:       Data, Cryptography
stability:      stable

build-type:     Custom

-- ^^ Test for RDRAND support using 'ghc'
cabal-version:  >=1.10
tested-with:    GHC == 8.2.2
-- data-files:
extra-source-files:   ./cbits/getrandom.c ./cbits/random_initialized.c ./cbits/rdrand.c, ./cbits/rdrand.h,

Flag DoNotGetEntropy
  Description: Avoid use of the getentropy() *nix function. By default getentropy will be used
               if detected during compilation (this plays poorly with cross compilation).
  Default: False
  Manual: True

  setup-depends: Cabal >= 1.10 && < 3.11
    -- Relax Cabal:
               , base < 5
               , filepath < 1.5
               , directory < 1.4
               , process < 1.7

  ghc-options:  -O2
  exposed-modules: System.Entropy
  if impl(ghcjs) || os(ghcjs)
    other-modules: System.EntropyGhcjs
  else {
    if os(windows)
      other-modules: System.EntropyWindows
    else {
      other-modules: System.EntropyNix
  other-extensions:    CPP, ForeignFunctionInterface, BangPatterns,
  build-depends:       base >= 4.8 && < 5, bytestring

  default-language:    Haskell2010

  if impl(ghcjs) || os(ghcjs) {
    build-depends:     ghcjs-dom >= && < 1
                     , jsaddle
  else {
    if arch(x86_64)
      cpp-options: -Darch_x86_64
      cc-options:  -Darch_x86_64 -O2
      -- gcc 4.8.2 on i386 fails to compile rdrand.c when using -fPIC!
      c-sources:    cbits/rdrand.c
      include-dirs: cbits
    if arch(i386)
      cpp-options: -Darch_i386
      cc-options:  -Darch_i386 -O2
    if os(windows)
      build-depends: Win32 >= 2.5
      cpp-options: -DisWindows
      cc-options:  -DisWindows
      extra-libraries: advapi32
      Build-Depends: unix
      c-sources: cbits/getrandom.c cbits/random_initialized.c
  if flag(DoNotGetEntropy) {
    cc-options: -DDO_NOT_USE_GET_ENTROPY

source-repository head
    type:       git
openSUSE Build Service is sponsored by