packages feed

mercury-api-0.1.0.0: mercury-api.cabal

-- Initial mercury-api.cabal generated by cabal init.  For further
-- documentation, see http://haskell.org/cabal/users-guide/

-- The name of the package.
name:                mercury-api

-- The package version.  See the Haskell package versioning policy (PVP)
-- for standards guiding when and how versions should be incremented.
-- https://wiki.haskell.org/Package_versioning_policy
-- PVP summary:      +-+------- breaking API changes
--                   | | +----- non-breaking API additions
--                   | | | +--- code changes with no API change
version:             0.1.0.0

-- A short (one-line) description of the package.
synopsis:            Haskell binding to Mercury API for ThingMagic RFID readers

-- A longer description of the package.
description:
    This package is a Haskell binding to the \"Mercury API\" C API for
    ThingMagic RFID readers.  It is especially geared toward the
    <https://www.sparkfun.com/products/14066 SparkFun Simultaneous RFID Reader>,
    which uses ThingMagic's M6e Nano module, but it should work with other
    ThingMagic readers.  (Though currently, only support for serial readers
    is compiled in.)  Most of the function and type names are the same as
    their counterparts in the C API, with the @TMR_@ prefix dropped.  For more
    in-depth, language-independent documentation of Mercury API, see
    <http://www.thingmagic.com/images/Downloads/Docs/MercuryAPI_ProgrammerGuide_for_v1.27.3.pdf Mercury API Programmers Guide>.

-- The license under which the package is released.
license:             MIT

-- The file containing the license text.
license-file:        LICENSE

-- The package author(s).
author:              Patrick Pelletier

-- An email address to which users can send suggestions, bug reports, and
-- patches.
maintainer:          code@funwithsoftware.org

homepage:            https://github.com/ppelleti/hs-mercury-api

bug-reports:         https://github.com/ppelleti/hs-mercury-api/issues

-- A copyright notice.
copyright:           © Patrick Pelletier, 2017

category:            Hardware

build-type:          Simple

-- Extra files to be distributed with the package, such as examples or a
-- README.
extra-source-files:  ChangeLog.md
                   , README.md
                   , UPGRADING.md
                   , examples/LICENSE-FOR-EXAMPLES
                   , tests/*.result
                   , tests/*.transport
                   , cbits/api/*.h
                   , cbits/api/patches/README.md
                   , cbits/api/patches/*.patch
                   , cbits/glue/glue.h

-- Constraint on the version of Cabal needed to build this package.
cabal-version:       >=1.10

tested-with:
  GHC==7.6.3,
  GHC==7.8.4,
  GHC==7.10.3,
  GHC==8.0.2

source-repository head
  Type:     git
  Location: https://github.com/ppelleti/hs-mercury-api.git


library
  -- Modules exported by the library.
  exposed-modules:     System.Hardware.MercuryApi
                     , System.Hardware.MercuryApi.Params
                     , System.Hardware.MercuryApi.Testing

  -- Modules included in this library but not exported.
  other-modules:       System.Hardware.MercuryApi.Enums
                     , System.Hardware.MercuryApi.Records
                     , System.Hardware.MercuryApi.ParamValue

  -- LANGUAGE extensions used by modules in this package.
  -- other-extensions:

  -- Apparently these are supposed to be listed in dependency order,
  -- although the Cabal documentation doesn't breathe a word about it:
  -- https://ghc.haskell.org/trac/ghc/ticket/13786#comment:3
  --
  -- Furthermore, it appears that Cabal always puts conditional sources
  -- after unconditional sources, so in order to get the sources in the
  -- right order, they need to all be conditional, i. e. we have to list
  -- the sources twice, once for Windows and once for POSIX.
  if os(windows)
    c-sources:         cbits/api/serial_transport_win32.c
                     , cbits/api/osdep_win32.c
                     , cbits/api/tmr_strerror.c
                     , cbits/api/tmr_utils.c
                     , cbits/api/tmr_param.c
                     , cbits/api/hex_bytes.c
                     , cbits/api/serial_reader_l3.c
                     , cbits/api/serial_reader.c
                     , cbits/api/tm_reader_async.c
                     , cbits/api/tm_reader.c
                     , cbits/glue/glue.c
  else
    c-sources:         cbits/api/serial_transport_posix.c
                     , cbits/api/osdep_posix.c
                     , cbits/api/tmr_strerror.c
                     , cbits/api/tmr_utils.c
                     , cbits/api/tmr_param.c
                     , cbits/api/hex_bytes.c
                     , cbits/api/serial_reader_l3.c
                     , cbits/api/serial_reader.c
                     , cbits/api/tm_reader_async.c
                     , cbits/api/tm_reader.c
                     , cbits/glue/glue.c

  include-dirs:        cbits/api
                     , cbits/glue

  cc-options:          -DTMR_ENABLE_SERIAL_READER_ONLY=1
                       -DTMR_USE_HOST_C_LIBRARY=1

  -- Other library packages from which modules are imported.
  build-depends:       base >= 4.6 && < 5
                     , ansi-terminal >= 0.6.2.3 && < 0.7
                     , bytestring >= 0.10.4 && < 0.11
                     , clock >= 0.7.2 && < 0.8
                     , hashable >= 1.2.4 && < 1.3
                     , text >= 1.2 && < 1.3
                     , unordered-containers >= 0.2.7.1 && < 0.3

  -- Directories containing source files.
  hs-source-dirs:      src

  -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
  build-tools:         hsc2hs

  -- Base language which the package is written in.
  default-language:    Haskell2010


executable tmr-params
  main-is:             tmr-params.hs
  other-modules:       ExampleUtil
  build-depends:       base >= 4.6 && < 5
                     , ansi-terminal >= 0.6.2.3 && < 0.7
                     , bytestring >= 0.10.4 && < 0.11
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      examples
  default-language:    Haskell2010
  ghc-options:         -threaded


executable tmr-firmware
  main-is:             tmr-firmware.hs
  other-modules:       ExampleUtil
  build-depends:       base >= 4.6 && < 5
                     , bytestring >= 0.10.4 && < 0.11
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      examples
  default-language:    Haskell2010
  ghc-options:         -threaded


executable tmr-read
  main-is:             tmr-read.hs
  other-modules:       ExampleUtil
  build-depends:       base >= 4.6 && < 5
                     , ansi-terminal >= 0.6.2.3 && < 0.7
                     , bytestring >= 0.10.4 && < 0.11
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      examples
  default-language:    Haskell2010
  ghc-options:         -threaded


executable tmr-write
  main-is:             tmr-write.hs
  other-modules:       ExampleUtil
  build-depends:       base >= 4.6 && < 5
                     , ansi-terminal >= 0.6.2.3 && < 0.7
                     , bytestring >= 0.10.4 && < 0.11
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      examples
  default-language:    Haskell2010
  ghc-options:         -threaded


executable tmr-lock
  main-is:             tmr-lock.hs
  other-modules:       ExampleUtil
  build-depends:       base >= 4.6 && < 5
                     , bytestring >= 0.10.4 && < 0.11
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      examples
  default-language:    Haskell2010
  ghc-options:         -threaded


executable tmr-gpio
  main-is:             tmr-gpio.hs
  other-modules:       ExampleUtil
  build-depends:       base >= 4.6 && < 5
                     , bytestring >= 0.10.4 && < 0.11
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      examples
  default-language:    Haskell2010
  ghc-options:         -threaded


test-suite replay
  type:                exitcode-stdio-1.0
  main-is:             replay.hs
  build-depends:       base >= 4.6 && < 5
                     , bytestring >= 0.10.4 && < 0.11
                     , directory >= 1.2.2 && < 1.4
                     , mercury-api
                     , optparse-applicative >= 0.13 && < 0.14
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      tests
  default-language:    Haskell2010
  ghc-options:         -threaded


test-suite unit
  type:                exitcode-stdio-1.0
  main-is:             unit.hs
  build-depends:       base >= 4.6 && < 5
                     , bytestring >= 0.10.4 && < 0.11
                     , HUnit >= 1.5 && < 1.7
                     , mercury-api
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      tests
  default-language:    Haskell2010
  ghc-options:         -threaded


test-suite param-test
  type:                exitcode-stdio-1.0
  main-is:             param-test.hs
  build-depends:       base >= 4.6 && < 5
                     , HUnit >= 1.5 && < 1.7
                     , mercury-api
                     , text >= 1.2 && < 1.3
  hs-source-dirs:      tests
  default-language:    Haskell2010
  ghc-options:         -threaded