name: frontend
version: 0.1
cabal-version: >= 1.8
build-type: Simple

-- This ensures the platform-specific source files are also included in `cabal
-- sdist`.
extra-source-files: android-src/FrontendPaths.hs
                    android-src/MainWidget.c
                    android-src/MainWidget.hsc
                    android-src/include/MainWidget.h
                    linux-src/FrontendPaths.hs

library
  hs-source-dirs: src
  build-depends: aeson
               , async
               , base
               , base32
               , base64-bytestring
               , bytestring
               , categories
               , cereal
               , common
               , containers
               , data-default-class
               , directory
               , extra
               , gbs-downloader >= 0.1
               , ghc-prim
               , jsaddle
               , jsaddle-dom
               , magic-foldr
               , magic-wormhole
               , megaparsec
               , obelisk-executable-config-lookup
               , obelisk-frontend
               , obelisk-generated-static
               , obelisk-route
               , raw-strings-qq
               , reflex
               , reflex-dom-core
               , req
               , spake2
               , tahoe-capabilities
               , tahoe-chk
               , tahoe-directory
               , tahoe-great-black-swamp
               , tahoe-ssk
               , text
               , unix
               , yaml

  if os(android)
    -- Pull in the Android implementation of some platform-specific modules.
    hs-source-dirs: android-src

    -- And their dependencies.
    build-depends: android-activity
    build-depends: aeson

    -- Make sure our Android-only glue module is usable.
    other-modules: MainWidget

    -- And supply some configuration to the C build toolchain.
    include-dirs: android-src/include
    c-sources: android-src/MainWidget.c

    -- From inspection of reflex-dom.cabal, it seems like this should be
    -- necessary.  However, the build appears to succeed even without it.  I
    -- don't really know what's going on here.
    build-tools: hsc2hs
  else
    -- Here, get the Linux implementation of those platform-specific modules.
    hs-source-dirs: linux-src
    -- And their dependencies.
    build-depends: xdg-basedir
    build-depends: directory
    build-depends: reflex-dom

  exposed-modules:
    App
    PerformEvent
    MagicFolder
    Controller
    Frontend
    FrontendPaths
    Navigation
    PlatformEvents
    Static
    Pages.FileBrowser
    Pages.MagicFolders
    Pages.FirstRun
    Pages.TechDemo
    WormholeInvite

  ghc-options: -Wall -Wredundant-constraints -Wincomplete-uni-patterns -Wincomplete-record-updates -O -fno-show-valid-hole-fits

executable frontend
  main-is: main.hs
  hs-source-dirs: src-bin
  build-depends: base
               , common
               , obelisk-frontend
               , obelisk-route
               , obelisk-generated-static
               , frontend
  ghc-options: -threaded -O -Wredundant-constraints -Wincomplete-record-updates -fno-show-valid-hole-fits
  if impl(ghcjs)
    ghc-options: -dedupe
    cpp-options: -DGHCJS_BROWSER
  if os(darwin)
    ghc-options: -dynamic