-
Notifications
You must be signed in to change notification settings - Fork 6
/
Setup.hs
executable file
·19 lines (16 loc) · 935 Bytes
/
Setup.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/bin/env runhaskell
import Distribution.Simple ( defaultMainWithHooks
, simpleUserHooks
, UserHooks(haddockHook)
)
import Distribution.Simple.Setup ( HaddockFlags )
import Distribution.Simple.Program ( userSpecifyArgs )
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(withPrograms) )
import Distribution.PackageDescription ( PackageDescription )
main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks { haddockHook = haddockHook' }
-- Define __HADDOCK__ for CPP when running haddock.
haddockHook' :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO ()
haddockHook' pkg lbi = haddockHook simpleUserHooks pkg $ lbi { withPrograms = p }
where
p = userSpecifyArgs "haddock" ["--optghc=-D__HADDOCK__"] (withPrograms lbi)