packages feed

Z-IO-0.1.1.0: Z-IO.cabal

name:                       Z-IO
version:                    0.1.1.0
synopsis:                   Simple and high performance IO toolkit for Haskell
description:                Simple and high performance IO toolkit for Haskell, including
                            file system, network, ipc and more!
license:                    BSD3
license-file:               LICENSE
author:                     Dong Han, Tao He
maintainer:                 winterland1989@gmail.com
copyright:                  (c) Dong Han, 2017-2020
                            (c) Tao He, 2017-2019
category:                   Data
build-type:                 Simple
cabal-version:              >=1.10
homepage:                   https://github.com/haskell-Z/Z-IO
bug-reports:                https://github.com/haskell-Z/Z-IO/issues

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

                            include/hs_uv.h
                            cbits/hs_uv_base.c
                            cbits/hs_uv_stream.c
                            cbits/hs_uv_udp.c
                            cbits/hs_uv_file.c
                            cbits/hs_uv_dns.c

                            -- zlib C sources
                            third_party/zlib/zconf.h
                            third_party/zlib/zlib.h
                            third_party/zlib/adler32.c
                            third_party/zlib/compress.c
                            third_party/zlib/crc32.c
                            third_party/zlib/deflate.c
                            third_party/zlib/infback.c
                            third_party/zlib/inffast.c
                            third_party/zlib/inflate.c
                            third_party/zlib/inftrees.c
                            third_party/zlib/trees.c
                            third_party/zlib/uncompr.c
                            third_party/zlib/zutil.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

source-repository head
    type:     git
    location: git://github.com/haskell-Z/Z-IO.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:        Z.IO.FileSystem
                            Z.IO.FileSystem.Threaded
                            Z.IO.Network.SocketAddr
                            Z.IO.Network.DNS
                            Z.IO.Network.TCP
                            Z.IO.Network.UDP
                            Z.IO.Network.IPC
                            Z.IO.Network
                            Z.IO.Buffered
                            Z.IO.Exception
                            Z.IO.LowResTimer
                            Z.IO.Logger
                            Z.IO.Resource
                            Z.IO.StdStream

                            Z.IO.UV.Errno
                            Z.IO.UV.FFI
                            Z.IO.UV.Manager
                            Z.IO.UV.Win

                            Z.Compression.Zlib

    build-depends:          base                    >= 4.12 && <5.0
                          , Z-Data                  >= 0.1.3.1 && < 0.1.4
                          , primitive               >= 0.7.1 && < 0.7.2
                          , ghc-prim                >= 0.6.1 && < 0.6.2
                          , exceptions              == 0.10.*
                          , time                    >= 1.8 && < 2.0
                          , stm                     == 2.5.*

    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/zlib

    includes:               hs_uv.h

    install-includes:       hs_uv.h 
                            zlib.h
                            zconf.h

    cc-options:             -march=native
    c-sources:              cbits/hs_uv_base.c
                            cbits/hs_uv_stream.c
                            cbits/hs_uv_udp.c
                            cbits/hs_uv_file.c
                            cbits/hs_uv_dns.c
                            cbits/hs_zlib.c

                            third_party/zlib/adler32.c
                            third_party/zlib/compress.c
                            third_party/zlib/crc32.c
                            third_party/zlib/deflate.c
                            third_party/zlib/infback.c
                            third_party/zlib/inffast.c
                            third_party/zlib/inflate.c
                            third_party/zlib/inftrees.c
                            third_party/zlib/trees.c
                            third_party/zlib/uncompr.c
                            third_party/zlib/zutil.c

    -- 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
    if os(windows)
        c-sources:          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

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

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

    other-modules:          Z.IO.FileSystemSpec
                            Z.IO.FileSystem.ThreadedSpec
                            Z.IO.LowResTimerSpec
                            Z.IO.ResourceSpec
                            Z.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