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
23make verbosity = P.runProgramInvocation verbosity . P.simpleProgramInvocation "make"
26-- make on mingw32 exepects unix style separators
28idrisCmd local = Px.joinPath $ splitDirectories $
29 ".." <//> buildDir local <//> "idris" <//> "idris"
30rtsDir local = Px.joinPath $ splitDirectories $
31 ".." <//> buildDir local <//> "rts" <//> "libidris_rts"
33idrisCmd local = ".." </> buildDir local </> "idris" </> "idris"
34rtsDir local = ".." </> buildDir local </> "rts" </> "libidris_rts"
38 = do make verbosity [ "-C", "lib", "clean", "IDRIS=idris" ]
39 make verbosity [ "-C", "effects", "clean", "IDRIS=idris" ]
40 make verbosity [ "-C", "javascript", "clean", "IDRIS=idris" ]
43 = do execPomExists <- doesFileExist ("java" </> "executable_pom.xml")
44 when execPomExists $ removeFile ("java" </> "executable_pom.xml")
46cleanLLVMLib verbosity = make verbosity ["-C", "llvm", "clean"]
48installStdLib pkg local withoutEffects verbosity copy
49 = do let dirs = L.absoluteInstallDirs pkg local copy
50 let idir = datadir dirs
51 let icmd = idrisCmd local
52 putStrLn $ "Installing libraries in " ++ idir
54 [ "-C", "lib", "install"
58 unless withoutEffects $
60 [ "-C", "effects", "install"
65 [ "-C", "javascript", "install"
69 let idirRts = idir </> "rts"
70 putStrLn $ "Installing run time system in " ++ idirRts
72 [ "-C", "rts", "install"
73 , "TARGET=" ++ idirRts
77installLLVMLib verbosity pkg local copy =
78 let idir = datadir $ L.absoluteInstallDirs pkg local copy in
79 make verbosity ["-C", "llvm", "install", "TARGET=" ++ idir </> "llvm"]
81buildLLVMLib verbosity = make verbosity ["-C", "llvm", "all"]
83installJavaPom pkg local verbosity copy version = do
84 putStrLn $ "Installing java pom template"
85 let dir = datadir $ L.absoluteInstallDirs pkg local copy
86 copyFile ("java" </> "executable_pom.xml") (dir </> "executable_pom.xml")
88-- This is a hack. I don't know how to tell cabal that a data file needs
89-- installing but shouldn't be in the distribution. And it won't make the
90-- distribution if it's not there, so instead I just delete
91-- the file after configure.
93removeLibIdris local verbosity
94 = do let icmd = idrisCmd local
96 [ "-C", "rts", "clean"
100checkStdLib local withoutEffects verbosity
101 = do let icmd = idrisCmd local
102 putStrLn $ "Building libraries..."
104 [ "-C", "lib", "check"
107 unless withoutEffects $
109 [ "-C", "effects", "check"
113 [ "-C", "javascript", "check"
117 [ "-C", "rts", "check"
122 case lookup (FlagName "llvm") (S.configConfigurationsFlags flags) of
128 case lookup (FlagName "noeffects") (S.configConfigurationsFlags flags) of
134 = do execPomTemplate <- TIO.readFile ("java" </> "executable_pom_template.xml")
135 TIO.writeFile ("java" </> "executable_pom.xml") (insertVersion execPomTemplate)
137 insertVersion template =
138 T.replace (T.pack "$RTS-VERSION$") (T.pack $ display version) template
140-- Install libraries during both copy and install
141-- See http://hackage.haskell.org/trac/hackage/ticket/718
143 defaultMainWithHooks $ simpleUserHooks
144 { postCopy = \ _ flags pkg lbi -> do
145 let verb = S.fromFlag $ S.copyVerbosity flags
146 let withoutEffects = noEffectsFlag $ configFlags lbi
147 installStdLib pkg lbi withoutEffects verb
148 (S.fromFlag $ S.copyDest flags)
149 installJavaPom pkg lbi verb
150 (S.fromFlag $ S.copyDest flags)
151 (pkgVersion . package $ localPkgDescr lbi)
152 when (llvmFlag $ configFlags lbi)
153 (installLLVMLib verb pkg lbi (S.fromFlag $ S.copyDest flags))
154 , postInst = \ _ flags pkg lbi -> do
155 let verb = (S.fromFlag $ S.installVerbosity flags)
156 let withoutEffects = noEffectsFlag $ configFlags lbi
157 installStdLib pkg lbi withoutEffects verb
159 installJavaPom pkg lbi verb
161 (pkgVersion . package $ localPkgDescr lbi)
162 when (llvmFlag $ configFlags lbi)
163 (installLLVMLib verb pkg lbi NoCopyDest)
164 , postConf = \ _ flags _ lbi -> do
165 removeLibIdris lbi (S.fromFlag $ S.configVerbosity flags)
166 preparePoms . pkgVersion . package $ localPkgDescr lbi
167 , postClean = \ _ flags _ _ -> do
168 let verb = S.fromFlag $ S.cleanVerbosity flags
172 , postBuild = \ _ flags _ lbi -> do
173 let verb = S.fromFlag $ S.buildVerbosity flags
174 when (llvmFlag $ configFlags lbi) (buildLLVMLib verb)
175 let withoutEffects = noEffectsFlag $ configFlags lbi
176 checkStdLib lbi withoutEffects verb
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