summaryrefslogtreecommitdiff
path: root/unix-compat.cabal
blob: c496f9c7b314cc35281d2050408d3d7d080f82b9 (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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name:           unix-compat
version:        0.6
x-revision: 1
synopsis:       Portable POSIX-compatibility layer.
description:    This package provides portable implementations of parts
                of the unix package. This package re-exports the unix
                package when available. When it isn't available,
                portable implementations are used.

homepage:       http://github.com/jacobstanley/unix-compat
license:        BSD3
license-file:   LICENSE
author:         Björn Bringert, Duncan Coutts, Jacob Stanley, Bryan O'Sullivan
maintainer:     Jacob Stanley <jacob@stanley.io>
category:       System
build-type:     Simple
cabal-version:  >= 1.10

extra-source-files:
  CHANGELOG.md

source-repository head
  type:     git
  location: git@github.com:jacobstanley/unix-compat.git

flag old-time
  description: build against old-time package
  default: False

Library
  default-language: Haskell2010
  hs-source-dirs: src
  ghc-options: -Wall
  build-depends: base == 4.*

  exposed-modules:
    System.PosixCompat
    System.PosixCompat.Extensions
    System.PosixCompat.Files
    System.PosixCompat.Temp
    System.PosixCompat.Time
    System.PosixCompat.Types
    System.PosixCompat.Unistd
    System.PosixCompat.User

  if os(windows)
    c-sources:
      cbits/HsUname.c
      cbits/mktemp.c

    extra-libraries: msvcrt
    build-depends: Win32 >= 2.5.0.0
    build-depends: filepath >= 1.0 && < 1.5

    if flag(old-time)
      build-depends: old-time >= 1.0.0.0 && < 1.2.0.0
      cpp-options: -DOLD_TIME

      if impl(ghc < 7)
        build-depends: directory == 1.0.*
        cpp-options: -DDIRECTORY_1_0
      else
        build-depends: directory == 1.1.*
    else
      build-depends: time >= 1.0 && < 1.13
      build-depends: directory >= 1.3.1 && < 1.4

    other-modules:
      System.PosixCompat.Internal.Time

  else
    build-depends: unix >= 2.6 && < 2.8
    include-dirs: include
    includes: HsUnixCompat.h
    install-includes: HsUnixCompat.h
    c-sources: cbits/HsUnixCompat.c
    if os(solaris)
      cc-options: -DSOLARIS

Test-Suite unix-compat-testsuite
  default-language: Haskell2010
  type: exitcode-stdio-1.0
  hs-source-dirs: tests
  ghc-options: -Wall
  main-is: main.hs

  other-modules:
     MkstempSpec
     LinksSpec

  -- ghc-options:
  --   -Wall
  --   -fwarn-tabs
  --   -funbox-strict-fields
  --   -threaded
  --   -fno-warn-unused-do-bind
  --   -fno-warn-type-defaults

  -- extensions:
  --   OverloadedStrings
  --   ExtendedDefaultRules

  -- if flag(lifted)
  --    cpp-options: -DLIFTED

  build-depends:
      unix-compat
    , base == 4.*
    , monad-parallel
    , hspec
    , HUnit
    , directory
    , extra
    , temporary

  if os(windows)
    -- c-sources:
    --   cbits/HsUname.c
    --   cbits/mktemp.c

    -- extra-libraries: msvcrt
    -- build-depends: Win32 >= 2.5.0.0

    if flag(old-time)
      build-depends: old-time >= 1.0.0.0 && < 1.2.0.0
      cpp-options: -DOLD_TIME

      if impl(ghc < 7)
        build-depends: directory == 1.0.*
        cpp-options: -DDIRECTORY_1_0
      else
        build-depends: directory == 1.1.*
    else
      build-depends: time >= 1.0 && < 1.13
      build-depends: directory >= 1.3.1 && < 1.4

    -- other-modules:
    --   System.PosixCompat.Internal.Time

  else
    -- build-depends: unix >= 2.4 && < 2.9
    -- include-dirs: include
    -- includes: HsUnixCompat.h
    -- install-includes: HsUnixCompat.h
    -- c-sources: cbits/HsUnixCompat.c
    if os(solaris)
      cc-options: -DSOLARIS

    build-depends: directory >= 1.3.1 && < 1.4