packages feed

Z-IO-0.1.2.0: Z-IO.cabal

name:                       Z-IO
version:                    0.1.2.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

                            -- zlib C sources
                            third_party/zlib/crc32.h
                            third_party/zlib/inffast.h 
                            third_party/zlib/inflate.h
                            third_party/zlib/trees.h 
                            third_party/zlib/deflate.h 
                            third_party/zlib/inffixed.h
                            third_party/zlib/inftrees.h 
                            third_party/zlib/zutil.h
                            third_party/zlib/gzguts.h

                            -- libuv C sources
                            third_party/libuv/include/uv.h
                            third_party/libuv/include/uv/aix.h
                            third_party/libuv/include/uv/android-ifaddrs.h
                            third_party/libuv/include/uv/bsd.h
                            third_party/libuv/include/uv/darwin.h
                            third_party/libuv/include/uv/errno.h
                            third_party/libuv/include/uv/linux.h
                            third_party/libuv/include/uv/os390.h
                            third_party/libuv/include/uv/posix.h
                            third_party/libuv/include/uv/stdint-msvc2008.h
                            third_party/libuv/include/uv/sunos.h
                            third_party/libuv/include/uv/threadpool.h
                            third_party/libuv/include/uv/tree.h
                            third_party/libuv/include/uv/unix.h
                            third_party/libuv/include/uv/version.h
                            third_party/libuv/include/uv/win.h

                            third_party/libuv/src/heap-inl.h
                            third_party/libuv/src/idna.h
                            third_party/libuv/src/queue.h
                            third_party/libuv/src/strscpy.h
                            third_party/libuv/src/uv-common.h

                            third_party/libuv/src/win/atomicops-inl.h
                            third_party/libuv/src/win/handle-inl.h
                            third_party/libuv/src/win/internal.h
                            third_party/libuv/src/win/req-inl.h
                            third_party/libuv/src/win/stream-inl.h
                            third_party/libuv/src/win/winapi.h
                            third_party/libuv/src/win/winsock.h

                            third_party/libuv/src/unix/atomic-ops.h
                            third_party/libuv/src/unix/darwin-stub.h
                            third_party/libuv/src/unix/darwin-stub.h
                            third_party/libuv/src/unix/internal.h
                            third_party/libuv/src/unix/linux-syscalls.h
                            third_party/libuv/src/unix/spinlock.h
                            third_party/libuv/src/unix/os390-syscalls.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

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.*

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

    include-dirs:           include
                            third_party/zlib

    includes:               hs_uv.h
                            zlib.h
                            zconf.h

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

    cc-options:             -march=native
    c-sources:              cbits/hs_uv_base.c
                            cbits/hs_uv_dns.c
                            cbits/hs_uv_file.c
                            cbits/hs_uv_stream.c
                            cbits/hs_uv_udp.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

                            third_party/libuv/src/fs-poll.c
                            third_party/libuv/src/idna.c
                            third_party/libuv/src/inet.c
                            third_party/libuv/src/random.c
                            third_party/libuv/src/strscpy.c
                            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/version.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/win/async.c
                            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/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/signal.c
                            third_party/libuv/src/win/stream.c
                            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/winsock.c

        cc-options:         -Wall -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600 -O -march=native
        cpp-options:        -Wall -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 os(linux)
            c-sources:          third_party/libuv/src/fs-poll.c
                                third_party/libuv/src/idna.c
                                third_party/libuv/src/inet.c
                                third_party/libuv/src/random.c
                                third_party/libuv/src/strscpy.c
                                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/version.c


                               third_party/libuv/src/unix/async.c
                               third_party/libuv/src/unix/core.c
                               third_party/libuv/src/unix/dl.c
                               third_party/libuv/src/unix/fs.c
                               third_party/libuv/src/unix/getaddrinfo.c
                               third_party/libuv/src/unix/getnameinfo.c
                               third_party/libuv/src/unix/loop.c
                               third_party/libuv/src/unix/loop-watcher.c
                               third_party/libuv/src/unix/pipe.c
                               third_party/libuv/src/unix/poll.c
                               third_party/libuv/src/unix/process.c
                               third_party/libuv/src/unix/random-devurandom.c
                               third_party/libuv/src/unix/signal.c
                               third_party/libuv/src/unix/stream.c
                               third_party/libuv/src/unix/tcp.c
                               third_party/libuv/src/unix/thread.c
                               third_party/libuv/src/unix/tty.c
                               third_party/libuv/src/unix/udp.c

                               third_party/libuv/src/unix/linux-core.c
                               third_party/libuv/src/unix/linux-inotify.c
                               third_party/libuv/src/unix/linux-syscalls.c
                               third_party/libuv/src/unix/procfs-exepath.c
                               third_party/libuv/src/unix/proctitle.c
                               third_party/libuv/src/unix/random-getrandom.c
                               third_party/libuv/src/unix/random-sysctl-linux.c

            include-dirs:       third_party/libuv/include
                                third_party/libuv/src/unix
                                third_party/libuv/src
            cc-options:        -Wall -O -march=native
        else
            if os(osx)
                c-sources:          third_party/libuv/src/fs-poll.c
                                    third_party/libuv/src/idna.c
                                    third_party/libuv/src/inet.c
                                    third_party/libuv/src/random.c
                                    third_party/libuv/src/strscpy.c
                                    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/version.c


                                   third_party/libuv/src/unix/async.c
                                   third_party/libuv/src/unix/core.c
                                   third_party/libuv/src/unix/dl.c
                                   third_party/libuv/src/unix/fs.c
                                   third_party/libuv/src/unix/getaddrinfo.c
                                   third_party/libuv/src/unix/getnameinfo.c
                                   third_party/libuv/src/unix/loop.c
                                   third_party/libuv/src/unix/loop-watcher.c
                                   third_party/libuv/src/unix/pipe.c
                                   third_party/libuv/src/unix/poll.c
                                   third_party/libuv/src/unix/process.c
                                   third_party/libuv/src/unix/random-devurandom.c
                                   third_party/libuv/src/unix/signal.c
                                   third_party/libuv/src/unix/stream.c
                                   third_party/libuv/src/unix/tcp.c
                                   third_party/libuv/src/unix/thread.c
                                   third_party/libuv/src/unix/tty.c
                                   third_party/libuv/src/unix/udp.c

                                   third_party/libuv/src/unix/bsd-ifaddrs.c
                                   third_party/libuv/src/unix/darwin-proctitle.c
                                   third_party/libuv/src/unix/darwin.c
                                   third_party/libuv/src/unix/fsevents.c
                                   third_party/libuv/src/unix/kqueue.c
                                   third_party/libuv/src/unix/proctitle.c
                                   third_party/libuv/src/unix/random-getrandom.c
                                   
                include-dirs:       third_party/libuv/include
                                    third_party/libuv/src/unix
                                    third_party/libuv/src
                cc-options:         -Wall -O -march=native

            else
                if flag(no-pkg-config)
                    extra-libraries:    uv
                else
                    pkgconfig-depends:  libuv >= 1.32
        


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.Compression.ZlibSpec
                            Z.IO.FileSystem.ThreadedSpec
                            Z.IO.FileSystemSpec
                            Z.IO.Network.UDPSpec
                            Z.IO.Network.TCPSpec
                            -- Z.IO.Network.IPCSpec
                            Z.IO.LowResTimerSpec
                            Z.IO.ResourceSpec

    ghc-options:            -threaded
    default-language:       Haskell2010