summaryrefslogtreecommitdiff
path: root/libraries/ghc-bignum/ghc-bignum.cabal
blob: 3234450b5f3172d6a1b17248adfc06e090e61cb1 (plain)
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
cabal-version:       2.0
name:                ghc-bignum
version:             1.0
synopsis:            GHC BigNum library
license:             BSD3
license-file:        LICENSE
author:              Sylvain Henry
maintainer:          libraries@haskell.org
bug-reports:         https://gitlab.haskell.org/ghc/ghc/issues/new
category:            Numeric, Algebra, GHC
build-type:          Configure
description:
    This package provides the low-level implementation of the standard
    'BigNat', 'Natural' and 'Integer' types.

extra-source-files:
    aclocal.m4
    cbits/gmp_wrappers.c
    changelog.md
    config.guess
    config.sub
    configure
    configure.ac
    config.mk.in
    install-sh
    ghc-bignum.buildinfo.in

source-repository head
    type:     git
    location: https://gitlab.haskell.org/ghc/ghc.git
    subdir:   libraries/ghc-bignum


Flag Native
    Description: Enable native backend
    Manual: True
    Default: False

Flag FFI
    Description: Enable FFI backend
    Manual: True
    Default: False

Flag GMP
    Description: Enable GMP backend
    Manual: True
    Default: False

Flag Check
    Description: Validate results of the enabled backend against native backend.
    Manual: True
    Default: False

library

  -- check that at least one flag is set
  if !flag(native) && !flag(gmp) && !flag(ffi)
    buildable: False

  -- check that at most one flag is set
  if flag(native) && (flag(gmp) || flag(ffi))
    buildable: False
  if flag(gmp) && flag(ffi)
    buildable: False

  default-language:    Haskell2010
  other-extensions:
    BangPatterns
    CApiFFI
    CPP
    DeriveDataTypeable
    ExplicitForAll
    GHCForeignImportPrim
    MagicHash
    NegativeLiterals
    NoImplicitPrelude
    StandaloneDeriving
    UnboxedTuples
    UnliftedFFITypes
    ForeignFunctionInterface

  build-depends:
    ghc-prim >= 0.5.1.0 && < 0.7

  hs-source-dirs: src/
  include-dirs: include/
  ghc-options: -Wall
  cc-options: -std=c99 -Wall

  -- GHC has wired-in IDs from the ghc-bignum package. Hence the unit-id
  -- of the package should not contain the version: i.e. it must be
  -- "ghc-bignum" and not "ghc-bignum-1.0".
  ghc-options: -this-unit-id ghc-bignum

  include-dirs: include

  if flag(gmp)
      cpp-options: -DBIGNUM_GMP
      other-modules:
         GHC.Num.BigNat.GMP
      c-sources:
         cbits/gmp_wrappers.c

  if flag(ffi)
      cpp-options: -DBIGNUM_FFI
      other-modules:
         GHC.Num.BigNat.FFI

  if flag(native)
      cpp-options: -DBIGNUM_NATIVE

  if flag(check)
      cpp-options: -DBIGNUM_CHECK
      other-modules:
         GHC.Num.BigNat.Check


  exposed-modules:
    GHC.Num.Primitives
    GHC.Num.WordArray
    GHC.Num.BigNat
    GHC.Num.BigNat.Native
    GHC.Num.Natural
    GHC.Num.Integer