name:            persistent-sqlite
version:         2.10.0
license:         MIT
license-file:    LICENSE
author:          Michael Snoyman <michael@snoyman.com>
maintainer:      Michael Snoyman <michael@snoyman.com>
synopsis:        Backend for the persistent library using sqlite3.
description:     This package includes a thin sqlite3 wrapper based on the direct-sqlite package, as well as the entire C library, so there are no system dependencies.
category:        Database, Yesod
stability:       Stable
cabal-version:   >= 1.10
build-type:      Simple
homepage:        http://www.yesodweb.com/book/persistent
bug-reports:     https://github.com/yesodweb/persistent/issues
extra-source-files: ChangeLog.md cbits/*.c cbits/*.h

flag systemlib
  description: Use the system-wide sqlite library
  default: False
flag use-pkgconfig
  description: Use pkg-config to find system sqlite library
  default: False
flag build-sanity-exe
  description: Build a sanity check test executable
  default: False
flag full-text-search
  description: Enable full-text search in the vendored SQLite library; has no effect if a system SQLite library is used.
  default: True
flag uri-filenames
  description: Enable URI filenames in the vendored SQLite library; has no effect if a system SQLite library is used.
  default: True
flag have-usleep
  description: Enable usleep in the vendored SQLite library; has no effect if a system SQLite library is used.
  default: True
flag json1
  description: Enable json1 in the vendored SQLite library; has no effect if a system SQLite library is used.
  default: True

library
    build-depends:   base                    >= 4.9         && < 5
                   , persistent              >= 2.10        && < 3
                   , aeson                   >= 1.0
                   , bytestring              >= 0.10
                   , conduit                 >= 1.2.12
                   , containers              >= 0.5
                   , microlens-th            >= 0.4.1.1
                   , monad-logger            >= 0.3.25
                   , resource-pool
                   , resourcet               >= 1.1.9
                   , text                    >= 1.2
                   , time
                   , transformers            >= 0.5
                   , unliftio-core
                   , unordered-containers
    exposed-modules: Database.Sqlite
                     Database.Persist.Sqlite
    ghc-options:     -Wall
    default-language: Haskell2010
    if flag(systemlib)
        if flag(use-pkgconfig)
            pkgconfig-depends: sqlite3
        else
            extra-libraries: sqlite3
    else
        c-sources:   cbits/sqlite3.c
        include-dirs: cbits
        cc-options:  -fPIC -std=c99
    if flag(full-text-search)
      cc-options: -DSQLITE_ENABLE_FTS3
                  -DSQLITE_ENABLE_FTS3_PARENTHESIS
                  -DSQLITE_ENABLE_FTS4
                  -DSQLITE_ENABLE_FTS5
    if flag(uri-filenames)
      cc-options: -DSQLITE_USE_URI
    if flag(have-usleep)
       cc-options: -DHAVE_USLEEP
    if flag(json1)
      cc-options: -DSQLITE_ENABLE_JSON1

    c-sources: cbits/config.c

    if !os(windows)
        extra-libraries: pthread

source-repository head
  type:     git
  location: git://github.com/yesodweb/persistent.git

executable sanity
    if flag(build-sanity-exe)
        buildable: True
    else
        buildable: False
    main-is: sanity.hs
    hs-source-dirs: test
    build-depends: base
                 , persistent-sqlite
                 , monad-logger
    default-language: Haskell2010

test-suite test
    type:            exitcode-stdio-1.0
    main-is:         main.hs
    hs-source-dirs:  test
    other-modules:   SqliteInit
    ghc-options:     -Wall

    build-depends:   base >= 4.9 && < 5
                   , persistent
                   , persistent-sqlite
                   , persistent-template
                   , persistent-test
                   , bytestring
                   , containers
                   , exceptions
                   , fast-logger
                   , hspec >= 2.4
                   , HUnit
                   , monad-logger
                   , QuickCheck
                   , resourcet
                   , system-fileio
                   , system-filepath
                   , temporary
                   , text
                   , time
                   , transformers
                   , time
                   , unliftio-core
    default-language: Haskell2010
