-
Notifications
You must be signed in to change notification settings - Fork 20
/
Setup.hs
31 lines (25 loc) · 1.31 KB
/
Setup.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Main where
import Distribution.Simple
import Distribution.Simple.Setup
import Distribution.Simple.LocalBuildInfo
import Distribution.PackageDescription (PackageDescription)
import System.FilePath
import System.Info
import Data.List
main = defaultMainWithHooks $ simpleUserHooks
{ postInst = postInstHook (postInst simpleUserHooks)
-- Copy for Cabal 1.20, which does not work with postInst
, postCopy = postInstHook (postCopy simpleUserHooks)
, postConf = postConfHook (postConf simpleUserHooks)
}
postInstHook oldHook args iflags pDesc lbi = do
let instDataDir = datadir $ absoluteInstallDirs pDesc lbi (fromFlag $ copyDest defaultCopyFlags)
putStrLn "To use ghc-vis you have to load its ghci file in GHCi. To do this automatically when GHCi is started run:"
case stripPrefix "mingw" os of
Just _ -> putStrLn $ "echo \":script " ++ (instDataDir </> "ghci") ++ "\" >> $APPDATA/ghc/ghci.conf"
Nothing -> putStrLn $ "echo \":script " ++ (instDataDir </> "ghci") ++ "\" >> ~/.ghci"
oldHook args iflags pDesc lbi
postConfHook oldHook args flags descr buildInfo = case profFlag of
Flag True -> error "This library cannot be built using profiling. Try invoking cabal with the --disable-library-profiling flag."
_ -> oldHook args flags descr buildInfo
where profFlag = configProfLib $ configFlags buildInfo