@@ -190,10 +190,10 @@ cleanPkg copts fp = do
190190--
191191-- Issue number #1572 on the issue tracker
192192-- https://github.com/idris-lang/Idris-dev/issues/1572
193−documentPkg :: [Opt] -- ^ Command line options.
194− -> FilePath -- ^ Path to ipkg file.
193+documentPkg :: [Opt] -- ^ Command line options.
194+ -> (Bool,FilePath) -- ^ (Should we install?, Path to ipkg file).
195195 -> IO ()
196−documentPkg copts fp = do
196+documentPkg copts (install,fp) = do
197197 pkgdesc <- parseDesc fp
198198 cd <- getCurrentDirectory
199199 let pkgDir = cd </> takeDirectory fp
@@ -223,7 +223,13 @@ documentPkg copts fp = do
223223 putStrLn $ pshow idrisInit err
224224 exitWith (ExitFailure 1)
225225 Right ist -> do
226− docRes <- generateDocs ist mods outputDir
226+ iDocDir <- getIdrisDocDir
227+ pkgDocDir <- makeAbsolute (iDocDir </> pkgname pkgdesc)
228+ let out_dir = if install then pkgDocDir else outputDir
229+ when install $ do
230+ putStrLn $ unwords ["Attempting to install IdrisDocs for", pkgname pkgdesc, "in:", out_dir]
231+
232+ docRes <- generateDocs ist mods out_dir
227233 case docRes of
228234 Right _ -> return ()
229235 Left msg -> do
@@ -279,7 +285,7 @@ installPkg :: [String] -- ^ Alternate install location
279285 -> PkgDesc -- ^ iPKG file.
280286 -> IO ()
281287installPkg altdests pkgdesc = inPkgDir pkgdesc $ do
282− d <- getTargetDir
288+ d <- getIdrisLibDir
283289 let destdir = case altdests of
284290 [] -> d
285291 (d':_) -> d'
@@ -302,11 +308,11 @@ buildMods opts ns = do let f = map (toPath . showCG) ns
302308
303309testLib :: Bool -> String -> String -> IO Bool
304310testLib warn p f
305− = do d <- getDataDir
311+ = do d <- getIdrisCRTSDir
306312 gcc <- getCC
307313 (tmpf, tmph) <- tempfile ""
308314 hClose tmph
309− let libtest = d </> "rts" </> "libtest.c"
315+ let libtest = d </> "libtest.c"
310316 e <- rawSystem gcc [libtest, "-l" ++ f, "-o", tmpf]
311317 case e of
312318 ExitSuccess -> return True
@@ -416,14 +422,15 @@ mergeOptions copts popts =
416422 normaliseOpts = filter filtOpt
417423
418424 filtOpt :: Opt -> Bool
419− filtOpt (PkgBuild _) = False
420− filtOpt (PkgInstall _) = False
421− filtOpt (PkgClean _) = False
422− filtOpt (PkgCheck _) = False
423− filtOpt (PkgREPL _) = False
424− filtOpt (PkgMkDoc _) = False
425− filtOpt (PkgTest _) = False
426− filtOpt _ = True
425+ filtOpt (PkgBuild _) = False
426+ filtOpt (PkgInstall _) = False
427+ filtOpt (PkgClean _) = False
428+ filtOpt (PkgCheck _) = False
429+ filtOpt (PkgREPL _) = False
430+ filtOpt (PkgDocBuild _) = False
431+ filtOpt (PkgDocInstall _) = False
432+ filtOpt (PkgTest _) = False
433+ filtOpt _ = True
427434
428435 chkOpt :: Opt -> Either String Opt
429436 chkOpt o@(OLogging _) = Right o