name:                stdio
version:             0.2.0.0
synopsis:            A simple and high performance IO toolkit for Haskell
description:         This package provides a simple and high performance IO toolkit for Haskell, including
                     packed vectors, unicode texts, socket, file system, timers and more!
license:             BSD3
license-file:        LICENSE
author:              Dong Han, Tao He
maintainer:          winterland1989@gmail.com
copyright:           (c) Dong Han, 2017-2018
                     (c) Tao He, 2017-2019
category:            Data
build-type:          Simple
cabal-version:       >=1.10
homepage:            https://github.com/haskell-stdio/stdio
bug-reports:         https://github.com/haskell-stdio/stdio/issues

extra-source-files:  ChangeLog.md
                     README.md
                     LICENSE

                     include/bytes.h
                     include/dtoa.h
                     include/hs_uv.h
                     include/text.h
                     cbits/bytes.c
                     cbits/dtoa.c
                     cbits/hs_uv_base.c
                     cbits/hs_uv_stream.c
                     cbits/hs_uv_udp.c
                     cbits/hs_uv_file.c
                     cbits/text.c

                     -- libuv C sources (for Windows)
                     third_party/libuv/include/uv.h
                     third_party/libuv/include/uv/win.h
                     third_party/libuv/include/uv/tree.h
                     third_party/libuv/include/uv/errno.h
                     third_party/libuv/include/uv/threadpool.h
                     third_party/libuv/include/uv/version.h
                     third_party/libuv/include/uv/stdint-msvc2008.h

                     third_party/libuv/src/fs-poll.c 
                     third_party/libuv/src/heap-inl.h 
                     third_party/libuv/src/idna.c 
                     third_party/libuv/src/idna.h
                     third_party/libuv/src/inet.c 
                     third_party/libuv/src/queue.h 
                     third_party/libuv/src/strscpy.c 
                     third_party/libuv/src/strscpy.h 
                     third_party/libuv/src/threadpool.c 
                     third_party/libuv/src/timer.c 
                     third_party/libuv/src/uv-common.c 
                     third_party/libuv/src/uv-common.h 
                     third_party/libuv/src/uv-data-getter-setters.c 
                     third_party/libuv/src/version.c

                     third_party/libuv/src/win/async.c 
                     third_party/libuv/src/win/atomicops-inl.h 
                     third_party/libuv/src/win/core.c 
                     third_party/libuv/src/win/detect-wakeup.c 
                     third_party/libuv/src/win/dl.c 
                     third_party/libuv/src/win/error.c 
                     third_party/libuv/src/win/fs.c 
                     third_party/libuv/src/win/fs-event.c 
                     third_party/libuv/src/win/getaddrinfo.c 
                     third_party/libuv/src/win/getnameinfo.c 
                     third_party/libuv/src/win/handle.c 
                     third_party/libuv/src/win/handle-inl.h 
                     third_party/libuv/src/win/internal.h 
                     third_party/libuv/src/win/loop-watcher.c 
                     third_party/libuv/src/win/pipe.c 
                     third_party/libuv/src/win/poll.c 
                     third_party/libuv/src/win/process.c 
                     third_party/libuv/src/win/process-stdio.c 
                     third_party/libuv/src/win/req-inl.h 
                     third_party/libuv/src/win/signal.c 
                     third_party/libuv/src/win/snprintf.c 
                     third_party/libuv/src/win/stream.c 
                     third_party/libuv/src/win/stream-inl.h 
                     third_party/libuv/src/win/tcp.c 
                     third_party/libuv/src/win/thread.c 
                     third_party/libuv/src/win/tty.c 
                     third_party/libuv/src/win/udp.c 
                     third_party/libuv/src/win/util.c 
                     third_party/libuv/src/win/winapi.c 
                     third_party/libuv/src/win/winapi.h 
                     third_party/libuv/src/win/winsock.c 
                     third_party/libuv/src/win/winsock.h

                     -- utf8rewind C sources
                     third_party/utf8rewind/include/utf8rewind/utf8rewind.h
                     third_party/utf8rewind/source/unicodedatabase.c
                     third_party/utf8rewind/source/unicodedatabase.h
                     third_party/utf8rewind/source/internal/base.h
                     third_party/utf8rewind/source/internal/casemapping.c
                     third_party/utf8rewind/source/internal/casemapping.h
                     third_party/utf8rewind/source/internal/codepoint.c
                     third_party/utf8rewind/source/internal/codepoint.h
                     third_party/utf8rewind/source/internal/composition.c
                     third_party/utf8rewind/source/internal/composition.h
                     third_party/utf8rewind/source/internal/database.c
                     third_party/utf8rewind/source/internal/database.h
                     third_party/utf8rewind/source/internal/decomposition.c
                     third_party/utf8rewind/source/internal/decomposition.h
                     third_party/utf8rewind/source/internal/seeking.c
                     third_party/utf8rewind/source/internal/seeking.h
                     third_party/utf8rewind/source/internal/streaming.c
                     third_party/utf8rewind/source/internal/streaming.h
                     third_party/utf8rewind/source/utf8rewind.c

                     -- simd utf8 code
                     third_party/fastvalidate-utf-8/include/simdasciicheck.h
                     third_party/fastvalidate-utf-8/include/simdutf8check.h

source-repository head
  type:     git
  location: git://github.com/haskell-stdio/stdio.git

flag no-pkg-config
  description: Don't use pkg-config to check for library dependences
  default: False
  manual: True

flag integer-simple
  description:
    Use the [simple integer library](http://hackage.haskell.org/package/integer-simple)
    instead of [integer-gmp](http://hackage.haskell.org/package/integer-gmp)
  default: False
  manual: False

library
    exposed-modules:        Std.Data.Vector
                            Std.Data.Vector.Base
                            Std.Data.Vector.Extra
                            Std.Data.Vector.Search
                            Std.Data.Vector.Sort
                            Std.Data.Vector.QQ
                            Std.Data.Vector.FlatIntMap
                            Std.Data.Vector.FlatIntSet
                            Std.Data.Vector.FlatMap
                            Std.Data.Vector.FlatSet
                            Std.Data.PrimArray.Cast
                            Std.Data.PrimArray.QQ
                            Std.Data.PrimArray.BitTwiddle
                            Std.Data.PrimArray.UnalignedAccess
                            Std.Data.Array
                            Std.Data.Array.Checked
                            -- Std.Data.Array.Compound
                            Std.Data.CBytes

                            Std.Data.Text
                            Std.Data.Text.Base
                            Std.Data.Text.Extra
                            Std.Data.Text.Search
                            Std.Data.Text.UTF8Codec
                            Std.Data.Text.UTF8Rewind
                            Std.Data.TextBuilder

                            Std.Data.Builder
                            Std.Data.Builder.Base
                            Std.Data.Builder.Numeric
                            Std.Data.Builder.Numeric.DigitTable
                            
                            Std.Data.Generics.Utils
                            
                            Std.Data.Parser
                            Std.Data.Parser.Base
                            Std.Data.Parser.Numeric

                            Std.Data.PrimIORef
                            Std.Data.PrimSTRef
                            Std.Data.PrimSTRef.Base

                            Std.Data.LEON
                            Std.Data.JSON
                            Std.Data.JSON.Base
                            Std.Data.JSON.Builder
                            Std.Data.JSON.Value

                            Std.Foreign.PrimArray

                            Std.IO.Resource
                            Std.IO.LowResTimer
                            Std.IO.Logger
                            Std.IO.Exception 
                            Std.IO.Buffered
                            Std.IO.FileSystem
                            Std.IO.FileSystemT
                            Std.IO.TCP
                            Std.IO.UDP
                            Std.IO.SockAddr
                            Std.IO.StdStream

                            Std.IO.UV.Errno
                            Std.IO.UV.FFI
                            Std.IO.UV.Manager

    -- other-modules:         

    -- other-extensions:    

    build-depends:          base >=4.12 && <5.0
                        ,   ghc-prim  >= 0.5.3 && <= 0.5.4
                        ,   primitive >= 0.6.4 && <= 0.6.5
                        ,   exceptions == 0.10.*
                        ,   scientific == 0.3.*
                        ,   hashable   == 1.2.*
                        ,   case-insensitive == 1.2.*
                        ,   time       >= 1.8 && < 2.0
                        ,   deepseq    >= 1.4 && < 1.5
                        ,   QuickCheck >= 2.10
                        ,   template-haskell == 2.14.*
                        ,   stm        == 2.5.*
                        ,   unordered-containers == 0.2.*
                        ,   tagged     == 0.8.*

  if flag(integer-simple)
    cpp-options: -DINTEGER_SIMPLE
    build-depends: integer-simple >= 0.1 && < 0.5
  else
    cpp-options: -DINTEGER_GMP
    build-depends: integer-gmp >= 0.2 && < 1.1

    include-dirs:       include
                        third_party/utf8rewind/include/utf8rewind
                        third_party/utf8rewind/source/internal
                        third_party/utf8rewind/source
                        third_party/fastvalidate-utf-8/include
    includes:           bytes.h
                        dtoa.h
                        hs_uv.h
                        text.h
                        utf8rewind.h
                        simdasciicheck.h
                        simdutf8check.h
    install-includes:   bytes.h
                        dtoa.h
                        hs_uv.h
                        text.h
                        utf8rewind.h
                        simdasciicheck.h
                        simdutf8check.h
    cc-options:         -march=native
    c-sources:          cbits/bytes.c
                        cbits/dtoa.c
                        cbits/text.c
                        cbits/hs_uv_base.c
                        cbits/hs_uv_stream.c
                        cbits/hs_uv_udp.c
                        cbits/hs_uv_file.c
                        third_party/utf8rewind/source/unicodedatabase.c
                        third_party/utf8rewind/source/internal/casemapping.c
                        third_party/utf8rewind/source/internal/codepoint.c
                        third_party/utf8rewind/source/internal/composition.c
                        third_party/utf8rewind/source/internal/database.c
                        third_party/utf8rewind/source/internal/decomposition.c
                        third_party/utf8rewind/source/internal/seeking.c
                        third_party/utf8rewind/source/internal/streaming.c
                        third_party/utf8rewind/source/utf8rewind.c

    if os(windows)
      c-sources:
        -- Note: The c-sources list is taken from libuv's Makefile.mingw, needs to be
        -- updated when we bump up libuv's version.
        -- header files are ignored here, otherwise will confuse linker 
        third_party/libuv/src/fs-poll.c 
        -- third_party/libuv/src/heap-inl.h 
        third_party/libuv/src/idna.c 
        third_party/libuv/src/inet.c 
        -- third_party/libuv/src/queue.h 
        third_party/libuv/src/strscpy.c 
        -- third_party/libuv/src/strscpy.h 
        third_party/libuv/src/threadpool.c 
        third_party/libuv/src/timer.c 
        third_party/libuv/src/uv-data-getter-setters.c 
        third_party/libuv/src/uv-common.c 
        -- third_party/libuv/src/uv-common.h 
        third_party/libuv/src/version.c

        third_party/libuv/src/win/async.c 
        -- third_party/libuv/src/win/atomicops-inl.h 
        third_party/libuv/src/win/core.c 
        third_party/libuv/src/win/detect-wakeup.c 
        third_party/libuv/src/win/dl.c 
        third_party/libuv/src/win/error.c 
        third_party/libuv/src/win/fs-event.c 
        third_party/libuv/src/win/fs.c 
        third_party/libuv/src/win/getaddrinfo.c 
        third_party/libuv/src/win/getnameinfo.c 
        third_party/libuv/src/win/handle.c 
        -- third_party/libuv/src/win/handle-inl.h 
        -- third_party/libuv/src/win/internal.h 
        third_party/libuv/src/win/loop-watcher.c 
        third_party/libuv/src/win/pipe.c 
        third_party/libuv/src/win/poll.c 
        third_party/libuv/src/win/process-stdio.c 
        third_party/libuv/src/win/process.c 
        -- third_party/libuv/src/win/req-inl.h 
        third_party/libuv/src/win/signal.c 
        third_party/libuv/src/win/stream.c 
        -- third_party/libuv/src/win/stream-inl.h 
        third_party/libuv/src/win/tcp.c 
        third_party/libuv/src/win/thread.c 
        third_party/libuv/src/win/tty.c 
        third_party/libuv/src/win/udp.c 
        third_party/libuv/src/win/util.c 
        third_party/libuv/src/win/winapi.c 
        -- third_party/libuv/src/win/winapi.h 
        third_party/libuv/src/win/winsock.c 
        -- third_party/libuv/src/win/winsock.h

      cc-options:        -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600 -march=native
      cpp-options:       -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600
      include-dirs:      third_party/libuv/include
                         third_party/libuv/src
      -- The C runtime dependencies are imposed by libuv.
      extra-libraries:   psapi, Iphlpapi, userenv, Ws2_32
    else
      if flag(no-pkg-config)
        extra-libraries:   uv
      else
        pkgconfig-depends: libuv  >= 1.14

    -- hs-source-dirs:
    default-language:    Haskell2010
    build-tools:         hsc2hs, hspec-discover
    -- ghc-options:         -Wall

test-suite test
    type: exitcode-stdio-1.0
    main-is: Spec.hs
    hs-source-dirs: test
    build-depends:  stdio
                  , base
                  , hspec >= 2.5.4
                  , hashable
                  , HUnit
                  , QuickCheck >= 2.10
                  , quickcheck-instances
                  , word8
                  , scientific
                  , primitive

    other-modules:
        Std.Data.Builder.NumericSpec
        Std.Data.JSON.BaseSpec
        Std.Data.JSON.ValueSpec
        Std.Data.Parser.BaseSpec
        Std.Data.Parser.NumericSpec
        Std.Data.PrimArray.UnalignedAccessSpec
        Std.Data.Text.BaseSpec
        Std.Data.Text.ExtraSpec
        Std.Data.Text.SearchSpec
        Std.Data.Vector.BaseSpec
        Std.Data.Vector.ExtraSpec
        Std.Data.Vector.SearchSpec
        Std.Data.Vector.SortSpec
        Std.Data.Vector.FlatMapSpec 
        Std.Data.Vector.FlatSetSpec
        Std.Data.CBytesSpec
        Std.Data.LEONSpec
        Std.Data.TextBuilderSpec
        Std.IO.FileSystemSpec
        Std.IO.FileSystemTSpec
        Std.IO.LowResTimerSpec
        Std.IO.ResourceSpec
        Std.IO.UDPSpec

    ghc-options:         -threaded
    default-language:    Haskell2010 

  if flag(integer-simple)
    cpp-options: -DINTEGER_SIMPLE
    build-depends: integer-simple >= 0.1 && < 0.5
  else
    cpp-options: -DINTEGER_GMP
    build-depends: integer-gmp >= 0.2 && < 1.1