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-- -----------------------------------------------------------------------------
37-- use GNU make on FreeBSD
44 P.runProgramInvocation verbosity . P.simpleProgramInvocation mymake
46-- -----------------------------------------------------------------------------
49usesLLVM :: S.ConfigFlags -> Bool
51 case lookup (FlagName "llvm") (S.configConfigurationsFlags flags) of
56usesGMP :: S.ConfigFlags -> Bool
58 case lookup (FlagName "gmp") (S.configConfigurationsFlags flags) of
63-- -----------------------------------------------------------------------------
66idrisClean _ flags _ _ = do
70 verbosity = S.fromFlag $ S.cleanVerbosity flags
75 cleanLLVM = makeClean "llvm"
77 makeClean dir = make verbosity [ "-C", dir, "clean", "IDRIS=idris" ]
80-- -----------------------------------------------------------------------------
83idrisConfigure _ flags _ local = do
86 verbosity = S.fromFlag $ S.configVerbosity flags
87 version = pkgVersion . package $ localPkgDescr local
89 -- This is a hack. I don't know how to tell cabal that a data file needs
90 -- installing but shouldn't be in the distribution. And it won't make the
91 -- distribution if it's not there, so instead I just delete
92 -- the file after configure.
93 configureRTS = make verbosity ["-C", "rts", "clean"]
95-- -----------------------------------------------------------------------------
98idrisBuild _ flags _ local = do
101 when (usesLLVM $ configFlags local) buildLLVM
103 verbosity = S.fromFlag $ S.buildVerbosity flags
106 putStrLn "Building libraries..."
109 makeBuild dir = make verbosity [ "-C", dir, "build" , "IDRIS=" ++ idrisCmd local]
111 buildRTS = make verbosity (["-C", "rts", "build"] ++
112 gmpflag (usesGMP (configFlags local)))
114 buildLLVM = make verbosity ["-C", "llvm", "build"]
117 gmpflag True = ["GMP=-DIDRIS_GMP"]
119-- -----------------------------------------------------------------------------
122idrisInstall verbosity copy pkg local = do
125 when (usesLLVM $ configFlags local) installLLVM
127 target = datadir $ L.absoluteInstallDirs pkg local copy
130 putStrLn $ "Installing libraries in " ++ target
131 makeInstall "libs" target
134 let target' = target </> "rts"
135 putStrLn $ "Installing run time system in " ++ target'
136 makeInstall "rts" target'
139 let target' = target </> "llvm"
140 putStrLn $ "Installing LLVM library in " ++ target
141 makeInstall "llvm" target'
143 makeInstall src target =
144 make verbosity [ "-C", src, "install" , "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local]
146-- -----------------------------------------------------------------------------
149-- Install libraries during both copy and install
150-- See http://hackage.haskell.org/trac/hackage/ticket/718
151main = defaultMainWithHooks $ simpleUserHooks
152 { postClean = idrisClean
153 , postConf = idrisConfigure
154 , postBuild = idrisBuild
155 , postCopy = \_ flags pkg local ->
156 idrisInstall (S.fromFlag $ S.copyVerbosity flags)
157 (S.fromFlag $ S.copyDest flags) pkg local
158 , postInst = \_ flags pkg local ->
159 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