name:                hadrian
version:             0.1.0.0
synopsis:            GHC build system
license:             BSD3
license-file:        LICENSE
author:              Andrey Mokhov <andrey.mokhov@gmail.com>, github: @snowleopard
maintainer:          Andrey Mokhov <andrey.mokhov@gmail.com>, github: @snowleopard
copyright:           Andrey Mokhov 2014-2017
category:            Development
build-type:          Simple
cabal-version:       >=1.10

source-repository head
    type:     git
    location: https://gitlab.haskell.org/ghc/ghc

-- To accommodate #16873
flag threaded
    manual:              True
    default:             True
    description:         Build with the threaded runtime for improved
                         performance. Users with bootstrap compilers
                         which don't support the threaded runtime should
                         disable this flag.

executable hadrian
    main-is:             Main.hs
    hs-source-dirs:      .
                       , src
    other-modules:       Base
                       , Builder
                       , CommandLine
                       , Context
                       , Context.Path
                       , Context.Type
                       , Environment
                       , Expression
                       , Expression.Type
                       , Flavour
                       , Hadrian.Builder
                       , Hadrian.Builder.Ar
                       , Hadrian.Builder.Sphinx
                       , Hadrian.Builder.Tar
                       , Hadrian.BuildPath
                       , Hadrian.Expression
                       , Hadrian.Haskell.Cabal
                       , Hadrian.Haskell.Cabal.Type
                       , Hadrian.Haskell.Cabal.Parse
                       , Hadrian.Oracles.ArgsHash
                       , Hadrian.Oracles.Cabal
                       , Hadrian.Oracles.Cabal.Rules
                       , Hadrian.Oracles.Cabal.Type
                       , Hadrian.Oracles.DirectoryContents
                       , Hadrian.Oracles.Path
                       , Hadrian.Oracles.TextFile
                       , Hadrian.Package
                       , Hadrian.Target
                       , Hadrian.Utilities
                       , Oracles.Flag
                       , Oracles.Flavour
                       , Oracles.Setting
                       , Oracles.ModuleFiles
                       , Oracles.TestSettings
                       , Packages
                       , Rules
                       , Rules.BinaryDist
                       , Rules.Clean
                       , Rules.Compile
                       , Rules.Configure
                       , Rules.Dependencies
                       , Rules.Documentation
                       , Rules.Generate
                       , Rules.Gmp
                       , Rules.Libffi
                       , Rules.Library
                       , Rules.Lint
                       , Rules.Nofib
                       , Rules.Program
                       , Rules.Register
                       , Rules.Rts
                       , Rules.Selftest
                       , Rules.SimpleTargets
                       , Rules.SourceDist
                       , Rules.Test
                       , Rules.ToolArgs
                       , Settings
                       , Settings.Builders.Alex
                       , Settings.Builders.Cabal
                       , Settings.Builders.Common
                       , Settings.Builders.Cc
                       , Settings.Builders.Configure
                       , Settings.Builders.DeriveConstants
                       , Settings.Builders.GenPrimopCode
                       , Settings.Builders.Ghc
                       , Settings.Builders.GhcPkg
                       , Settings.Builders.Haddock
                       , Settings.Builders.Happy
                       , Settings.Builders.Hsc2Hs
                       , Settings.Builders.HsCpp
                       , Settings.Builders.Ld
                       , Settings.Builders.Make
                       , Settings.Builders.MergeObjects
                       , Settings.Builders.RunTest
                       , Settings.Builders.Xelatex
                       , Settings.Default
                       , Settings.Flavours.Benchmark
                       , Settings.Flavours.Development
                       , Settings.Flavours.GhcInGhci
                       , Settings.Flavours.Llvm
                       , Settings.Flavours.Performance
                       , Settings.Flavours.Profiled
                       , Settings.Flavours.Quick
                       , Settings.Flavours.QuickCross
                       , Settings.Flavours.Quickest
                       , Settings.Flavours.ThreadSanitizer
                       , Settings.Flavours.Validate
                       , Settings.Packages
                       , Settings.Parser
                       , Settings.Program
                       , Settings.Warnings
                       , Stage
                       , Target
                       , UserSettings
                       , Utilities
                       , Way
                       , Way.Type
    default-language:    Haskell2010
    default-extensions:  DeriveFunctor
                       , DeriveGeneric
                       , FlexibleInstances
                       , GeneralizedNewtypeDeriving
                       , LambdaCase
                       , RecordWildCards
                       , ScopedTypeVariables
                       , TupleSections
                       , BangPatterns
    other-extensions:    MultiParamTypeClasses
                       , TypeFamilies
    build-depends:       Cabal                >= 3.0     && < 3.3
                       , QuickCheck           >= 2.6     && < 2.14
                       , base                 >= 4.8     && < 5
                       , containers           >= 0.5     && < 0.7
                       , directory            >= 1.3.1.0 && < 1.4
                       , extra                >= 1.4.7
                       , filepath
                       , mtl                  == 2.2.*
                       , parsec               >= 3.1     && < 3.2
                       , shake                >= 0.18.3  && < 0.18.6
                       , transformers         >= 0.4     && < 0.6
                       , unordered-containers >= 0.2.1   && < 0.3
    build-tools:         alex  >= 3.1
                       , happy >= 1.19.10 && < 1.20
    ghc-options:       -Wall
                       -Wincomplete-record-updates
                       -Wredundant-constraints
                       -fno-warn-name-shadowing
                       -rtsopts

    if flag(threaded)
      ghc-options:
                       -- * -I0: Disable idle GC to avoid redundant GCs while
                       --        waiting for external processes
                       -- * -qg: Don't use parallel GC as the synchronization
                       --        time tends to eat any benefit.
                       "-with-rtsopts=-I0 -qg"
                       -threaded
