5import Distribution.Simple
6import Distribution.Simple.InstallDirs as I
7import Distribution.Simple.LocalBuildInfo as L
8import qualified Distribution.Simple.Setup as S
9import qualified Distribution.Simple.Program as P
10import Distribution.PackageDescription
11import Distribution.Text
14import System.FilePath ((</>), splitDirectories)
15import System.Directory
16import qualified System.FilePath.Posix as Px
18import qualified Data.Text as T
19import qualified Data.Text.IO as TIO
21-- After Idris is built, we need to check and install the prelude and other libs
23-- -----------------------------------------------------------------------------
26-- make on mingw32 exepects unix style separators
29idrisCmd local = Px.joinPath $ splitDirectories $ ".." <//> buildDir local <//> "idris" <//> "idris"
31idrisCmd local = ".." </> buildDir local </> "idris" </> "idris"
34-- -----------------------------------------------------------------------------
38 P.runProgramInvocation verbosity . P.simpleProgramInvocation "make"
40-- -----------------------------------------------------------------------------
43usesLLVM :: S.ConfigFlags -> Bool
45 case lookup (FlagName "llvm") (S.configConfigurationsFlags flags) of
50usesEffects :: S.ConfigFlags -> Bool
52 case lookup (FlagName "effects") (S.configConfigurationsFlags flags) of
57-- -----------------------------------------------------------------------------
60idrisClean _ flags _ _ = do
64 verbosity = S.fromFlag $ S.cleanVerbosity flags
69 makeClean "javascript"
71 cleanLLVM = makeClean "llvm"
73 makeClean dir = make verbosity [ "-C", dir, "clean", "IDRIS=idris" ]
76-- -----------------------------------------------------------------------------
79idrisConfigure _ flags _ local = do
82 verbosity = S.fromFlag $ S.configVerbosity flags
83 version = pkgVersion . package $ localPkgDescr local
85 -- This is a hack. I don't know how to tell cabal that a data file needs
86 -- installing but shouldn't be in the distribution. And it won't make the
87 -- distribution if it's not there, so instead I just delete
88 -- the file after configure.
89 configureRTS = make verbosity ["-C", "rts", "clean"]
91-- -----------------------------------------------------------------------------
94idrisBuild _ flags _ local = do
97 when (usesLLVM $ configFlags local) buildLLVM
99 verbosity = S.fromFlag $ S.buildVerbosity flags
102 putStrLn "Building libraries..."
104 when (usesEffects $ configFlags local) $ makeBuild "effects"
105 makeBuild "javascript"
107 makeBuild dir = make verbosity [ "-C", dir, "build" , "IDRIS=" ++ idrisCmd local]
109 buildRTS = make verbosity ["-C", "rts", "build"]
111 buildLLVM = make verbosity ["-C", "llvm", "build"]
113-- -----------------------------------------------------------------------------
116idrisInstall verbosity copy pkg local = do
119 when (usesLLVM $ configFlags local) installLLVM
121 target = datadir $ L.absoluteInstallDirs pkg local copy
124 putStrLn $ "Installing libraries in " ++ target
125 makeInstall "lib" target
126 when (usesEffects $ configFlags local) $ makeInstall "effects" target
127 makeInstall "javascript" target
130 let target' = target </> "rts"
131 putStrLn $ "Installing run time system in " ++ target'
132 makeInstall "rts" target'
135 let target' = target </> "llvm"
136 putStrLn $ "Installing LLVM library in " ++ target
137 makeInstall "llvm" target'
139 makeInstall src target =
140 make verbosity [ "-C", src, "install" , "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local]
142-- -----------------------------------------------------------------------------
145-- Install libraries during both copy and install
146-- See http://hackage.haskell.org/trac/hackage/ticket/718
147main = defaultMainWithHooks $ simpleUserHooks
148 { postClean = idrisClean
149 , postConf = idrisConfigure
150 , postBuild = idrisBuild
151 , postCopy = \_ flags pkg local ->
152 idrisInstall (S.fromFlag $ S.copyVerbosity flags)
153 (S.fromFlag $ S.copyDest flags) pkg local
154 , postInst = \_ flags pkg local ->
155 idrisInstall (S.fromFlag $ S.installVerbosity flags)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list