@@ -190,10 +190,10 @@ cleanPkg copts fp = do
191-- Issue number #1572 on the issue tracker
191-- Issue number #1572 on the issue tracker
192-- https://github.com/idris-lang/Idris-dev/issues/1572
192-- https://github.com/idris-lang/Idris-dev/issues/1572
193−documentPkg :: [Opt] -- ^ Command line options.
193+documentPkg :: [Opt] -- ^ Command line options.
194− -> FilePath -- ^ Path to ipkg file.
194+ -> (Bool,FilePath) -- ^ (Should we install?, Path to ipkg file).
196−documentPkg copts fp = do
196+documentPkg copts (install,fp) = do
197 pkgdesc <- parseDesc fp
197 pkgdesc <- parseDesc fp
198 cd <- getCurrentDirectory
198 cd <- getCurrentDirectory
199 let pkgDir = cd </> takeDirectory fp
199 let pkgDir = cd </> takeDirectory fp
@@ -223,7 +223,13 @@ documentPkg copts fp = do
223 putStrLn $ pshow idrisInit err
223 putStrLn $ pshow idrisInit err
224 exitWith (ExitFailure 1)
224 exitWith (ExitFailure 1)
225 Right ist -> do
225 Right ist -> do
226+ iDocDir <- getIdrisDocDir
227+ pkgDocDir <- makeAbsolute (iDocDir </> pkgname pkgdesc)
228+ let out_dir = if install then pkgDocDir else outputDir
230+ putStrLn $ unwords ["Attempting to install IdrisDocs for", pkgname pkgdesc, "in:", out_dir]
226− docRes <- generateDocs ist mods outputDir
232+ docRes <- generateDocs ist mods out_dir
227 case docRes of
233 case docRes of
228 Right _ -> return ()
234 Right _ -> return ()
229 Left msg -> do
235 Left msg -> do
@@ -279,7 +285,7 @@ installPkg :: [String] -- ^ Alternate install location
279 -> PkgDesc -- ^ iPKG file.
285 -> PkgDesc -- ^ iPKG file.
281installPkg altdests pkgdesc = inPkgDir pkgdesc $ do
287installPkg altdests pkgdesc = inPkgDir pkgdesc $ do
282− d <- getTargetDir
288+ d <- getIdrisLibDir
283 let destdir = case altdests of
289 let destdir = case altdests of
285 (d':_) -> d'
291 (d':_) -> d'
@@ -302,11 +308,11 @@ buildMods opts ns = do let f = map (toPath . showCG) ns
303testLib :: Bool -> String -> String -> IO Bool
309testLib :: Bool -> String -> String -> IO Bool
304testLib warn p f
310testLib warn p f
305− = do d <- getDataDir
311+ = do d <- getIdrisCRTSDir
306 gcc <- getCC
312 gcc <- getCC
307 (tmpf, tmph) <- tempfile ""
313 (tmpf, tmph) <- tempfile ""
308 hClose tmph
314 hClose tmph
309− let libtest = d </> "rts" </> "libtest.c"
315+ let libtest = d </> "libtest.c"
310 e <- rawSystem gcc [libtest, "-l" ++ f, "-o", tmpf]
316 e <- rawSystem gcc [libtest, "-l" ++ f, "-o", tmpf]
311 case e of
317 case e of
312 ExitSuccess -> return True
318 ExitSuccess -> return True
@@ -416,14 +422,15 @@ mergeOptions copts popts =
416 normaliseOpts = filter filtOpt
422 normaliseOpts = filter filtOpt
418 filtOpt :: Opt -> Bool
424 filtOpt :: Opt -> Bool
419− filtOpt (PkgBuild _) = False
425+ filtOpt (PkgBuild _) = False
420− filtOpt (PkgInstall _) = False
426+ filtOpt (PkgInstall _) = False
421− filtOpt (PkgClean _) = False
427+ filtOpt (PkgClean _) = False
422− filtOpt (PkgCheck _) = False
428+ filtOpt (PkgCheck _) = False
423− filtOpt (PkgREPL _) = False
429+ filtOpt (PkgREPL _) = False
430+ filtOpt (PkgDocBuild _) = False
424− filtOpt (PkgMkDoc _) = False
431+ filtOpt (PkgDocInstall _) = False
425− filtOpt (PkgTest _) = False
432+ filtOpt (PkgTest _) = False
426− filtOpt _ = True
433+ filtOpt _ = True
428 chkOpt :: Opt -> Either String Opt
435 chkOpt :: Opt -> Either String Opt
429 chkOpt o@(OLogging _) = Right o
436 chkOpt o@(OLogging _) = Right o